# List ready-made ad rules

Returns ready-made ad rules.

```http
GET https://api.pozy.ai/v1/ads/rules/templates
```

- Area: Ads / Ad Rules
- Auth: Authorization: Bearer pz_live_...

## Example request

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

```ts
const res = await fetch("https://api.pozy.ai/v1/ads/rules/templates", {
  headers: { Authorization: `Bearer ${process.env.POZY_API_KEY}` },
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.get(
    "https://api.pozy.ai/v1/ads/rules/templates",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `templates`, array of object, required
  - `id`, string, required
  - `name`, string, required
  - `description`, string, required
  - `level`, string, required: One of `campaign`, `adset`, `ad`
  - `conditions`, object, required
    - `all`, array of object, required: At least 1 item. Up to 10 items
      - `metric`, string, required: One of `spend`, `impressions`, `clicks`, `conversions`, `ctr`, `cpc`, `cpm`, `cpa`, `roas`, `reach`, `frequency`
      - `window`, string, required: One of `today`, `yesterday`, `last_3d`, `last_7d`, `last_14d`, `last_30d`
      - `op`, string, required: One of `>`, `>=`, `<`, `<=`
      - `value`, number, required: At least 0
  - `actions`, array of object, required: At least 1 item
    - one of: Option 1
      - `type`, string, required: One of `notify`
    - one of: Option 2
      - `type`, string, required: One of `pause`
      - `maxChangesPerDay`, integer: 1 to 100
    - one of: Option 3
      - `type`, string, required: One of `activate`
      - `maxChangesPerDay`, integer: 1 to 100
    - one of: Option 4
      - `type`, string, required: One of `adjust_budget`
      - `direction`, string, required: One of `increase`, `decrease`
      - `percent`, integer, required: 1 to 100
      - `limit`, number, required
      - `maxChangesPerDay`, integer: 1 to 100
  - `schedule`, object, required
    - `everyMinutes`, integer, required: One of `60`, `180`, `360`, `720`, `1440`
  - `cooldownMinutes`, integer, required
  - `platforms`, array of string, required: Can be null

```json
{
  "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"
      ]
    }
  ]
}
```
