Create auto rule
create_auto_ruleCreate an auto rule: conditions over campaign metrics for a time window, checked every run_every_minutes, firing an action. Campaign-level actions: pause_traffic, resume_traffic, increase_bid, decrease_bid, notify. Placement-level actions (evaluated per source_id): block_zone, whitelist_zone, unblock_zone, increase_zone_bid, decrease_zone_bid. Bid actions need action_params.bid_step and an API (or DSP) campaign. campaign_ids attaches it right away — a rule only runs on attached campaigns.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| tags | No | ||
| action | Yes | ||
| status | No | ||
| ranking | No | Placement actions only: act on just the worst / best N placements that pass the conditions, e.g. {"metric":"cpa","direction":"worst","limit":5,"min_clicks":100} = the 5 worst-CPA placements with at least 100 clicks. For cpa/cpc/cpm/cost lower is better (a placement that spent without converting is the worst CPA); for the rest higher is better. null = every matching placement. | |
| group_id | No | ||
| schedule | No | When the scheduler may run the rule, in the workspace timezone: days = ISO weekdays 1 (Mon)…7 (Sun), empty = every day; windows = [{from:"HH:MM", to:"HH:MM"}], empty = whole day; a window with to <= from runs over midnight. null = always. | |
| conditions | Yes | All conditions must hold (AND) | |
| campaign_ids | No | Campaigns to attach on create | |
| action_params | No | Parameters the action needs. Bid actions (increase_bid / decrease_bid / increase_zone_bid / decrease_zone_bid): bid_step (>0, required), bid_step_unit (amount|percent), bid_limit (ceiling for an increase, floor for a decrease). Placement list actions (block_zone / whitelist_zone / unblock_zone): site_list_id — the list to write into, default the campaign's own. switch_rotation: flow_scheme_id (required) — the flow scheme copied over the campaign's flows, applied once per scheme. Keys the action does not use are dropped. | |
| time_interval | Yes | Metrics window | |
| run_every_minutes | Yes | ||
| on_success_pause_rule | No | Pause the rule after it fires | |
| on_success_pause_campaign | No | Pause the campaign after it fires |