Skip to content

Updates an advertising campaign. Only campaigns of type basic can be fully edited.

Method update.campaigns
Description Updates an advertising campaign. Only campaigns of type basic can be fully edited.
Who has access Agents and clients

Partial updates are supported. When an array is included in an update, the supplied array replaces the existing array in full.

For system campaigns (id = -1) and integrated campaigns, only site_blocks and dynamic_call_tracking can be updated.

Request parameters

Name Type Required Valid values Description
access_token string yes Session key used to authenticate the request
user_id number no Unique ID of the client user on whose behalf the request is made. Required when an agent makes the request. To retrieve a list of client users, call get.customer_users.
id number yes Unique advertising campaign ID
name string no Advertising campaign name
description string no Up to 255 characters Advertising campaign description
status enum no
  • active
  • inactive
Advertising campaign status. Setting a campaign with configured blocks to inactive clears all site block settings.
site_id number yes Unique site ID. Cannot be changed after the campaign is created.
campaign_conditions object no Campaign matching conditions
Site block number assignment
site_blocks array no Associates virtual numbers with site blocks. When provided, the supplied array replaces the existing block configuration. This parameter cannot be changed while the campaign is inactive; otherwise, invalid_parameters_combination is returned.
site_block_id number yes Unique site block ID
phone_number_id number yes Unique ID of the virtual number assigned to the site block. Retrieve available numbers with get.campaign_available_phone_numbers. If the ID is not returned by that method, entity_not_found is returned. A call_tracking number can be assigned to only one advertising campaign; if it is already assigned, already_in_use is returned.
redirection_phone_number_id number no Unique ID of the forwarding number. Used only when phone_number_id refers to a call_tracking number. Retrieve available forwarding numbers with get.campaign_available_redirection_phone_numbers. This parameter is required for call_tracking numbers; otherwise, required_parameter_missed is returned. It must not be provided for va numbers; otherwise, invalid_parameters_combination is returned. Only IDs returned by get.campaign_available_redirection_phone_numbers are accepted; otherwise, invalid_parameter_value is returned. The va component is required; if it is not enabled, parameter_component_disabled is returned.
dynamic_call_tracking_enabled boolean no true, false Enables dynamic call tracking for the site block. Only available numbers without the "Use in Virtual PBX" flag and with the same area code as the block's default campaign number can be added to the pool. If too few numbers are available, additional numbers are purchased automatically. Calls to pool numbers follow the call-handling rules of the block's default campaign number. Can be true only for va or call_tracking numbers. Requires the dynamic_call_tracking component, cannot be used when status is inactive, and requires dynamic_call_tracking when enabled for any block.
cost_ratio number no Minimum: 1 Coefficient applied to costs
cost_ratio_operator enum no wo_changes
multiply
divide
Operation used to apply cost_ratio when calculating costs
Dynamic call tracking
dynamic_call_tracking object no Dynamic call tracking settings. Required when dynamic_call_tracking_enabled is true for any site block. Requires the dynamic_call_tracking component.
reservation_time enum no
  • 5m
  • 10m
  • 15m
  • 20m
  • 30m
  • 1h
  • 2h
  • 4h
  • 8h
  • 1d
  • 1w
How long a number remains assigned to a visitor. After this period, the number may be assigned to another visitor, or remain assigned if sufficient call tracking numbers are available.
count_virtual_numbers number yes Minimum: 1 Number of virtual numbers required for dynamic call tracking in each site block. If necessary, the specified number of numbers is purchased.
count_visits number yes Minimum: 1 Estimated number of visits to the advertising campaign per day
Condition groups
group_conditions array yes Maximum number of groups 30 Groups of campaign matching conditions
Conditions
conditions array yes Maximum number of conditions for a group is 50 Conditions in the group
type enum yes
  • include
  • exclude
Condition behavior: include matches visits that satisfy the condition; exclude excludes them
campaign_parameter enum yes Campaign parameter evaluated by the condition. See "Campaign parameters and operators".
value string yes Value to compare against. Some campaign parameters accept predefined values; see "Campaign parameters and operators".
operator enum yes =, sub, ~ Comparison operator. Supported values depend on campaign_parameter: = for exact matches, sub for substring matches, and ~ for regular expressions.

Example request

{
    "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"
                        }
                    ]
                }
            ]
        }
    }
}

Example response

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

List of returned errors

See the "List of errors for update methods" section.