Skip to content

Calltracking

This group of API methods is used to export and import data about phone calls, phone numbers and call tracking scripts.

Mind that phone numbers are substituted under corresponding scripts in Roistat. That is to say, active scripts are to be defined which leads to corresponding phone numbers throwing on specific pages.

A script in Roistat is a set of rules and settings according to which phone numbers should be substituted on your website. Furthermore, scripts can be used to monitor effectiveness of your offline advertisements (static call tracking).

Create and customize a call tracking script

POST /project/calltracking/script/create

This method allows to create and customize a call tracking script.

curl 'https://cloud.roistat.com/api/v1/project/calltracking/script/create?project=12345' \
    --request POST \
    --header 'Content-type: application/json' \ 
    --header 'Api-key: {KEY}' \ 
    --data Request body - see below

Request Body:

{
    "name": "Basic script",
    "is_enabled": 1,
    "creation_date": "2016-10-11T21:00:00.000Z",
    "options": {
        "calltracking_type": "dynamic",
        "segments": [
            [
                "source",
                "like%",
                "organic"
            ]
        ],
        "phone_format": "8 (XXX) XXX-XX-XX",
        "css_selector": [
            "test"
        ],
        "redirect": {
            "type": "phone",
            "value": "74951234567"
        },
        "replaceable_numbers": [
            "89451111111",
            "89452222222"
        ]
    },
    "integration": {
        "crm": {
            "custom_fields": [
                {
                    "id": "UF_CRM_1474452137",
                    "type": "text",
                    "value": "eee"
                }
            ],
            "is_enabled": 1
        },
        "webhook": {
            "url": "ne.buildie.ru/testhandler.php"
        },
        "webhook_start": {
            "url": "ne.buildie.ru/testhandler2.php"
        },
        "google_analytics": {
            "tracking_id": "UA-123123-123",
            "action": "call",
            "category": "phone",
            "label": "roistat"
        },
        "is_lead_auto_create": 1
    }
}
{
    "data": {
        "id": 1,
        "name": "Basic script",
        "creation_date": "2016-10-12T08:19:23+0000",
        "is_enabled": 1,
        "call_count": 0,
        "accuracy": null,
        "options": {
            "calltracking_type": "dynamic",
            "static_source": null,
            "css_selector": [
                "test"
            ],
            "phone_format": "8 (XXX) XXX-XX-XX",
            "redirect": {
                "type": "phone",
                "value": "74951234567"
            },
            "segments": [
                [
                    "source",
                    "like%",
                    "organic"
                ]
            ],
            "target_call_time": 0
        },
        "integration": {
            "is_lead_auto_create": 1,
            "crm": {
                "enabled": 1,
                "custom_fields": [
                    {
                        "id": "UF_CRM_1474452137",
                        "type": "text",
                        "value": "eee"
                    }
                ]
            },
            "webhook": {
                "url": "ne.buildie.ru/testhandler.php"
            },
            "webhook_start": {
                "url": "ne.buildie.ru/testhandler2.php"
            },
            "google_analytics": {
                "tracking_id": "UA-123123-123",
                "action": "call",
                "category": "phone",
                "label": "roistat"
            }
        },
        "needed_phone_count": null
    },
    "total": 1,
    "status": "success"
}

Query String:

Parameter Type Description Required
project string Project number yes

Request Body:

