# Offline conversions

Send in-store, CRM and call-center conversions to TikTok's Offline Events API with POST /v1/events.

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

Send offline conversions (in-store, CRM, call-center) to TikTok's Offline Events API with [`POST /v1/events`](/products/conversions-api) on your `tiktokads` account. Web-pixel events are not sent this way.

## Before you start

The connection must have granted TikTok's Offline Events permission. Connections authorized before it must [reconnect](/platforms/tiktok-ads#connect).

`destinationId` is an Offline Event Set id. [`GET /v1/ads/conversions/destinations`](/conversions/list-ad-conversion-destinations) lists the event sets of every advertiser on the connection.

## Send a conversion event

Each event needs an `email` or a `phone` in `user`.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data } = await zernio.conversions.sendEvents({
  body: {
    profileId: '66a1f0c2a4b9d3e8f1a2b3c4',
    destinations: [{ accountId: '66b2e19d8c3f5a7e9d0b1c2d', destinationId: '7057103914977558530' }],
    events: [{
      eventName: 'Purchase',
      eventTime: 1804150800,
      eventId: 'order_1042',
      value: 59.9,
      currency: 'USD',
      actionSource: 'offline',
      user: { email: 'ana@example.com', phone: '+14155550123' }
    }]
  }
});
```
</Tab>
<Tab value="Python">
```python
data = client.conversions.send_events(
    profile_id="66a1f0c2a4b9d3e8f1a2b3c4",
    destinations=[{"accountId": "66b2e19d8c3f5a7e9d0b1c2d", "destinationId": "7057103914977558530"}],
    events=[{
        "eventName": "Purchase",
        "eventTime": 1804150800,
        "eventId": "order_1042",
        "value": 59.9,
        "currency": "USD",
        "actionSource": "offline",
        "user": {"email": "ana@example.com", "phone": "+14155550123"},
    }],
)
```
</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": "7057103914977558530" }],
    "events": [{
      "eventName": "Purchase",
      "eventTime": 1804150800,
      "eventId": "order_1042",
      "value": 59.9,
      "currency": "USD",
      "actionSource": "offline",
      "user": { "email": "ana@example.com", "phone": "+14155550123" }
    }]
  }'
```
</Tab>
</Tabs>

Response (`200`):

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

## How fields map

| Field | TikTok |
|-------|--------|
| `destinationId` | The Offline Event Set id, sent as `event_set_id`. |
| `eventName` | Sent unchanged as the event name, so a custom name reaches TikTok as is. |
| `eventTime` | Unix seconds, sent as an ISO 8601 timestamp. |
| `user.email` | Lowercased, then SHA-256 hashed. |
| `user.phone` | Normalized to E.164 with the leading `+`, then SHA-256 hashed. |
| `actionSource` | `web` = `website`, `offline` = `in_store`, `phone_call` and `crm` keep their names; `app`, `system_generated` and `business_messaging` = `other`. |
| `value`, `currency`, `items` | Sent as the event's properties; `items` become `contents`. |

## How it behaves

- Events go to TikTok in batches of up to 1,000 against one event set.
- An event with neither email nor phone is not sent. It is listed in `failures` with code `MISSING_IDENTITY`, and the rest are still sent.
- TikTok accepts or rejects a batch as a whole. When it rejects one, every event in it is listed in `failures` with TikTok's code and message.

## If it fails

| Error | Cause | Fix |
|---|---|---|
| `MISSING_IDENTITY` in `failures` | The event has no usable email or phone | Send `user.email` or `user.phone`. |
| Every event of a batch in `failures` | TikTok rejected the batch | Read the TikTok code and message on each failure. |
| `400` naming `destinationId` | No Offline Event Set id was sent | Pass an id from `GET /v1/ads/conversions/destinations`. |

## Related

- [Send events](/conversions/send-events): the unified event shape, every field.
- [List conversion destinations](/conversions/list-ad-conversion-destinations): the Offline Event Sets.
- [Pixels](/platforms/tiktok-ads/tracking-tag): the TikTok Pixel for web events.
- [Read ad analytics](/platforms/tiktok-ads/analytics): spend and results per ad.