Skip to content

Update campaigns

Updating advertising campaigns

Method update.campaigns
Description Updating an advertising campaign.
You can only update 'basic' advertising campaigns.
Who has access Agent, Customer
You can update campaigns partially. If you're updating a data bulk, it will replace an existing one.
In system advertising campaigns (with id = -1) as well as in integrated campaigns you can only update the fields site_blocks and dynamic_call_tracking

Parameters 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 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"
id number yes Unique ID of an advertising campaign
name string no Name of an advertising campaign
description string no Maximum 255 symbol Description of an advertising campaign
status enum no
  • active
  • inactive
Status of an advertising campaign
If a campaign with set blocks has been marked as "inactive", all the blocks' settings will be reset.
site_id number yes Unique ID of a website
You can not update site_id for exsisting advertising campaign.
campaign_conditions object no Conditions of an advertising campaign.
Settings to bind a number to a site block
site_blocks array no Settings to bind a number to a site block
If there is no set block in a list, it will be reset when you update an advertising campaign.
If a campaign is inactive (status = inactive), you can not change this parameter. The error `invalid_parameters_combination` will return.
site_block_id number yes Unique ID of a site block
phone_number_id number yes Unique Id of a virtual number. To receive a list of availibale virtual numbers, you need to use the method get.campaign_available_phone_numbers
If an id does not return via the method get.campaign_available_phone_numbers, an error with mnemonics "entity_not_found" will return.
Number with type = call_tracking can only be used in a single advertising campaign. If the number is already in use in another campaign, the error `already_in_use` will return.
redirection_phone_number_id number no Unique ID of a redirection number. A redirection number is used only if the parameter phone_number_id has value `call_tracking`. You can access a list of available numbers via the method get.campaign_available_redirection_phone_numbers.
Must be filled in 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 contain only redirection numbers that return 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 active. If a parameter is filled and, and you don't have the component "va", an error with mnemonics "parameter_component_disabled" will return
dynamic_call_tracking_enabled boolean no true, false Enabling dynamic call tracking. You can only add vacant numbers, without a flag "used in hosted PBX", into your 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 purchased automatically. 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.
cost_ratio number minimum value 1 Ratio that influence `costs`
cost_ratio_operator enum
  • wo_changes
  • multiply
  • divide
Operator is ised in the paramatr `costs` with `cost_ratio`
Dynamic call tracking
dynamic_call_tracking object no Dynamic call tracking.
Must be filled in if the parameter dynamic_call_tracking_enabled of at least one block has value "true". Otherwuse 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.
reservation_time enum no
  • 5m
  • 10m
  • 15m
  • 20m
  • 30m
  • 1h
  • 2h
  • 4h
  • 8h
  • 1d
  • 1w
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 1 Number of visits from the campaign per day
Group conditions settings
group_conditions array yes Maximum number of groups is 30 Group of advertising campaign conditions
Setting conditions
conditions array yes Maximum number of conditions for a group is 50 Advertising campaign conditions in a group of conditions
type enum yes
  • include
  • exclude
Advertising campaign conditions in a group of conditions
  • include - includes
  • exclude - excludes
campaign_parameter enum yes For a list of valid values and their operators refer to the tab "List of parameters and their operators"
value string yes Value. Some campaign_parameter can have their own list of acceptable 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

JSON request structure

{
  "jsonrpc": "2.0",
  "id": "number",
  "method": "update.campaigns",
  "params": {
    "access_token": "string",
    "user_id": "number",
    "description": "string",
    "name": "string",
    "status": "enum",
    "cost_ratio": "number",
    "cost_ratio_operator": "enum",
    "id": "number",
    "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": {

    },
    "metadata": {

    }
  }
}

List of returning errors

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