Parameter Type Description Required
name string A human-readable script name in Roistat no
is_enabled integer This characteristic relates to the status of the script: 1 - create and enable, 0 - only create no
creation_date string Script creation date no
options object no
calltracking_type string Call tracking type: dynamic or static no
segments oneOf Marketing channel to which script phone numbers have been assigned no
phone_format string Format in which replacing numbers will be displayed on your website:
country code must be a numeral or a numeral with a symbol; the remaining numerals must be replaced by X letters
no
css_selector array[string] Сss class/classes or id of website elements with numbers for substitution. The # symbol without spaces must precede an id name. no
redirect object Call forwarding settings no
>> type string Type of a number for call forwarding: * phone - phone number; * sip - external SIP account; * sip_trunk - Roistat SIP account. no
>> value string The value of this parameter depends on the specified type of call forwarding: a phone number, external SIP account name or password for the Roistat SIP account respectively no
replaceable_numbers array[string] Numbers that will replace the main number yes
integration object Integration settings no
crm object Settings of the integration with a CRM no
>> custom_fields array[object] Lead's custom fields no
>>> id string Field ID from the CRM no
>>> type string Field type no
>>> value string Value that must be recorded to this custom field in the CRM no
>> is_enabled integer This parameter defines whether any additional data are to be sent to leads' custom fields in the CRM no
webhook object Setttings of a webhook used to transfer data about phone calls once they are over no
>> url string URL of an external application used to receive data about phone calls no
webhook_start object Setttings of a webhook used to transfer data about a phone call at the moment of the call no
>> url string URL of an external application used to receive data about phone calls no
google_analytics object Event settings of a call to be sent to your Google Analytics account no
>> tracking_id string Tracking ID (UA-XXX-Y) no
>> action string Name of an action for the event (always call) no
>> category string Name of a category for the event (always phone) no
>> label string Name of a label for the event (always roistat) no
is_lead_auto_create integer This parameter defines whether leads for calls must be created, besides deals: 1 - to be created, 0 - not to be created no
Parameter Type Description
data object
id integer Script ID
name string A human-readable script name in Roistat
creation_date string Script creation date
is_enabled integer This characteristic relates to the status of the script: 1 - create and enable, 0 - only create
call_count integer Number of calls made to the numbers of the script
accuracy null or integer Accuracy rate of call tracking
options object
>> calltracking_type string Call tracking type: dynamic or static
>> static_source null or string null for dynamic call tracking;
channel system name for static call tracking
>> css_selector array[string] Сss class/classes or id of website elements with numbers for substitution. The # symbol without spaces must precede an id name
>> phone_format string Format in which replacing numbers will be displayed on your website:
country code must be a numeral or a numeral with a symbol; the remaining numerals must be replaced by X letters
>> redirect object Call forwarding settings
>>> type string Type of a number for call forwarding:
phone - phone number;
sip - external SIP account;
sip_trunk - Roistat SIP account
>>> value string The value of this parameter depends on the specified type of call forwarding: a phone number, external SIP account name or password for the Roistat SIP account respectively
>> segments anyOf Marketing channel to which script phone numbers have been assigned
>> target_call_time integer Target call time. Is not used in Roistat at the moment
integration object Integration settings
>> is_lead_auto_create integer This parameter defines whether leads for calls must be created, besides deals: 1 - to be created, 0 - not to be created
>> crm object Settings of the integration with a CRM
>>> is_enabled integer This parameter defines whether any additional data are to be sent to leads' custom fields in the CRM
>>> custom_fields array[object] Lead's custom fields
>>>> id string Field ID from the CRM
>>>> type string Field type
>>>> value string Value that must be recorded to this custom field in the CRM
>> webhook null or object Setttings of a webhook used to transfer data about phone calls once they are over
>>> url null or string URL of an external application used to receive data about phone calls
>> webhook_start null or object Setttings of a webhook used to transfer data about a phone call at the moment of the call
>>> url null or string URL of an external application used to receive data about phone calls
>>  google_analytics null or object Event settings of a call to be sent to your Google Analytics account
>>> tracking_id null or string Tracking ID (UA-XXX-Y)
>>> action string Name of an action for the event (always call)
>>> category string Name of a category for the event (always phone)
>>> label string Name of a label for the event (always roistat)
needed_phone_count null Quantaty of phone numbers that are necessary to reach 100% accuracy rate in call tracking
total integer
status string

Upload data on all scripts ever created within the project

POST /project/calltracking/script/list

Using this method, you can upload data on all scripts ever created within the project.

In addition, you can query existing and deleted scripts. To do this, specify the "is_deleted" parameter in the request body with a value of 0 or 1: the script exists in the project or is deleted, respectively.

You can send a request in the format of both GET and POST.

curl 'https://cloud.roistat.com/api/v1/project/calltracking/script/list?project=12345' \
    --request POST \
    --header 'Content-type: application/json' \ 
    --header 'Api-key: {KEY}' 
{
    "data": [
        {
            "id": 1,
            "name": "Basic script",
            "creation_date": "2016-10-12T08:19:23+0000",
            "is_enabled": 1,
            "call_count": 0,
            "accuracy": null,
            "options": {
                "calltracking_type": "dynamic",
                "static_source": null,
                "css_selector": [
                    "test"
                ],
                "phone_format": "8 (XXX) XXX-XX-XX",
                "redirect": {
                    "type": "phone",
                    "value": "74951234567"
                },
                "segments": [
                    [
                        "source",
                        "like%",
                        "organic"
                    ]
                ],
                "target_call_time": 0
            },
            "integration": {
                "is_lead_auto_create": "1",
                "crm": {
                    "enabled": 1,
                    "custom_fields": [
                        {
                            "id": "UF_CRM_12345",
                            "type": "text",
                            "value": "eee"
                        }
                    ]
                },
                "webhook": {
                    "url": "site.ru/webhook.php"
                },
                "webhook_start": {
                    "url": null
                },
                "google_analytics": {
                    "tracking_id": "UA-123123-123",
                    "action": "call",
                    "category": "phone",
                    "label": "roistat"
                }
            },
            "needed_phone_count": null
        }
    ],
    "total": 1,
    "status": "success"
}

Query String:

Parameter Type Description Required
project string Project number yes

Request Body:

No parameters.

