> Documentation index: https://docs.zernio.com/llms.txt. Every page is also Markdown: add .md to its URL.

# Conversions API

Send server-side conversion events to a Meta pixel with POST /v1/events, dedupe them against the browser pixel, and read Event Match Quality back.

Send conversions that happen off the website (a deal closed, a lead qualified, a trial converted) to a Meta pixel with `POST /v1/events`.

## Before you start

Conversions reach Meta's Graph API `events` endpoint. Campaigns can then optimize and report on them alongside the events the browser pixel captures.

You need a Meta ads account connected and a pixel to send to ([pixels](/platforms/meta-ads/tracking-tag)).

There is no pixel-scoped access token to paste. Zernio uses the ads connection you already have.

Send plaintext identifiers. Every piece of PII is normalized and hashed with SHA-256 server-side to Meta's spec before anything leaves Zernio.

### Find the pixel to send to

The Conversions API is Meta's server-side twin of the browser pixel. Send to it with `POST /v1/events`, with the pixel id as `destinationId`.

`GET /v1/ads/conversions/destinations` lists the pixels the connected ad accounts can reach.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: destinations } = await zernio.conversions.listAdConversionDestinations({
  query: { accountId: '66b2e19d8c3f5a7e9d0b1c2d' }
});

const destinationId = destinations.destinations[0].id;
```
</Tab>
<Tab value="Python">
```python
from zernio import Zernio

client = Zernio()

destinations = client.conversions.list_ad_conversion_destinations(
    account_id="66b2e19d8c3f5a7e9d0b1c2d"
)

destination_id = destinations["destinations"][0]["id"]
```
</Tab>
<Tab value="curl">
```bash
curl "https://zernio.com/api/v1/ads/conversions/destinations?accountId=66b2e19d8c3f5a7e9d0b1c2d" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"
```
</Tab>
</Tabs>

Response (`200`):

```json
{
  "platform": "metaads",
  "destinations": [
    { "id": "1234567890123456", "name": "Website pixel", "status": "active" }
  ]
}
```

On Meta a destination is a pixel (dataset), so `destinations[].id` is the same value as `promotedObject.pixelId` on a [conversion campaign](/platforms/meta-ads/conversion-campaigns).

## Send a conversion event

Each event needs `eventName`, `eventTime` (Unix seconds), `eventId` and `user`.

`actionSource` says where it happened: `web`, `app`, `offline`, `crm`, `phone_call` or `system_generated`.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data: sent } = await zernio.conversions.sendEvents({
  body: {
    profileId: '66a1f0c2a4b9d3e8f1a2b3c4',
    destinations: [{ accountId: '66b2e19d8c3f5a7e9d0b1c2d', destinationId: '1234567890123456' }],
    events: [
      {
        eventName: 'Lead',
        eventTime: 1804064400,
        eventId: 'order_abc_123',
        value: 42.5,
        currency: 'USD',
        actionSource: 'crm',
        user: {
          email: 'customer@example.com',
          phone: '+14155551234',
          firstName: 'Jane',
          lastName: 'Doe',
          country: 'US'
        }
      }
    ]
  }
});
```
</Tab>
<Tab value="Python">
```python
sent = client.conversions.send_events(
    profile_id="66a1f0c2a4b9d3e8f1a2b3c4",
    destinations=[{"accountId": "66b2e19d8c3f5a7e9d0b1c2d", "destinationId": "1234567890123456"}],
    events=[
        {
            "eventName": "Lead",
            "eventTime": 1804064400,
            "eventId": "order_abc_123",
            "value": 42.5,
            "currency": "USD",
            "actionSource": "crm",
            "user": {
                "email": "customer@example.com",
                "phone": "+14155551234",
                "firstName": "Jane",
                "lastName": "Doe",
                "country": "US",
            },
        }
    ],
)
```
</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": "1234567890123456" }],
    "events": [{
      "eventName": "Lead",
      "eventTime": 1804064400,
      "eventId": "order_abc_123",
      "value": 42.5,
      "currency": "USD",
      "actionSource": "crm",
      "user": {
        "email": "customer@example.com",
        "phone": "+14155551234",
        "firstName": "Jane",
        "lastName": "Doe",
        "country": "US"
      }
    }]
  }'
