Skip to content

Create campaigns

Creating campaigns

Method create.campaigns
Description Creating advertising campaigns.
Allows creating 'basic' campaigns only.
Who has access Agent, Customer
You can manage the number of campaigns available to you depending on your service plan

Parameter of a request

Title Type Required Valid value Description
access_token string yes Authentication session key
user_id number no Unique user ID of a customer or an agent who makes request.
Is required for an agent.
To a get a list of customer users you need to use the method "get.customer_users"
name string yes Campaign name
description string no Maximum 255 symbols Descriprion of advertising campaign
status enum no
  • active
  • inactive
Status of advertising campaign
site_id number yes Unique ID of a website
campaign_conditions object no Conditions of advertising campaign
Settings to connect a number to a website's block
site_blocks array no Settings to connect a number to a website's block
If blocks of numbers on a website are not indicated, they are can't be set, i.e. are not considered set
If site_blocks is given alongside with status = inactive, the error `invalid_parameters_combination` will be returned
site_block_id number yes Unique block of numbers ID
phone_number_id number yes Unique ID of a virtual number. To get a list of available virtual numbers, you need to use the method get.campaign_available_phone_numbers
If an id is not returned via the get.campaign_available_phone_numbers method, an error with mnemonics "entity_not_found" will be returned.
Number with type = call_tracking can only be used in a single advertising campaign. If a number is already in use in a campaign, the error `already_in_use` will return.
redirection_phone_number_id number no Unique ID of a derirection number. A derirection number can only be used in case the parameter phone_number_id has type `call_tracking`. You can get a list of available numbers by using the method get.campaign_available_redirection_phone_numbers.
Is required if the parameter phone_number_id has virtual number with the type "call_tracking". If it's not the case, an error with mnemonics "required_parameter_missed" will return.
If the parameter is given, and phone_number_id has a virtual number with the type "va", the error `invalid_parameters_combination` will return.
A parameter can have only redirection numbers returned via the method get.campaign_available_redirection_phone_numbers. If it's not the case, an error with mnemonics "invalid_parameter_value" will return
Is availiable if the component "va" is activated. If the parameter is filled and you don't have the component "va", an error with mnemonics "parameter_component_disabled" returns
dynamic_call_tracking_enabled boolean no true, false Dynamic call tracking enabled. You can only add vacant numbers without the flag "Use in hosted PBX" to the dynamic call tracking pool. By default, you can do this in the same code as a campaign's block number. If you don't have enough numbers, they will be automatically purchased. By default, calls to numbers from the dynamic call tracking pool will be processed according to the rules of processing the calls to a block number of an advertising campaign.
Can have value "true", if the parameter phone_number_id = va | call_tracking. If it's not the case, an error with mnemonics "invalid_parameters_combination"
will return
If you use this parameter, but you don't have the component dynamic_call_tracking", an error with mnemonics "parameter_component_disabled" will return
If at the same time the parameter status = inactive is given, the error `invalid_parameters_combination` will return
If the parameter dynamic_call_tracking_enabled has value "true", the parameter dynamic_call_tracking must be filled in. Otherwise th error "invalid_parameters_combination" will return.
Dynamic call tracking
dynamic_call_tracking object no Setting dynamic call tracking.
Must be filled in, if the parameter dynamic_call_tracking_enabled in one block at least has value "true". Otherwise an error with mnemonics "invalid_parameters_combination" will return
If you use this parameter but don't have the component "dynamic_call_tracking", an error with mnemonics "parameter_component_disabled" will return
reservation_time enum no
  • 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 yes minimum value 1 Quantity of numbers required for call tracking to work in a block. The numbers will be purchased.
count_visits number yes minimum value is 1 A number of visits from a campaign per day
Setting group conditions
group_conditions array yes Maximum number of groups is 30 Group of campaign's conditions
Conditions settings
conditions array yes Maximum number of conditions per group is 50 Advertising campaign's conditions in a group of conditions
type enum yes
  • include
  • exclude
Advertising campaign's conditions in a group of conditions
  • include - includes
  • exclude - excludes
campaign_parameter enum yes For a list of valid values and possible operators refer to a tab "List of parameters and their operators"
value string yes Value. Some of campaign_parameter may have their own list of valid values. Refer to the tab "List of parameters and their operators"
operator enum yes =, sub, ~ Operator in a condition. Depends on the current parameter campaign_parameter. Refer to "List of parameters and their operators"
  • "=" - closely matches
  • "sub" - includes
  • "~" - regular expression

Parameters of a reply

Title Type Required Description
id number yes Unique ID of an advertising campaign

JSON request structure

{
  "jsonrpc": "2.0",
  "id": "number",
  "method": "create.campaigns",
  "params": {
    "access_token": "string",
    "user_id": "number",
    "description": "string",
    "name": "string",
    "status": "enum",
    "site_id": "number",
    "site_blocks": [
      {
        "site_block_id": "number",
        "phone_number_id": "number",
        "redirection_phone_number_id": "number",
        "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"
            }
          ]
        }
      ]
    }
  }
}

JSON reply structure

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

    }
  }
}

List of returning errors

Refer to the section "List of errors for the methods with the verb create"