Parameter Type Description
data array[object]
id integer script id
name string Human-readable script name
creation_date string Date and time of the script creation
is_enabled integer Parameter related to whether the script is activated or not: 1 - activated; 0 - not activated
call_count integer Number of calls to script numbers
accuracy null or integer Call Tracking Accuracy
options object
>> calltracking_type string Call-tracking type: dynamic, static
>> static_source null or string null for dynamic call tracking or system name of advertising source for static call tracking
>> css_selector array[string] CSS-class or id of the element with a substitute number on the site
>> phone_format string The format in which the numbers for the substitution will be displayed on the website:
the country code is indicated by a digit or a digit with a symbol, and the remaining digits are replaced with X
>> redirect object Redirection settings
>>> type string Type of number to forward: phone - phone number; sip - third-party SIP account; sip_trunk - SIP user Roistat
>>> value string The value of the parameter depends on the specified type of forwarding: a phone number, a third-party SIP account, or a password for the SIP account from Roistat
>>> sip_trunk_postfix null or string Postfix in the username for SIP accounts from Roistat. For example, if the user’s SIP name is roistat123_5, then 5 is postfix
>> segments anyOf Parameters for specifying an advertising channel. Format: a list of lists or an object with lists of lists, where the keys are the logical operators AND or OR
>> target_call_time integer Target call time. Currently not used in Roistat
integration object Integration settings
>> is_lead_auto_create string A parameter that determines whether to create calls for calls in CRM in addition to transactions: 1 - create, 0 - do not create
>> crm object CRM integration settings
>>> enabled integer Parameter that determines whether to send any data to additional transaction fields in CRM
>>> custom_fields array[object] Additional order fields
>>>> id string field id from CRM
>>>> type string field type
>>>> value string Value that is specified in the additional field
>> webhook null or object Settings for sending data after a call using Webhook
>>> url null or string The URL of the third-party application to which call data should arrive
>> google_analytics null or object Settings for sending to Google analytics targets for a call
>>> tracking_id null or string Resource Identifier (UA-XXX-Y)
>>> action string Event action (always call)
>>> category string Event category (always phone)
>>> label string Event label (always roistat)
>> webhook_start null or object Settings for sending data at the time of a call using Webhook
>>> url null or string The URL of the third-party application to which call data should arrive
needed_phone_count null Number of phone numbers required for 100% accuracy of call tracking
total integer
status string

Delete a script

POST /project/calltracking/script/delete

Used to completely remove the calltracking script.

curl 'https://cloud.roistat.com/api/v1/project/calltracking/script/delete?project=12345' \
    --request POST \
    --header 'Content-type: application/json' \ 
    --header 'Api-key: {KEY}' \ 
    --data Request body - see below

Request Body:

{
    "id": 1
}
{
    "status": "success"
}

Query String:

Parameter Type Description Required
project string Project number yes

Request Body:

Parameter Type Description Required
id integer Script ID yes
Parameter Type Description
status string

Edit the existing script settings or deactivate it (not delete)

POST /project/calltracking/script/update

Used to edit the settings of the existing call-tracking script, as well as its deactivation (not deleting!).

curl 'https://cloud.roistat.com/api/v1/project/calltracking/script/update?project=12345' \
    --request POST \
    --header 'Content-type: application/json' \ 
    --header 'Api-key: {KEY}' \ 
    --data Request body - see below

Request Body:

{
    "id": 1,
    "name": "New script",
    "is_enabled": 1,
    "options": {
        "calltracking_type": "dynamic",
        "segments": [
            [
                "source",
                "like%",
                "organic"
            ]
        ],
        "phone_format": "8 (XXX) XXX-XX-XX",
        "css_selector": [
            "test"
        ],
        "redirect": {
            "type": "phone",
            "value": "74951234567"
        }
    },
    "integration": {
        "crm": {
            "custom_fields": [
                {
                    "id": "UF_CRM_1474452137",
                    "type": "text",
                    "value": "eee"
                }
            ],
            "is_enabled": 1
        },
        "webhook": {
            "url": "ne.buildie.ru/testhandler.php"
        },
        "webhook_start": {
            "url": "ne.buildie.ru/testhandler2.php"
        },
        "google_analytics": {
            "tracking_id": "UA-123123-123",
            "action": "call",
            "category": "phone",
            "label": "roistat"
        },
        "is_lead_auto_create": 1
    }
}
{
    "status": "success"
}

Query String:

Parameter Type Description Required
project string Project number yes

Request Body:

