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

# Conversions

Send your conversions to your own endpoint, read the signed JSON it receives, verify the signature and answer each batch.

`POST /v1/events` and forwarding rules send your conversions to a custom endpoint like any destination. The destination id is the connection's `endpointId`.

## Send a conversion event

Name the connection and its endpoint as the destination:

```bash
curl -X POST "https://zernio.com/api/v1/events" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "profileId": "PROFILE_ID",
    "destinations": [{ "accountId": "ACCOUNT_ID", "destinationId": "ep_3f9c1a7b2d4e6f8091a2b3c4" }],
    "events": [{
      "eventName": "Purchase",
      "eventTime": 1790000000,
      "eventId": "order_1042",
      "value": 80,
      "currency": "EUR",
      "user": { "email": "customer@example.com" }
    }]
  }'
```

To send every conversion without naming the endpoint each time, create a [forwarding rule](/conversions/create-forwarding-rule) for it. Rules take event name, source and site filters, value overrides and event renames, as for any destination.

Website events from the Zernio tag, funnel steps such as `ViewContent`, `AddToCart` and `InitiateCheckout` included, reach the endpoint through rules too, anonymous visitors as well.

## What the endpoint gets

Each request is a `POST` with `Content-Type: application/json` and `User-Agent: Zernio-Conversions/1.0`, carrying up to 100 events (payload version 1). Fields with no value are left out:

```json
{
  "type": "conversions",
  "version": 1,
  "endpointId": "ep_3f9c1a7b2d4e6f8091a2b3c4",
  "test": false,
  "sentAt": "2026-12-03T21:40:00.000Z",
  "events": [
    {
      "eventId": "order_1042",
      "eventName": "Purchase",
      "eventTime": 1790000000,
      "occurredAt": "2026-09-21T13:33:20.000Z",
      "value": 80,
      "currency": "EUR",
      "actionSource": "web",
      "sourceUrl": "https://shop.example.com/thanks?utm_source=meta&utm_campaign=bf",
      "user": {
        "emailSha256": "...", "phoneSha256": "...", "externalIdSha256": "...",
        "firstNameSha256": "...", "lastNameSha256": "...", "citySha256": "...", "stateSha256": "...", "zipSha256": "...",
        "countrySha256": "...", "dobSha256": "...", "genderSha256": "...",
        "country": "us", "ipAddress": "203.0.113.7", "userAgent": "Mozilla/5.0 ..."
      },
      "clickIds": { "fbc": "fb.1.1712.abc", "gclid": "Cj0K..." },
      "utm": { "source": "meta", "medium": "paid", "campaign": "bf", "term": "...", "content": "..." },
      "campaign": { "id": "120210000000", "name": "Black Friday" },
      "items": [{ "id": "sku_1", "name": "Mug", "price": 40, "quantity": 2, "category": "home" }],
      "consent": { "adStorage": "GRANTED", "adUserData": "GRANTED", "adPersonalization": "GRANTED", "analyticsStorage": "GRANTED" },
      "properties": {}
    }
  ]
}
```

A test send also has `"test": true` and its `testCode`. Every field, and how identifiers are hashed, is on [Limits and errors](/platforms/custom-endpoint/reference#payload-fields).

## Verify the signature

Requests are signed the [Standard Webhooks](https://www.standardwebhooks.com) way, with the connection's `signingSecret`:

| Header | Holds |
|--------|-------|
| `webhook-id` | `cnv_` and 32 hex characters. The same for a retry of the same events, so you can drop repeats |
| `webhook-timestamp` | Unix seconds |
| `webhook-signature` | `v1,` and the base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{raw body}` |

The key is the base64-decoded part after `whsec_`. Check the signature on the raw body, before parsing it:

```javascript
import crypto from 'node:crypto';

const secret = process.env.ZERNIO_SIGNING_SECRET; // whsec_...
const key = Buffer.from(secret.slice('whsec_'.length), 'base64');

export function isFromZernio(rawBody, headers) {
  const id = headers['webhook-id'];
  const timestamp = headers['webhook-timestamp'];
  // Refuse requests older (or newer) than 5 minutes.
  if (!id || Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;

  const expected = crypto
    .createHmac('sha256', key)
    .update(`${id}.${timestamp}.${rawBody}`)
    .digest();

  return (headers['webhook-signature'] ?? '').split(' ').some((entry) => {
    const [version, signature] = entry.split(',');
    if (version !== 'v1' || !signature) return false;
    const received = Buffer.from(signature, 'base64');
    return received.length === expected.length && crypto.timingSafeEqual(received, expected);
  });
}
```

The `standardwebhooks` libraries verify these requests as they are, with the same secret.

## Answer the request

| Your answer | What Zernio does |
|-------------|------------------|
| A 2xx | The events are accepted. |
| A 2xx with `{"rejected":[{"eventId":"...","message":"..."}]}` | Those events fail for good, with your message. The others are accepted. |
| A 429, a 5xx, a timeout or no answer | The delivery queue sends the batch again with backoff, for up to about 2.5 hours, then moves it to the dead-letter queue. |
| A 401 or 403 | The delivery fails and asks you to connect the endpoint again. |
| Any other 4xx, or a 3xx | The events fail for good. Redirects are never followed. |

Every outcome shows in the delivery log as for other destinations (`sent`, `retrying`, `failed`, `dropped`), and in `GET /v1/events/{eventId}`.

## Consent

- In the EEA, UK and Switzerland, an event is sent only with `adUserData` granted and no ad signal denied. Others show as `dropped`.
- Elsewhere, with `adUserData` denied, the hashed identity (email, phone, external id, name, address) is left out. Click ids, IP and user agent are kept.
- See [Consent](/products/server-side-tracking/consent).

## Migrate from another tool

To move off a tool that feeds each ad platform and your own systems separately, such as a GTM server-side setup:

1. Point your sources at Zernio: `POST /v1/events` from your backend, the Zernio tag, GTM sending to `POST /v1/events`, or a Shopify or Stripe connection.
2. Add a forwarding rule to a custom endpoint that feeds your own system: a warehouse, a CDP, an internal service or a GTM server container.

One stream then reaches the ad platforms and your endpoint. A GTM server container receives the POST through a custom client. There is no bulk import of past events.

## How it behaves

- Up to 100 events per request, with a 10 second timeout.
- An event with the same id and name already sent to the endpoint in the last 48 hours is not sent again.
- `testCode` on `POST /v1/events` reaches the endpoint with `test: true` and the code. Test sends are not stored as results.

## If it fails

| Error | Cause | Fix |
|-------|-------|-----|
| `Custom endpoint 500: …` | The endpoint answered with an error, shown after the status | Zernio sends the batch again. Fix the endpoint. |
| `The custom endpoint did not answer within 10 seconds.` | The endpoint is slow or down | Zernio sends the batch again. Answer first, then process the events. |
| `Custom endpoint 301: it redirects, …` | The URL redirects | [Connect](/platforms/custom-endpoint/connect) the final URL. |
| `The custom endpoint rejected the event: …` | Your 2xx answer listed the event in `rejected` | Read your own message. |
| `The custom endpoint URL is not publicly reachable: …` | The host now resolves to a private, loopback or metadata address | Point the host at a public address. |
| `401` with `reconnect_required` | The endpoint answered 401 or 403 | Connect again with the header it expects. |

## Related

- [Send events](/conversions/send-events)
- [Create a forwarding rule](/conversions/create-forwarding-rule)
- [Consent](/products/server-side-tracking/consent)
- [Limits and errors](/platforms/custom-endpoint/reference)