```
</Tab>
</Tabs>

Response (`200`):

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

Each destination reports its own `eventsSent`, `eventsFailed` and `failures`. A failure carries `eventIndex`, the `eventId` it echoes back, a `message` and a `code`.

`eventName` takes a Meta standard event (`Purchase`, `Lead`, `CompleteRegistration`, `AddToCart`, `InitiateCheckout`, `AddPaymentInfo`, `Subscribe`, `StartTrial`, `ViewContent`, `Search`, `Contact`, `SubmitApplication`, `Schedule`) or a custom name of your own.

A commerce event carries `items[]` and `sourceUrl` as well. Zernio maps them to Meta's fields:

- `items[]` becomes `contents` (the `id`, `price` and `quantity` of each row) plus `num_items`
- `sourceUrl` becomes `event_source_url`

```json
{
  "eventName": "Purchase",
  "eventTime": 1804064400,
  "eventId": "order_abc_125",
  "value": 129.5,
  "currency": "USD",
  "sourceUrl": "https://shop.example.com/checkout/complete",
  "user": { "email": "customer@example.com" },
  "items": [{ "id": "SKU-991", "name": "Trail runner", "price": 129.5, "quantity": 1, "category": "shoes" }]
}
```

`platformData` carries anything Zernio has not normalized. Its keys are shallow-merged into Meta's `custom_data`.

A field Zernio already builds (`value`, `currency`, `contents`, `num_items`) wins the collision.

`platformData` never reaches `user_data`, so match keys belong on `user`.

## Match keys

The more identifiers on `user`, the higher Meta's match rate. Send plaintext:

| Group | Fields |
|---|---|
| Contact | `email`, `phone`, `firstName`, `lastName` |
| Location and demographics | `country`, `city`, `state`, `zip`, `dob` (YYYYMMDD), `gender` (`f` or `m`) |
| Identifiers | `externalId` (your stable user or device id), `ipAddress`, `userAgent`, `leadId` |
| Click ids, under `user.clickIds` | `fbc` (from the `fbclid` URL parameter), `fbp` (the `_fbp` cookie) |

`ipAddress`, `userAgent`, `fbc` and `fbp` go to Meta unhashed, which is what Meta requires.

The highest-signal web keys are `fbc`, `fbp`, `externalId`, `ipAddress` and `userAgent`. Capture them at first touch and send them on every event.

## Deduplication

Send a stable `eventId` on every event and the same value from the browser pixel. Meta dedupes the pair within a 48-hour window.

<Callout type="warn">
A missing or inconsistent `eventId` between pixel and server double-counts the conversion. This is the usual cause of an inflated report.
</Callout>

## Batching and test mode

Send up to 1,000 events per request. Zernio chunks a larger batch.

On Meta a chunk is all or nothing. One malformed event rejects the chunk it is in, and every rejection shows up in `failures[]`.

**Test mode.** Put `testCode: "TEST12345"` at the root of the request. The batch goes to the Test Events tab in Meta Events Manager without touching production pixel data.

It is Meta's `test_event_code` passed straight through.

## Consent and limited data use

For a visitor in the EEA, the UK or Switzerland (from `user.country`), Meta gets the event only with `adUserData: GRANTED` and no `DENIED` signal. A signal left out counts as `DENIED`.

Meta has no consent field to read, so Zernio leaves those events out and lists them in the destination's `drops`. Send `consent` on each event, or once for the request.

Profiles created before November 2026 keep sending these events until they are switched over.

Limited Data Use is for US state privacy laws, not the EEA. Outside the EEA, UK and CH, the `consent` object drives it:

```json
{
  "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
  "destinationId": "1234567890123456",
  "consent": { "adUserData": "DENIED" },
  "events": [
    { "eventName": "Purchase", "eventTime": 1804064400, "eventId": "order_abc_124", "user": { "email": "customer@example.com" } }
  ]
}
```

Set either flag (`adUserData` or `adPersonalization`) to `DENIED` and every event in the batch is stamped with `data_processing_options: ["LDU"]` plus geolocation mode (`country: 0`, `state: 0`).

Geolocation mode tells Meta to work out from the event's own geo signals which US privacy law applies.

Limited Data Use covers US state privacy laws only.

It does not make an event from a visitor in the EEA, UK or Switzerland who declined ad tracking fine to send. Leave that visitor's events out of the batch.

`GRANTED`, or no `consent` at all, sends the events under Meta's default processing.

The same object also drives Google's consent signals. Zernio sends each consent state as its own batch, so one request can mix them.

## Event match quality

`GET /v1/ads/conversions/quality` reads Meta's Event Match Quality and pixel-to-server coverage back, without opening Events Manager.

Pass the pixel as `destinationId`.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data: quality } = await zernio.conversions.getConversionsQuality({
  query: { accountId: '66b2e19d8c3f5a7e9d0b1c2d', destinationId: '1234567890123456' }
});
```
</Tab>
<Tab value="Python">
```python
quality = client.conversions.get_conversions_quality(
    account_id="66b2e19d8c3f5a7e9d0b1c2d",
    destination_id="1234567890123456",
)
```
</Tab>
<Tab value="curl">
```bash
curl "https://zernio.com/api/v1/ads/conversions/quality?accountId=66b2e19d8c3f5a7e9d0b1c2d&destinationId=1234567890123456" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"
```
</Tab>
</Tabs>