Parameter Type Description Required
id integer script id yes
name string Human-readable script name no
is_enabled integer Parameter related to whether the script is activated or not: * 1 * - activated, * 0 * - not activated no
options object no
calltracking_type string Call-tracking type: * dynamic * - dynamic, * static * - static no
segments anyOf Parameters for specifying an advertising channel. Format: a list of lists or an object with lists of lists, where the keys are the logical operators * AND * or * OR * no
phone_format string The format in which the numbers for the substitution will be displayed on the site: the country code is indicated by a digit or a digit with a symbol, and the remaining digits are replaced with X no
css_selector array[string] Css-class / classes or the id of the element with a replaceable number on the site. The id is followed by the # symbol without spaces no
redirect object Redirection settings no
>> type string Type of number to forward: * ** phone ** - phone number; * ** sip ** - third-party SIP account; * ** sip_trunk ** - SIP user Roistat no
>> value string The value of the parameter depends on the specified type of forwarding: a phone number, a third-party SIP account, or a password for the SIP account from Roistat no
integration object Integration settings no
crm object CRM integration settings no
>> custom_fields array[object] Additional order fields no
>>> id string field id from CRM yes
>>> type string field type no
>>> value string Value that will be specified in the additional field no
>> is_enabled integer Parameter that determines whether to send any data to additional transaction fields in CRM no
webhook object Settings for sending data after a call using Webhook no
>> url string URL of the third party app to which data about calls should be sent no
google_analytics object Settings for sending to Google analytics targets for a call no
>> tracking_id string Resource Identifier (UA-XXX-Y) no
>> action string Event action (always call) no
>> category string Event category (always phone) no
>> label string Event label (always roistat) no
is_lead_auto_create integer a parameter that determines whether to create requests for calls in CRM in addition to transactions: * 1 * create, * 0 * do not create no
webhook_start null or object Settings for sending data at the time of a call using Webhook no
>> url null or string The URL of the third-party application to which call data should arrive no
Parameter Type Description
status string

Upload analytical data on calls for a specified period

POST /project/calltracking/data

Using this method, you can upload analytical data on calls for a specified period. In the Roistat interface, this method is used for Dashboard Call Tracking.

You can send a request in both GET and POST formats.

curl 'https://cloud.roistat.com/api/v1/project/calltracking/data?project=12345' \
    --request POST \
    --header 'Content-type: application/json' \ 
    --header 'Api-key: {KEY}' \ 
    --data Request body - see below

Request Body:

{
    "period": {
        "from": "2016-07-01T00:00:00+0300",
        "to": "2016-10-31T23:59:59+0300"
    }
}
{
    "data": {
        "period": {
            "startDate": "2016-06-30T21:00:00+0000",
            "endDate": "2016-10-31T20:59:59+0000"
        },
        "hourlyWeeklyQuantity": {
            "byHours": [
                {
                    "success": 0,
                    "missed": 0,
                    "hour": "01"
                },
                {
                    "success": 0,
                    "missed": 0,
                    "hour": "02"
                }
            ],
            "byWeekdays": [
                {
                    "success": 0,
                    "missed": 0,
                    "date": "2016-10-30T00:00:00+0000"
                },
                {
                    "success": 0,
                    "missed": 0,
                    "date": "2016-10-31T00:00:00+0000"
                }
            ],
            "total": 39
        },
        "dailyDuration": {
            "values": [
                {
                    "value": 0,
                    "date": "2016-10-30T00:00:00+0000"
                },
                {
                    "value": 0,
                    "date": "2016-10-31T00:00:00+0000"
                }
            ],
            "average": 0.23418803418803
        },
        "dailyQuantity": {
            "values": [
                {
                    "value": 0,
                    "date": "2016-10-30T00:00:00+0000"
                },
                {
                    "value": 0,
                    "date": "2016-10-31T00:00:00+0000"
                }
            ],
            "average": 0.31451612903226001
        },
        "markerQuantity": [
            {
                "displayName": "Direct visits",
                "value": 17,
                "systemName": ""
            },
            {
                "displayName": "Visits from sites",
                "value": 3,
                "systemName": "site"
            },
            {
                "displayName": "yandex",
                "value": 2,
                "systemName": "yandex"
            },
            {
                "displayName": "Остальные",
                "value": 17,
                "systemName": "Others"
            }
        ],
        "markerDuration": [
            {
                "displayName": "yandex",
                "iconUrl": "",
                "value": 7.5,
                "systemName": "yandex"
            },
            {
                "displayName": "Direct visits",
                "iconUrl": "https://cloud.roistat.com/img/arrow-right.png",
                "value": 10.235294117646999,
                "systemName": ""
            },
            {
                "displayName": "Visits from sites",
                "iconUrl": "https://cloud.roistat.com/img/globe.png",
                "value": 24,
                "systemName": "site"
            }
        ],
        "regionQuantity": [
            {
                "value": 21,
                "displayName": "Moscow"
            },
            {
                "value": 1,
                "displayName": "Minsk"
            },
            {
                "value": 17,
                "displayName": "Other"
            }
        ],
        "callCost": {
            "values": [
                {
                    "value": 0,
                    "date": "2016-10-30T00:00:00+0000"
                },
                {
                    "value": 0,
                    "date": "2016-10-31T00:00:00+0000"
                }
            ],
            "average": 80.725774193548006
        }
    },
    "status": "success"
}

Query String:

Parameter Type Description Required
project string Project number yes

Request Body:

