# Conversions API

Send server-side events to Pinterest with POST /v1/events and read their Event Quality Score.

import { Tab, Tabs } from 'fumadocs-ui/components/tabs';

Send server-side events to Pinterest with [`POST /v1/events`](/products/conversions-api) on your `pinterestads` account, then read their Event Quality Score.

## Before you start

The connected Pinterest user needs a Business Access role on the ad account (`403` otherwise).

`destinationId` is the numeric ad account id: Pinterest attributes to the ad account, not to a tag. [`GET /v1/ads/conversions/destinations`](/conversions/list-ad-conversion-destinations) lists them.

## Send a conversion event

The call maps to Pinterest's `POST /v5/ad_accounts/{id}/events`. Events deduplicate against the Pinterest tag by `eventId`, the same id the [Shopify install](/platforms/shopify/tracking-pixels) sends.

| Field | Pinterest |
|-------|-----------|
| `destinationId` | The numeric ad account id. |
| `eventName` | Standard names map to Pinterest's: `Purchase` = `checkout`, `AddToCart`, `InitiateCheckout`, `AddPaymentInfo`, `Lead`, `CompleteRegistration` = `signup`, `Subscribe`, `ViewContent`, `Search`, `PageView` = `page_visit`. Any other string is sent as is, so it matches a [custom event](/platforms/pinterest-ads/tracking-tag) of that name. |
| `user` | Needs `email`, or `ipAddress` plus `userAgent`. Identifiers are hashed before they leave Zernio. |
| `user.clickIds.epik` | The `epik` click id (the `_epik` cookie), sent as `click_id`. |
| `actionSource` | `web` stays `web`; `offline`, `crm`, `phone_call`, `system_generated` and `business_messaging` become `offline`. App events need `platformData.action_source` `app_android` or `app_ios`. |
| `testCode` | Any value sends the batch with `test=true`: Pinterest validates it without recording it. |
| `consent.adUserData: "DENIED"` | Sets `opt_out` on every event. |

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data } = await zernio.conversions.sendEvents({
  body: {
    profileId: '66a1f0c2a4b9d3e8f1a2b3c4',
    destinations: [{ accountId: '66b2e19d8c3f5a7e9d0b1c2d', destinationId: '549755885175' }],
    events: [{
      eventName: 'Purchase',
      eventTime: 1804150800,
      eventId: 'order_1042',
      value: 59.9,
      currency: 'USD',
      user: { email: 'ana@example.com', clickIds: { epik: 'dj0yJnU9...' } }
    }]
  }
});
```
</Tab>
<Tab value="Python">
```python
data = client.conversions.send_events(
    profile_id="66a1f0c2a4b9d3e8f1a2b3c4",
    destinations=[{"accountId": "66b2e19d8c3f5a7e9d0b1c2d", "destinationId": "549755885175"}],
    events=[{
        "eventName": "Purchase",
        "eventTime": 1804150800,
        "eventId": "order_1042",
        "value": 59.9,
        "currency": "USD",
        "user": {"email": "ana@example.com", "clickIds": {"epik": "dj0yJnU9..."}},
    }],
)
```
</Tab>
<Tab value="curl">
```bash
curl -X POST "https://zernio.com/api/v1/events" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "profileId": "66a1f0c2a4b9d3e8f1a2b3c4",
    "destinations": [{ "accountId": "66b2e19d8c3f5a7e9d0b1c2d", "destinationId": "549755885175" }],
    "events": [{
      "eventName": "Purchase",
      "eventTime": 1804150800,
      "eventId": "order_1042",
      "value": 59.9,
      "currency": "USD",
      "user": { "email": "ana@example.com", "clickIds": { "epik": "dj0yJnU9..." } }
    }]
  }'
```
</Tab>
</Tabs>

Response (`200`):

```json
{
  "eventsReceived": 1,
  "stored": true,
  "testCode": null,
  "destinations": [
    { "accountId": "66b2e19d8c3f5a7e9d0b1c2d", "destinationId": "549755885175", "platform": "pinterestads", "eventsSent": 1, "eventsFailed": 0, "failures": [] }
  ],
  "queuedDestinations": 0
}
```

Pinterest answers per event, so one bad event does not fail the batch. Failed events are listed in `failures`.

## Event Quality Score

Call this endpoint ([reference](/conversions/get-conversions-quality)):

```
GET /v1/ads/conversions/quality?accountId=...&destinationId=<ad account id>
```

It returns Pinterest's Event Quality Score for Conversions API web events over the last 14 days:

- one row per event name
- each identifier's coverage in `matchKeys`
- `eventCoveragePercentage`, the share of events whose `event_id` overlaps with the tag

Pinterest has no composite score, so `compositeScore` is absent.

## If it fails

| Error | Cause | Fix |
|-------|-------|-----|
| `INVALID_EVENT` in `failures` | An event without an identity, caught before sending | Send `user.email`, or `user.ipAddress` plus `user.userAgent`. |
| `PINTEREST_EVENT_FAILED` in `failures` | Pinterest rejected that event | Read the failure's message, fix the event and resend it. |
| `403` | The Pinterest user lacks a Business Access role on the ad account | Grant a Business Access role on the ad account. |
| Event recorded nowhere | `testCode` was set, so Pinterest validated the batch without recording it | Drop `testCode` for live events. |

## Related

- [Send events](/conversions/send-events): the unified event shape, every field.
- [Get conversions quality](/conversions/get-conversions-quality): the Event Quality Score call.
- [Pinterest Tag](/platforms/pinterest-ads/tracking-tag): the tag these events deduplicate against.
- [Read ad analytics](/platforms/pinterest-ads/analytics): spend and delivery per Promoted Pin.