Response (`200`):

```json
{
  "platform": "metaads",
  "rows": [
    {
      "eventName": "Purchase",
      "compositeScore": 6.2,
      "matchKeys": [{ "identifier": "email", "coveragePercentage": 80 }],
      "eventCoveragePercentage": 75
    }
  ]
}
```

There is one row per event name:

| Field | Meaning |
|-------|---------|
| `compositeScore` | The EMQ score from 0 to 10 |
| `matchKeys[]` | Per-identifier coverage |
| `eventCoveragePercentage` | How well the server events dedupe against the pixel |

Web events only, because Meta's API exposes web EMQ and not app or offline.

## If it fails
A rejected batch is not an error status. Meta returns `200` and reports the rejection in the body.

<Callout type="warn">
Branch on `eventsFailed`, never on the status code.
</Callout>

### Partial failure

Response (`200`):

```json
{
  "eventsReceived": 1,
  "stored": true,
  "testCode": null,
  "destinations": [
    { "accountId": "66b2e19d8c3f5a7e9d0b1c2d", "destinationId": "1234567890123456", "platform": "metaads", "eventsSent": 0, "eventsFailed": 1, "failures": [ { "eventIndex": 0, "eventId": "order_abc_123", "message": "Invalid event_time", "code": 100 } ] }
  ],
  "queuedDestinations": 0
}
```

Fix the event at `eventIndex` and resend the chunk. `eventId` makes the retry safe.

A `400` means the request body never reached Meta. `profileId`, `events` or a destination's `accountId` or `destinationId` is missing, or an event has a malformed shape.

A `403` means the connection has no ads access. On a legacy plan without ads this is expected. Ads are included with usage-based billing.

## Related

- [Pixels](/platforms/meta-ads/tracking-tag): create the pixel these events land on.
- [Conversion campaigns](/platforms/meta-ads/conversion-campaigns): optimize an ad set toward the events you send.
- [WhatsApp](/platforms/whatsapp/ctwa#conversions-api-for-business-messaging): the messaging-specific conversions path.
- [Send events](/conversions/send-events) and [Conversions quality](/conversions/get-conversions-quality): every field.