Parameter Type Description Required
period object Dates period yes
from string start date in the format 2016-07-01T00:00:00+0300 yes
to string end date in the format 2016-07-31T00:00:00+0300 yes
Parameter Type Description
data object
period object Statistics period
>> startDate string
>> endDate string
hourlyWeeklyQuantity object Statistics of received and missed calls for the period
>> byHours array[object] Call statistics by hour. Total 24 objects for each hour
>>> success integer Number of received calls
>>> missed integer Number of missed calls
>>> hour string 01 - period from 00:00 to 01:00 etc.
>> byWeekdays array[object] Call statistics by day of the week from Monday to Sunday. A total of 7 objects for each day of the week
>>> success integer Number of answered calls
>>> missed integer Number of missed calls
>>> date string
>> total integer Total calls for the period
dailyDuration object Statistics on expenses for each day of the period
>> values array[object] Call costs for each day of the period. The array contains as many objects as there are days in the period
>>> value integer Calling costs per day of the period
>>> date string Statistics display date
>> average number Average expenses per day
dailyQuantity object Statistics on the number of calls for the period
>> values array[object] Statistics on the number of calls for each day of the period. The array contains as many objects as there are days in the period
>>> value integer Number of calls per day
>>> date string Statistics display date
>> average number Average number of calls per day for the period
markerQuantity array[object] Statistics on the number of calls from the 5 most popular channels
>> displayName string Human-readable channel name
>> value integer Number of calls from the channel per period
>> systemName string Channel system name
markerDuration array[object] Average duration of calls for each channel
>> displayName string Human-readable channel name
>> iconUrl string Channel icon link
>> value integer или number Average call duration per channel (seconds)
>> systemName string Channel system name
regionQuantity array[object] Statistics on the number of calls for the 5 most popular regions
>> value integer Number of calls by region for the period
>> displayName string Human-readable name of the region
callCost object Statistics on the cost of attracted calls
>> values array[object] The cost of attracted calls for each day of the period. The array contains as many objects as there are days in the period
>>> value integer Cost of attracted calls per day
>>> date string Statistics date
>> average number Average cost per call
status string

Export call history for a specified period in the .xls format

POST /project/calltracking/call/xls/export

This method is used to export call history for a specified period in the file format Microsoft Office Excel 97-2003 Sheet (.xls).

Such a file will contain a table in which data on calls for the selected period will be indicated in the following columns:

Date, Customer Number, Dialed Number, Status, Duration, Call Recording, Transaction Number, Comment, Visit Number, Source, City, Country, Domain, Referrer, Landing Page, UTM_Source, UTM_Medium, UTM_Campaign, UTM_Term, UTM_Content, Openstat, Google Client Id.

You can send a request in GET or POST format.

curl 'https://cloud.roistat.com/api/v1/project/calltracking/call/xls/export?project=12345' \
    --request POST \
    --header 'Content-type: application/json' \ 
    --header 'Api-key: {KEY}' \ 
    --data Request body - see below

Request Body:

{
    "period": {
        "from": "2016-07-01T00:00:00+0300",
        "to": "2016-10-31T23:59:59+0300"
    }
}

No parameters.

Query String:

Parameter Type Description Required
project string Project number yes

Request Body:

Parameter Type Description Required
period object Date period yes
from string Start date in the format 2016-07-01T00:00:00+0300 yes
to string End date in the format 2016-07-31T00:00:00+0300 yes

No parameters.

Download an audio recording of a conversation in the MP3 format

POST /project/calltracking/call/{callId}/file

Using this method, you can download an audio recording of a conversation in the MP3 format for the specified call.

You can use both GET and POST request formats.

curl 'https://cloud.roistat.com/api/v1/project/calltracking/call/1234/file?project=12345' \
    --request POST \
    --header 'Content-type: application/json' \ 
    --header 'Api-key: {KEY}'

No parameters.

Query String:

Parameter Type Description Required
project string Project number yes

Request Body:

No parameters.

No parameters.

Add a number to the script

POST /project/calltracking/phone/update

Using this method you can add a number to the script.

curl 'https://cloud.roistat.com/api/v1/project/calltracking/phone/update?project=12345' \
    --request POST \
    --header 'Content-type: application/json' \ 
    --header 'Api-key: {KEY}' \ 
    --data Request body - see below

Request Body:

{
    "id": 6,
    "script_id": 11,
    "last_use_date": "2016-10-11T21:00:00.000Z"
}
{
    "status": "success"
}

Query String:

Parameter Type Description Required
project string Project number yes

Request Body:

Parameter Type Description Required
id integer ID of phone number in Roistat yes
script_id integer Script ID yes
last_use_date string Date time of last call to phone number (format 2016-10-11T21:00:00.000Z) no
Parameter Type Description
status string

Add numbers purchased from other operators

POST /project/calltracking/phone/create

To add numbers purchased from other operators, you can use this method. It’s enough to specify your numbers in the request.

Please note that you simply connect the number to Roistat call tracking, but do not include it in any script.

curl 'https://cloud.roistat.com/api/v1/project/calltracking/phone/create?project=12345' \
    --request POST \
    --header 'Content-type: application/json' \ 
    --header 'Api-key: {KEY}' \ 
    --data Request body - see below

Request Body:

{
    "phones": [
        "74997654321"
    ]
}
{
    "data": [
        {
            "id": 5,
            "phone": "74951234567",
            "prefix": null,
            "script_id": null,
            "is_external": 1,
            "last_use_date": null,
            "call_count": 0,
            "creation_date": "2016-10-12T08:19:23+0000",
            "script": null
        }
    ],
    "total": 1,
    "status": "success"
}

