Zernio
APIFor you
Zernio
APIFor you
API Reference

Automated Rules

Rules

List ad rulesGETCreate an ad rulePOSTGet an ad ruleGETUpdate an ad rulePATCHDelete an ad ruleDELETE

Preview and History

Preview an ad rulePOSTList an ad rule's runsGET
Dashboard
OverviewPlatformsAPI ReferenceResources
Automated Rules

Update an ad rule

Changes any field of a rule except its connection and ad account. Send campaignIds: null to check the whole ad account again. Changing the schedule, or enabling a disabled rule, moves the next run; re-sending enabled: true on an enabled rule does not.


PlatformsMetaGoogleTikTokLinkedInPinterestX
PATCH
/v1/ads/rules/{ruleId}

Authorization

bearerAuth
AuthorizationBearer <token>

API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.

In: header

Path Parameters

ruleId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.adrules.updateAdRule({  body: {    name: 'Example',    level: 'campaign',    campaignIds: {},  },});console.log(data);
{  "rule": {    "id": "string",    "name": "string",    "accountId": "string",    "platform": "string",    "adAccountId": "string",    "level": "campaign",    "campaignIds": [      "string"    ],    "conditions": {      "all": [        {          "metric": "spend",          "window": "today",          "op": ">",          "value": 0        }      ]    },    "actions": [      {        "type": "notify"      }    ],    "schedule": {      "everyMinutes": 60    },    "cooldownMinutes": 0,    "enabled": true,    "lastRunAt": "2019-08-24T14:15:22Z",    "nextRunAt": "2019-08-24T14:15:22Z",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  }}
Was this page helpful?

Get an ad rule

Returns one ad rule.

Delete an ad rule

Deletes a rule and its run history. Changes the rule already made on the platform stay.

name?string
Length1 <= length <= 200
level?AdRuleLevel

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

Value in

  • "campaign"
  • "adset"
campaignIds?array<string>|
Items1 <= items <= 100
conditions?

Every condition must hold for an object to match. A rate with no denominator (a CPA with no conversions) never matches.

actions?array<|||>

Each type at most once, and at most one of pause, activate and adjust_budget.

Items1 <= items
schedule?
cooldownMinutes?integer
Range0 <= value <= 43200
enabled?boolean