Skip to main content

Guardrails

📄️Get Ad Health Product

Returns one product's ad health: every field of the list row, plus whether it is exempt from guardrails (`exempt`, `exempt_reason`), a per-account breakdown (`accounts`: the raw evaluation `inputs`, including `on_hand_cover_days`, the days the stock on hand lasts with no inbound (for a bundle, its scarcest component at that component's own demand), where each input came from, and the effective guardrail policy mode with the policies that supplied it), its guardrail `signal_history`, its ad `change_history`, and a `timeline` of daily stock, projected stock (available minus forecast plus inbound as it lands), forecast, spend and POAS from 30 days back to 60 days ahead, with the pause/resume thresholds in days and units and inbound purchase order markers.

📄️List Guardrail Policies

Lists every guardrail policy: the tenant default first, then by scope type and ID. A policy sets the guardrail thresholds and automation `mode` (`off`, `monitor`, `suggest`, `auto`) for a scope: `tenant`, `platform` (scope_id is a platform value), `ad_account`, `campaign`, `brand` or `product` (scope_id is that record's ID). For a given product and account, the more specific policies override the less specific ones field by field. Each row includes `affected_products`, the number of evaluated products the policy's scope covers. Not paginated.

📄️Resolve Guardrail Policy

Returns the effective guardrail policy for a context (any combination of product, ad account and campaign; none gives the tenant-level result), with the source of every field. `policy` is the fully merged policy; `sources` maps each setting path (e.g. `low_cover.pause_cover_days`, `mode`, `event_freezes`) to the policy that supplied it (`scope_type`, `policy_id`, `policy_name`; `scope_type: default` and null IDs for built-in defaults); `policy_ids` lists every contributing policy, least specific first; `most_specific_policy_id` is the last of them.

📄️Run Guardrail Policy Dry Run

Queues a dry run of the policy: a background replay of the last 7 days that works out which changes the policy would have proposed, without sending anything to an ad platform. Returns immediately with `tracked_job_log_id`, the ID of the background job, which reports progress and a summary (changes proposed, products processed, estimated spend saved, accounts processed, signals). When it finishes, the results are stored on the policy as `last_dry_run_at` / `last_dry_run_results`; a dry run in the last 7 days is required before the policy can be switched to `auto`.