Query String:

Parameter Type Description Required
project string Project number yes

Request Body:

Parameter Type Description Required
phones array[string] External numbers you want to connect, in the format 1ХХХХХХХХХХ, where X represent the digits of the city code and the phone number itself yes
Parameter Type Description
data array[object]
id integer ID of connected external phone number
phone string Phone number
prefix null
script_id null
is_external integer 1 because it is an external phone number
last_use_date null
call_count integer 0 because the call doesn't have any calls made to it
creation_date string Date and time when the number was connected to Roistat
script null
total integer
status string

Permanently disconnect numbers from Calltracking in your project

POST /project/calltracking/phone/delete

With this method you can permanently disconnect numbers from the calltracking in your project in Roistat.

curl 'https://cloud.roistat.com/api/v1/project/calltracking/phone/delete?project=12345' \
    --request POST \
    --header 'Content-type: application/json' \ 
    --header 'Api-key: {KEY}' \ 
    --data Request body - see below

Request Body:

{
    "phones": [
        4,
        5
    ]
}
{
    "status": "success"
}

Query String:

Parameter Type Description Required
project string Project number yes

Request Body:

Parameter Type Description Required
phones array[integer] phone number IDs that you want to disconnect yes
Parameter Type Description
status string

Get data about the numbers connected to your project in Roistat

POST /project/calltracking/phone/list

The method gets data about the numbers connected to your project in Roistat.

You can send a request in GET or POST format.

Only the owner of the project or a user with Read / Write rights can get numbers.

curl 'https://cloud.roistat.com/api/v1/project/calltracking/phone/list?project=12345' \
    --request POST \
    --header 'Content-type: application/json' \ 
    --header 'Api-key: {KEY}' \ 
    --data Request body - see below

Request Body:

{
    "filters": [
        [
            "is_external",
            "=",
            1
        ]
    ],
    "sort": [
        "id",
        "desc"
    ],
    "limit": 5,
    "offset": 0
}
{
    "data": [
        {
            "id": 5,
            "phone": "74991234567",
            "prefix": null,
            "script_id": null,
            "is_external": 1,
            "last_use_date": null,
            "call_count": 0,
            "creation_date": "2016-10-12T08:19:23+0000",
            "script": null
        },
        {
            "id": 4,
            "phone": "74951234567",
            "prefix": "7499",
            "script_id": null,
            "is_external": 0,
            "last_use_date": null,
            "call_count": 0,
            "creation_date": "2016-10-10T08:50:44+0000",
            "script": {
                "id": 10,
                "name": "Offline ads",
                "creation_date": "2016-08-23T10:23:37+0000",
                "is_enabled": 0,
                "call_count": 0,
                "accuracy": 100,
                "options": {
                    "calltracking_type": "static",
                    "static_source": "offline",
                    "css_selector": [
                        "#track"
                    ],
                    "phone_format": "8 (XXX) XXX-XX-XX",
                    "redirect": {
                        "type": "sip",
                        "value": "example@domain.ru",
                        "sip_trunk_postfix": null
                    },
                    "segments": null,
                    "target_call_time": 0
                },
                "integration": {
                    "is_lead_auto_create": "1",
                    "crm": {
                        "enabled": 0,
                        "custom_fields": []
                    },
                    "webhook": {
                        "url": ""
                    },
                    "google_analytics": {
                        "tracking_id": "",
                        "action": "call",
                        "category": "phone",
                        "label": "roistat"
                    }
                },
                "needed_phone_count": null
            }
        }
    ],
    "total": 2,
    "status": "success"
}

Query String:

Parameter Type Description Required
project string Project number yes

Request Body:

Parameter Type Description Required
filters array[array] no
sort array[string] no
limit integer no
offset integer no
Parameter Type Description
data array[object]
id integer Call ID in Roistat
phone string Phone number
prefix null or string null for external numbers; country code and number prefix for Roistat numbers
script_id null or string script ID to which the number is attached
is_external integer The parameter indicates whether the number is rented to Roisatt or purchased from a third-party service: 1 is an external number, 0 is a Roistat number
last_use_date null or string Date and time of the last call to the number
call_count integer Total number of calls to the number
creation_date string Date the number was connected to the call tracking project in Roistat
script null or object Data about the script to which the number is attached. A detailed description of the fields can be viewed, for example, in the response body in the project / calltracking / script / list method
>> id integer
>> name string
>> creation_date string
>> is_enabled integer
>> call_count integer
>> accuracy integer
>> options object
>>> calltracking_type string
>>> static_source null or string
>>> css_selector array
>>> phone_format string
>>> redirect object
>>>> type string
>>>> value string
>>>> sip_trunk_postfix null or string
>>> segments anyOf
>>> target_call_time integer
>> integration object
>>> is_lead_auto_create string
>>> crm object
>>>> enabled integer
>>>> custom_fields array[object]
>>>>> id string
>>>>> type string
>>>>> value string
>>> webhook object
>>>> url string
>>> google_analytics object
>>>> tracking_id string
>>>> action string
>>>> category string
>>>> label string
needed_phone_count null Number of phone numbers required for 100% accuracy of call tracking
total integer
status string

