Ad Rules

Create an ad rule

Changed on

Creates a rule that checks the campaigns or ad sets of one ad account on a schedule and acts on each one that meets every condition.

Rules support Meta, Google, TikTok, LinkedIn, Pinterest, X and Reddit ads connections. Use POST /v1/ads/rules/{ruleId}/preview to see what a rule would match before enabling it.

Evaluation

Each campaign or ad set is evaluated on its own, over the ad account's calendar days, from the metrics Zernio syncs.

Actions

A rule can notify (the ad_rule.triggered webhook), and take at most one of:

  • pause
  • activate
  • adjust_budget

Cooldown

After acting on an object, the rule leaves that object alone for cooldownMinutes. A rule that pauses, activates or adjusts budgets needs a cooldown at least as long as its schedule.

How activate works

activate only reactivates objects a rule paused, never ones you paused yourself, and only once the cooldown has passed since that pause.

If you reactivate and pause such an object yourself between two runs of a rule, Zernio cannot tell your pause from the rule's, and an activate rule may reactivate it.

post/v1/ads/rules

Request

  • Base URL
    https://zernio.com/api
  • URL
    https://zernio.com/api/v1/ads/rules
  • Auth
    HTTP bearer

Request body

namestring required
accountIdstring required

The ads connection (account ID from GET /v1/accounts).

adAccountIdstring required

Platform ad account ID, from GET /v1/ads/accounts.

level'campaign' | 'adset' | 'ad' required

Whether the rule checks campaigns, ad sets or single ads. Each one is evaluated on its own.

campaignIdsstring[]

Only check these platform campaign IDs (or their ad sets). Leave out to check the whole ad account.

cooldownMinutesinteger

How long the rule leaves an object alone after acting on it.

enabledboolean

Response

Rule created

Changes

    • breaking

      removed the enum value clicks of the request property ///

    • breaking

      removed the enum value conversions of the request property ///

    • breaking

      removed the enum value cpa of the request property ///

    • breaking

      removed the enum value cpc of the request property ///

    • breaking

      removed the enum value cpm of the request property ///

    • breaking

      removed the enum value ctr of the request property ///

    • breaking

      removed the enum value frequency of the request property ///

    • breaking

      removed the enum value impressions of the request property ///

    • breaking

      removed the enum value reach of the request property ///

    • breaking

      removed the enum value roas of the request property ///

    • breaking

      removed the enum value spend of the request property ///

    • info

      added subschema #1 subschema #2 to the /// request property anyOf list

    • info

      added subschema #1 subschema #2 to the //// response property anyOf list for the response status

    • info

      removed the clicks enum value from the //// response property for the response status

    • info

      removed the conversions enum value from the //// response property for the response status

    • info

      removed the cpa enum value from the //// response property for the response status

    • info

      removed the cpc enum value from the //// response property for the response status

    • info

      removed the cpm enum value from the //// response property for the response status

    • info

      removed the ctr enum value from the //// response property for the response status

    • info

      removed the frequency enum value from the //// response property for the response status

    • info

      removed the impressions enum value from the //// response property for the response status

    • info

      removed the reach enum value from the //// response property for the response status

    • info

      removed the roas enum value from the //// response property for the response status

    • info

      removed the spend enum value from the //// response property for the response status

    • breaking

      removed subschema #2 subschema #3 subschema #4 from the / request property oneOf list

    • breaking

      added subschema #2 subschema #3 subschema #4 to the // response property oneOf list for the response status

    • warning

      added the new ad enum value to the / response property for the response status

    • warning

      added the new frequency enum value to the //// response property for the response status

    • warning

      added the new reach enum value to the //// response property for the response status

    • info

      added the new ad enum value to the request property

    • info

      added the new frequency enum value to the request property ///

    • info

      added the new reach enum value to the request property ///

    • info

      added subschema #2 subschema #3 subschema #4 to the / request property oneOf list

    • info

      removed subschema #2 subschema #3 subschema #4 from the // response property oneOf list for the response status