# Create a conversion event

Creates a conversion event.

```http
POST https://api.pozy.ai/v1/accounts/{accountId}/tracking-tags/{tagId}/events
```

- Area: Ads / Tracking Tags
- Auth: Authorization: Bearer pz_live_...

## Path parameters

- `accountId` (string, required)
- `tagId` (string, required)

## Request body

Content type: `application/json`

- `adAccountId`, string
- `name`, string, required: 1 to 200 characters
- `type`, string
- `siteEvent`, string: One of `page_view`, `view_content`, `add_to_cart`, `search`, `initiate_checkout`, `add_payment_info`, `purchase`
- `enabled`, boolean
- `defaultValue`, number: At least 0
- `currency`, string
- `clickWindowDays`, integer: 1 to 365
- `viewWindowDays`, integer: 0 to 365
- `urlContains`, string: 1 to 500 characters

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/accounts/696e0b682d0a31188e7a2ba9/tracking-tags/697ae8efd24020381023ee99/events" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Acme"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/accounts/696e0b682d0a31188e7a2ba9/tracking-tags/697ae8efd24020381023ee99/events", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "Acme"
  }),
});
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.post(
    "https://api.pozy.ai/v1/accounts/696e0b682d0a31188e7a2ba9/tracking-tags/697ae8efd24020381023ee99/events",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "name": "Acme",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 201

- `platform`, string
- `event`, object
  - `id`, string, required
  - `name`, string, required
  - `type`, string
  - `siteEvent`, string: One of `page_view`, `view_content`, `add_to_cart`, `search`, `initiate_checkout`, `add_payment_info`, `purchase`
  - `siteEventId`, string
  - `status`, string
  - `defaultValue`, number
  - `currency`, string
  - `clickWindowDays`, integer
  - `viewWindowDays`, integer
  - `urlContains`, string
  - `alwaysUseDefaultValue`, boolean
  - `primary`, boolean
  - `countingType`, string: One of `one`, `every`

```json
{
  "platform": "instagram",
  "event": {
    "id": "6bfebd43ddc270f6d2c56fc5",
    "name": "Acme",
    "type": "string",
    "siteEvent": "page_view",
    "siteEventId": "6a036e72b4645cc9fc4fed0b",
    "status": "active",
    "defaultValue": 12.5,
    "currency": "USD",
    "clickWindowDays": 1,
    "viewWindowDays": 1,
    "urlContains": "https://pozy.ai/media/example-1.jpg",
    "alwaysUseDefaultValue": true,
    "primary": true,
    "countingType": "one"
  }
}
```