Download all the records from the call history in the Roistat project

POST /project/calltracking/call/list

Using this method, you can download all the records from the call history in the Roistat project.

If along with the call you need detailed information on the corresponding visit and order, in the request body specify " extend ": [" visit "," order "].

curl 'https://cloud.roistat.com/api/v1/project/calltracking/call/list?project=12345' \
    --request POST \
    --header 'Content-type: application/json' \ 
    --header 'Api-key: {KEY}' \ 
    --data Request body - see below

Request Body:

{
    "filters": {
        "and": [
            [
                "date",
                ">",
                "2016-05-21T21:00:00+0000"
            ],
            [
                "date",
                "<",
                "2016-05-22T21:00:00+0000"
            ]
        ]
    },
    "extend": [
        "visit"
    ],
    "sort": [
        "date",
        "desc"
    ],
    "limit": 100,
    "offset": 0
}
{
    "data": [
        {
            "id": "16769",
            "callee": "7495301234",
            "caller": "7495751234",
            "duration": 59,
            "waiting_time": 30,
            "answer_duration": 29,
            "status": "ANSWER",
            "date": "2016-06-19T09:31:01+0000",
            "link": "https://site.ru/calltracking/call/23/file/123456qwerty",
            "visit_id": null,
            "order_id": null,
            "static_source": {
                "system_name": "yamarket6",
                "display_name": "yamarket",
                "icon_url": "https://favicon.yandex.net/favicon/market.yandex.ru",
                "utm_source": null,
                "utm_medium": null,
                "utm_campaign": null,
                "utm_term": null,
                "utm_content": null,
                "openstat": null
            },
            "visit": {
                "id": 666,
                "first_id": 660,
                "date": "2016-05-25T19:31:58+0000",
                "referrer": "http://site.ru/contact.php",
                "host": "site.ru",
                "landing_page": "http://test.ru/lp",
                "agent": "Mozilla/5.0",
                "ip": "47.110.126.72",
                "google_client_id": "1818132860.1451606703",
                "source": {
                    "system_name": "direct_search_18000022_2014432344_what is",
                    "display_name": "Google Ads - adwords2 - search - whats is",
                    "icon_url": "https://favicon.yandex.net/favicon/direct.yandex.ru",
                    "utm_source": "direct",
                    "utm_medium": "cpc",
                    "utm_campaign": "campaign",
                    "utm_term": "word",
                    "utm_content": "test-message",
                    "openstat": null,
                    "referrer": "http://site.ru/contact.php"
                }
            },
            "order": {
                "id": 777,
                "url": "http://site.ru/order/777",
                "source_type": "calltracking",
                "creation_date": "2016-05-22T19:32:22+0000",
                "update_date": "2016-05-22T19:32:22+0000",
                "revenue": 2000,
                "cost": 350,
                "client_id": 150,
                "visit_id": 666,
                "page": null,
                "status": {
                    "id": 31,
                    "type": "paid",
                    "name": "Paid"
                },
                "custom_fields": {
                    "Тип лида": "Phone",
                    "Дизайнер": "Smith"
                }
            }
        },
        {
            "id": "16768",
            "callee": "7495301234",
            "caller": "7495751234",
            "duration": 47,
            "waiting_time": 15,
            "answer_duration": 32,
            "status": "ANSWER",
            "date": "2016-06-18T09:58:54+0000",
            "link": "https://site.ru/calltracking/call/22/file/123456qwerty",
            "visit_id": "4017325",
            "order_id": null,
            "static_source": null,
            "visit": null,
            "order": null
        }
    ],
    "total": 2,
    "status": "success"
}

Query String:

Parameter Type Description Required
project string Project number yes

Request Body:

Parameter Type Description Required
filters object no
and array no
extend array[string] no
sort array[string] no
limit integer no
offset integer no
Parameter Type Description
data array[object]
id string Call ID in Roistat
callee string dialed number
caller string phone number of caller
duration integer call duration (seconds)
status string 1 out of 9 call statuses: ACTIVE – the call is in progress; ANSWER – the call was accepted and processed by the employee; BUSY – there was an incoming call, but the line was busy; NOANSWER – there was an incoming call, but it was not accepted by the employee within the answer waiting time; CANCEL – there was an incoming call, but it was ended before the employee answered; CONGESTION – the call failed due to technical issues; CHANUNAVAIL – the called number was not available; DONTCALL – the incoming call was canceled; TORTURE – the incoming call was redirected to the answering machine.
date string date and time of call record creation
visit_id null or string Visit ID
order_id null or string Order ID from CRM
static_source null or object Detailed data about the marketing channel of the call. Will be displayed if static calltracking is used. Otherwise returns null.
>> system_name string marketing channel system name in Roistat
>> display_name null or string human-readable name of channel
>> icon_url null or string URL of channel thumbnail
>> utm_source null or string UTM source
>> utm_medium null or string UTM medium
>> utm_campaign null or string UTM campaign
>> utm_term null or string UTM term (keyword)
>> utm_content null or string UTM content parameter value
>> openstat null or string Openstat tracker value
comment null or string call comment
visit null or object details of the visit of the call. Will be displayed only if the request had "extend ": ["visit"] specified. Otherwise, it will be null. Read more about the visit data in the method /project/site/visit/list
order null or object details of the corresponding order. Will be displayed only if the request had "extend": ["order"] specified. Otherwise, it will be null. Read more about order data in /project/integration/order/list
link string link to the call recording in a third-party calltracking service
waiting_time integer call waiting time (seconds)
answer_duration integer call duration (seconds)
total integer
status string

