Skip to content

Get campaigns

Getting a list of advertising campaigns

Method get.campaigns
Description Getting a list of all the advertising campaigns - integrated, basic and system
Who gets Agent, Customer

Parameters of a request

Title Type Required Description
access_token string yes Authentication session key
user_id number no Unique user ID of a customer or an agent that makes a request.
Is mandatory for agent
To get a list of a customer's users you need to use the method "get.customer_users"
limit number no Number of returning entries . Refer to "Page-oriented output"
offset number no Offset, that defines: entries from which number to return, "limit" of entries. Default value is "0". Refer to "Page-oriented output"
filter object no Refer to "Filtering criteria"
fields array no Refer to "Providing returning data"
sort array no Refer to "Data sorting"

Parameters of a reply

Title Type Valid value Filtering Sorting Description
id number yes Unique ID of a campaign
name string yes yes Name of a campaign
description string 255 symbols max Description of a campaign
status enum
  • active
  • inactive
yes Status of a campaign
creation_time iso8601 YYYY-MM-DD hh:mm:ss yes yes Date and time of a campaign's implementation
campaign_conditions object no Conditions of a campaign.
Is absent if the field type = integrated | system
engine enum
  • yandex.direct
  • google.adwords
yes yes Engine for integrated campaigns
type enum
  • basic
  • system
  • integrated
yes yes Types of campaigns.
  • system - system advertising campaign "Users without advertising campaigns". Can't be deleted
  • integrated - integrated advertising campaign. Can't be deleted
  • basic - basic advertising campaign, created in CallGear
costs number yes yes Advertising campaign costs
cost_ratio number minimum value 1 Default value is 1. Coefficient, that influences the parameter `costs`
cost_ratio_operator enum
  • wo_changes
  • multiply
  • divide
Default value is `wo_changes`. Operator, that is used to calculate `costs` with consideration to `cost_ratio`
Website
site_id number yes yes Website unique ID
site_domain_name string yes Website's internet address. Without protocol - "http://" or "https://"
Settings to associate a number to a website's block
site_blocks array yes Settings to associate a number to a website's block
site_block_id number Unique ID of a block of numbers
site_block_name string Name of a block of numbers
phone_number_type enum
  • user
  • va
  • call_tracking
Virtual number type (refer to the method get.campaign_available_phone_numbers) for the parameter phone_number_id:
  • user - user
  • va - Hosted PBX number
  • call_tracking - Analytics number
phone_number_id number Unique ID of a virtual number depending on the parameter phone_number_type. To get a list of available virtual numbers, you need to use the method get.campaign_available_phone_numbers
phone_number string Number that complies with the parameter phone_number_id
redirection_phone_number_id number Redirection number, that is used in case a number's type from the parameter phone_number_id has value call_tracking. To get a list of available redirection numbers you need to use the method get.campaign_available_redirection_phone_numbers
redirection_phone_number string Number that complies with the parameter redirection_phone_number_id
dynamic_call_tracking_enabled boolean true, false Dynamic call tracking.
Can have value "true" if the parameter phone_number_type = va | call_tracking
Dynamic call tracking
dynamic_call_tracking object yes Dynamic call tracking settings.
By default, calls from numbers, that are included in the dynamic call tracking pool, will be treated as according to the rules of processing calls to an advertising campaign block number.
reservation_time enum
  • 5m
  • 10m
  • 15m
  • 20m
  • 30m
  • 1h
  • 2h
  • 4h
  • 8h
  • 1d
  • 1w
Default value is "15m".
Time period, for which a number will be appointed to a website visitor. As the time is up, the number gets appointed to another visitor (or, if there are some vacant call tracking numbers left, it stays the same.
count_virtual_numbers number minimum value 1 Quantity of numbers required for call tracking to work in a block. The numbers will be purchased.
count_visits number minimum value 1 Number of visits from a campaign per day
coverage_visitors number Percentage of website visitors, that will see a dynamic call tracking number
Group conditions settings
group_conditions array Group conditions of an advertising campaign
Conditions settings
conditions array Advertising campaign conditions in a group of conditions
type enum
  • include
  • exclude
Advertising campaign conditions in a group of conditions
campaign_parameter enum For List of acceptable values and operators refer to the tab "List of parameters and their operators"
value string Value for campaign_parameter.
Some campaign_parameter can have their own list of acceptable values. Refer to the tab "List of parameters and their operators"
operator enum =, sub, ~ Operator if
  • "=" - closely matches
  • "sub" - includes
  • "~" - regular expression

JSON request structure

{
  "jsonrpc":"2.0",
  "id":"number",
  "method":"get.campaigns",
  "params":{
    "access_token":"string",
    "user_id":"number",
    "offset":"number",
    "limit":"number",
    "filter":{

    },
    "sort":[
      {
        "field":"string",
        "order":"string"
      }
    ],
    "fields":[
      "string"
    ]
  }
}

JSON reply structure

{
  "jsonrpc": "2.0",
  "id": "number",
  "result": {
    "metadata": {

    },
    "data": [
      {
        "id": "number",
        "status": "enum",
        "creation_time": "iso8601",
        "description": "string",
        "site_id": "number",
        "site_domain_name": "string",
        "costs": "number",
        "cost_ratio": "number",
        "cost_ratio_operator": "enum",
        "engine": "enum",
        "type": "enum",
        "name": "string",
        "site_blocks": [
          {
            "site_block_id": "number",
            "site_block_name": "string",
            "phone_number_type": "enum",
            "phone_number_id": "number",
            "phone_number": "string",
            "redirection_phone_number_id": "number",
            "redirection_phone_number": "string",
            "dynamic_call_tracking_enabled": "boolean"
          }
        ],
        "dynamic_call_tracking": {
          "reservation_time": "enum",
          "count_virtual_numbers": "number",
          "count_visits": "number"
        },
        "campaign_conditions": {
          "group_conditions": [
            {
              "conditions": [
                {
                  "type": "enum",
                  "campaign_parameter": "enum",
                  "operator": "enum",
                  "value": "string"
                }
              ]
            }
          ]
        }
      }
    ]
  }
}

List of returning errors

Refer to "List of errors for methods with the verb get"