Method create.campaigns
Description Creating an advertising campaign.
You can only create an advertising campaign with the 'basic' type.
Available to Agent, Client
The available number of advertising campaigns is regulated at the tariff plan level

Request parameters

Name Type Required Valid values Description
access_token string yes Authentication session key
user_id number no Unique user identifier of the client agent on behalf of which the request is made
Is required for the agent
To obtain a list of client users, you must use the method "get.customer_users"
name string yes Advertising campaign name
description string no Maximum 255 characters Advertising campaign description
status enum no
  • active
  • inactive
Advertising campaign status
site_id number yes Unique site identifier
campaign_conditions object no Advertising campaign conditions.
Settings for linking a number to a block on the site
site_blocks array no Settings for linking a number to a block on the website
If site number blocks are not specified, then they are not configured, i.e. are considered not configured
If site_blocks is specified at the same time as status = inactive, then the error `invalid_parameters_combination` will be returned
site_block_id number yes Unique number block identifier
phone_number_id number yes Unique identifier of the virtual number. To get a list of available virtual numbers you must use the get.campaign_available_phone_numbers method
If id is specified and is not returned by get.campaign_available_phone_numbers, then an error with the mnemonic "entity_not_found" will be returned.
A number with type = call_tracking can only be used in one advertising campaign. If the number is already used in another advertising campaign, the error `already_in_use` will be returned
redirection_phone_number_id number no Unique identifier of the forwarding number. The forwarding number is only used if the phone_number_id parameter is of type `call_tracking`. The list of available numbers can be obtained using the get.campaign_available_redirection_phone_numbers method.
Required if the phone_number_id parameter specifies a virtual number with the "call_tracking" type. If this is not the case, an error with the mnemonic "required_parameter_missed" will be returned.
If the parameter is specified and a virtual number with type "va" is specified in phone_number_id, then the error `invalid_parameters_combination` will be returned
The parameter can only contain redirection numbers, which are returned by the get.campaign_available_redirection_phone_numbers method. If this is not the case, then an error will be returned with the mnemonic "invalid_parameter_value"
Available if the "va" component is connected. If the parameter is filled in and you do not have the "va" component, an error will be returned with the mnemonic "parameter_component_disabled"
dynamic_call_tracking_enabled boolean no true, false Activation of dynamic call tracking. Only free numbers without the “Use in VATS” flag can be connected to the dynamic call tracking pool in the same code as the default ad campaign block number. If the required number of numbers is not available, they will be automatically purchased. Calls to numbers from the dynamic call tracking pool will be processed according to the rules for processing calls to the number of the advertising campaign block by default.
Can be "true" if the parameter is phone_number_id = va | call_tracking. If this is not the case, an error will be returned with the mnemonic "invalid_parameters_combination"
If you use this parameter, but you do not have the "dynamic_call_tracking" component connected, then you will be returned error with mnemonic "parameter_component_disabled"
If status = inactive is specified at the same time, the error `invalid_parameters_combination` will be returned
If the dynamic_call_tracking_enabled parameter has the value "true", then the dynamic_call_tracking parameter is required. The error "invalid_parameters_combination" will be returned.
Dynamic call tracking
dynamic_call_tracking object no Setting up dynamic call tracking.
Required if the dynamic_call_tracking_enabled parameter for at least one block has the value "true", otherwise an error will be returned with the mnemonic "invalid_parameters_combination"
If you use this parameter, but you do not have the "dynamic_call_tracking" component connected, then you will be returned error with mnemonic "parameter_component_disabled"
reservation_time enum no
  • 5m
  • 10m
  • 15m
  • 20m
  • 30m
  • 1h
  • 2h
  • 4h
  • 8h
  • 1d
  • 1w
The default value is "15m".
The period for which the number is assigned to the site visitor. After the specified time has passed, the number is assigned to the new visitor (or remains with the current one if call tracking numbers are available).
count_virtual_numbers number yes minimum value 1 The number of numbers required for dynamic call tracking to work in one block. The specified number of numbers will be purchased.
count_visits number yes minimum value 1 Number of visits per advertising campaign per day
Condition group settings
group_conditions array yes Maximum number of groups 30 Advertising campaign conditions group
Condition settings
conditions array yes Maximum number of conditions for a group is 50 Advertising campaign conditions in the conditions group
type enum yes
  • include
  • exclude
Advertising campaign conditions in the conditions group
  • include - includes
  • exclude - excludes
campaign_parameter enum yes For a list of valid values and possible operators, see the table "List of parameters and their operators"
value string yes Meaning. For some campaign_parameter there may be a list of valid values, see table "List of parameters and their operators"
operator enum yes =, sub, ~ The operator is in condition. Depends on the parameter used campaign_parameter see table "List of parameters and their operators"
  • "=" - matches exactly
  • "sub" - includes
  • "~" - regular expression

Response parameters

Title Type Required Description
id number yes Unique identifier of the advertising campaign

JSON request structure```json

{ "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 response structure```json
{
  "jsonrpc": "2.0",
  "id": "number",
  "result": {
    "data": {
      "id": "number"
    },
    "metadata": {

    }
  }
}

List of returned errors

See the section "List of errors for methods with the create verb"