Add a record about a call to the call history in your Roistat project

POST /project/phone-call

Use this method to add a record about a call to the call history in your Roistat project.

curl 'https://cloud.roistat.com/api/v1/project/phone-call?project=12345' \
    --request POST \
    --header 'Content-type: application/json' \ 
    --header 'Api-key: {KEY}' \ 
    --data Request body - see below

Request Body:

{
    "callee": "79999999999",
    "caller": "78888888888",
    "date": "2016-07-26T11:03:57+0000",
    "duration": 20,
    "marker": "ym_1_2",
    "order_id": null,
    "save_to_crm": "0",
    "status": "ANSWER",
    "visit_id": "12345",
    "comment": "Call tomorrow",
    "answer_duration": 15
}
{
    "phoneCall": {
        "id": "5",
        "callee": "79999999999",
        "caller": "78888888888",
        "visit_id": "12345",
        "marker": "ym_1_2",
        "order_id": null,
        "duration": 20,
        "status": "ANSWER",
        "google_client_id": null,
        "date": "2016-07-26T11:03:57+0000",
        "comment": "Call tomorrow",
        "answer_duration": 15
    },
    "status": "success"
}

Query String:

Parameter Type Description Required
project string Project number yes

Request Body:

Parameter Type Description Required
name string Human-readable script name yes
callee string Dialed number yes
caller string Client's number yes
date string Date and time the call record was created (in UTC0 format) yes
duration number Call duration (in seconds) no
marker null или string Advertising channel marker no
order_id null или string Order number from CRM no
save_to_crm string Saving a lead in CRM: 0 - don't save, 1 - save. no
status string 1 out of 9 call statuses: ACTIVE – the call is in progress; ANSWER – the call was accepted and processed by the employee; BUSY – there was an incoming call, but the line was busy; NOANSWER – there was an incoming call, but it was not accepted by the employee within the answer waiting time; CANCEL – there was an incoming call, but it was ended before the employee answered; CONGESTION – the call failed due to technical issues; CHANUNAVAIL – the called number was not available; DONTCALL – the incoming call was canceled; TORTURE – the incoming call was redirected to the answering machine. no
visit_id null или string Visit number no
comment string Comment text no
answer_duration number Talk duration no
Parameter Type Description
data array[object]
id string Call ID in Roistat
callee string Dialed number
caller string Client's number
duration integer Call duration (in seconds)
status string 1 out of 9 call statuses: ACTIVE – the call is in progress; ANSWER – the call was accepted and processed by the employee; BUSY – there was an incoming call, but the line was busy; NOANSWER – there was an incoming call, but it was not accepted by the employee within the answer waiting time; CANCEL – there was an incoming call, but it was ended before the employee answered; CONGESTION – the call failed due to technical issues; CHANUNAVAIL – the called number was not available; DONTCALL – the incoming call was canceled; TORTURE – the incoming call was redirected to the answering machine.
date string Date and time the call record was created (in UTC0 format)
visit_id null или string Visit number
order_id null или string Order number from CRM
static_source null или object Details of the advertising channel for the call. They will be displayed only for static call tracking. Otherwise null will be displayed.
>> system_name string Channel system name in Roistat
>> display_name null или string Human-readable channel name
>> icon_url null или string Channel icon link
>> utm_source null или string Transition source (from UTM)
>> utm_medium null или string Traffic type (from UTM)
>> utm_campaign null или string Ad campaign name (from UTM)
>> utm_term null или string Key phrase (from UTM)
>> utm_content null или string Additional information on the ad (from UTM)
>> openstat null или string Openstat tag value
comment null или string Call comment
visit null или object Call visit details. Will only be displayed if "extend": ["visit"] was specified in the request. Otherwise it will be null. Read more about visit data in the /project/site/visit/list method
order null или object Details of the respective order. Will only be displayed if "extend": ["order"] was specified in the request. Otherwise it will be null. Read more about order data in the /project/integration/order/list method
link string Link to the audio recording of the conversation in another call tracking service
waiting_time integer Waiting time (in seconds)
answer_duration integer Talk duration (in seconds)
tags null или object Tags attached to the call
total integer
status string