# Conversions

Send your conversions to The Trade Desk's Real-Time Conversions API, matched by TDID, UID2 or a UID2 token.

`POST /v1/events` sends your conversions to The Trade Desk's Real-Time Conversions API. The destination is the connection's tracking tag id.

## Send a conversion event

Name the Trade Desk account and its tracking tag id as the destination. Each event needs one of The Trade Desk's own ids:

```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": "xyz9876" }],
    "events": [{
      "eventName": "Purchase",
      "eventTime": 1798804800,
      "eventId": "order_12345",
      "sourceUrl": "https://shop.example.com/checkout/confirmation",
      "value": 25.99,
      "currency": "USD",
      "user": {
        "ipAddress": "203.0.113.7",
        "country": "US",
        "clickIds": { "tdid": "TDID_FROM_THE_CLICK" }
      }
    }]
  }'
```

To send every event to The Trade Desk without naming it each time, create a [forwarding rule](/conversions/create-forwarding-rule) for the account instead.

## Event names

| Zernio event | Sent to The Trade Desk as |
|--------------|---------------------------|
| `Purchase` | `purchase` |
| `AddToCart` | `addtocart` |
| `InitiateCheckout` | `startcheckout` |
| `ViewContent` | `viewitem` |
| `AddToWishlist` | `wishlistitem` |
| `PageView` | `sitevisit` |

Any other name is sent as you wrote it, and The Trade Desk reports it as a custom event.

## Match keys

Each event needs one of these. When an event has more than one, the first in the table wins:

| Field | Sent as |
|-------|---------|
| `user.clickIds.uid2Token` | `uid2_token`, a UID2 token from the UID2 SDK |
| `user.clickIds.uid2` | `adid`, with `adid_type` `UID2` |
| `user.clickIds.tdid` | `adid`, with `adid_type` `TDID` |

Email and phone are not sent: The Trade Desk takes no hashed email here. Turn emails into UID2s with your own UID2 integration.

The Zernio site tag captures the TDID when your Trade Desk click URL passes it as `ttd_id`. Send the Zernio visitor id as `user.visitorId` and Zernio adds it to your backend events.

## Other fields

| Your field | Sent as |
|------------|---------|
| `value`, `currency` | `value` with two decimals, `currency` in capitals |
| `items` | `items`: id as `item_code`, name, quantity and price. Items without an id are left out |
| `ipAddress` | `client_ip` |
| `sourceUrl` | `referrer_url` |
| `country` | `country` |
| `eventId` | `order_id` |

## How it behaves

- **Dedup.** `eventId` is sent as `order_id`, so a pixel event and a server event with the same id count once.
- **Test mode.** None. An event sent with `testCode` fails with "The Trade Desk has no test mode", and nothing reaches The Trade Desk.
- **Consent.** On a profile with consent first, an event from the EEA, the UK or Switzerland is sent only when `adUserData` is granted and no ad signal is denied. Elsewhere, a denied `adUserData` drops the Trade Desk id, so the event fails. See [Consent](/products/server-side-tracking/consent).
- **Batches.** Events go out in batches of up to 1,000. The Trade Desk accepts any well-formed event without checking the ids, so confirm the first conversions show on the tag.

## If it fails

| Error | Cause | Fix |
|-------|-------|-----|
| `The Trade Desk matches a conversion only by its own ids` | The event has no `tdid`, `uid2` or `uid2Token`, or `adUserData` was denied | Send one of the ids with consent. |
| `destinationId must be this connection's tracking tag id` | The destination is not the connected tag | Use the `trackerId` you connected. |
| `The Trade Desk has no test mode` | The request has a `testCode` | Send it without `testCode` to record it. |
| `401` with `reconnect_required` | The connection lost its advertiser or tag id | [Connect again](/platforms/the-trade-desk/connect). |

## Related

- [Send events](/conversions/send-events)
- [Create a forwarding rule](/conversions/create-forwarding-rule)
- [Deduplication](/products/server-side-tracking/deduplication)
- [What each platform gets](/products/conversions-api/platforms)