Ads · Ad Rules

List ready-made ad rules

Returns ready-made ad rules.

GEThttps://api.pozy.ai/v1/ads/rules/templates
Facebook and Instagram, Google Workspace, TikTok, LinkedIn, Pinterest and X and 1 morelistAdRuleTemplates

Guide: Automated ad rules

Request

Send your API key as Authorization: Bearer pz_live_.... Read-only keys can call it. Keys with the ads resource group disabled get 403 resource_group_disabled. Authentication

Example

curl -X GET "https://api.pozy.ai/v1/ads/rules/templates" \
  -H "Authorization: Bearer $POZY_API_KEY"

Response

200 on success

  • templatesarray of objectrequired
    9 child fields
    • idstringrequired
    • namestringrequired
    • descriptionstringrequired
    • levelstringrequired

      One of campaign, adset, ad.

    • conditionsobjectrequired
      1 child field
      • allarray of objectrequired

        At least 1 item. Up to 10 items.

        4 child fields
        • metricstringrequired

          One of spend, impressions, clicks, conversions, ctr, cpc, cpm, cpa, roas, reach, frequency.

        • windowstringrequired

          One of today, yesterday, last_3d, last_7d, last_14d, last_30d.

        • opstringrequired

          One of >, >=, <, <=.

        • valuenumberrequired

          At least 0.

    • actionsarray of objectrequired

      At least 1 item.

      One of:

      Option 1 (1 fields)
      • typestringrequired

        One of notify.

      Option 2 (2 fields)
      • typestringrequired

        One of pause.

      • maxChangesPerDayinteger

        1 to 100.

      Option 3 (2 fields)
      • typestringrequired

        One of activate.

      • maxChangesPerDayinteger

        1 to 100.

      Option 4 (5 fields)
      • typestringrequired

        One of adjust_budget.

      • directionstringrequired

        One of increase, decrease.

      • percentintegerrequired

        1 to 100.

      • limitnumberrequired
      • maxChangesPerDayinteger

        1 to 100.

    • scheduleobjectrequired
      1 child field
      • everyMinutesintegerrequired

        One of 60, 180, 360, 720, 1440.

    • cooldownMinutesintegerrequired
    • platformsarray of stringrequired

      Can be null.

200 response
{
  "templates": [
    {
      "id": "6bfebd43ddc270f6d2c56fc5",
      "name": "Acme",
      "description": "A short description",
      "level": "campaign",
      "conditions": {
        "all": [
          {
            "metric": "spend",
            "window": "today",
            "op": ">",
            "value": 12.5
          }
        ]
      },
      "actions": [
        {
          "type": "notify"
        }
      ],
      "schedule": {
        "everyMinutes": 60
      },
      "cooldownMinutes": 1,
      "platforms": [
        "instagram"
      ]
    }
  ]
}

Errors

Errors use one shape: { error, type, code, param?, details? }. The ones you are most likely to see here:

400invalid_request_errorA parameter or body field is missing or invalid. param names it.
401authentication_errorThe API key is missing, revoked or expired.
403permission_errorThe key is scoped to other profiles or has this resource group disabled.
429rate_limit_errorToo many requests this minute. Wait for Retry-After seconds.

Every code is listed in Errors.

More in Ad Rules