> ## Documentation Index
> Fetch the complete documentation index at: https://docs.myunite.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Digital pre-test

> Create an ad pre-test for Meta or TikTok.

Use `channel: "digital"` for Meta and TikTok ads. The specific fields live under `digital`.

## Fields

| Field | Required | Description |
| - | - | - |
| `uploadId` | Yes | Image, or video up to 30 s. |
| `channel` | Yes | `digital`. |
| `digital.platform` | Yes | `meta` or `tiktok`. |
| `digital.placement` | Yes | Ad placement. See the table below. |
| `digital.objective` | No | `awareness`, `traffic`, `sales` or `leads`. |
| `title`, `brandId`, `locale`, `metadata` | No | Same as the [OOH pre-test](https://docs.myunite.ai/en/pretests/ooh.md). |

## Placements by platform

| Platform | Placements (`placement`) |
| - | - |
| `meta` | `feed`, `stories`, `reels`, `in_stream` |
| `tiktok` | `feed` |

A placement the platform does not offer responds [`invalid_placement`](https://docs.myunite.ai/en/errors#invalid_placement). The always up-to-date list is in `GET /catalog`, under `digital.platforms`.

## Example

```bash curl theme={null}
curl -X POST https://myunite.ai/api/v1/pretests \
  -H "Authorization: Bearer $UNITE_API_KEY" \
  -H "Idempotency-Key: summer-urban-clock-meta-001" \
  -H "Content-Type: application/json" \
  -d '{
    "uploadId": "upl_0123456789abcdef0123456789abcdef.mp4",
    "title": "Summer · urban clock",
    "channel": "digital",
    "digital": { "platform": "meta", "placement": "reels", "objective": "awareness" }
  }'
```

```javascript JavaScript theme={null}
const res = await fetch("https://myunite.ai/api/v1/pretests", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UNITE_API_KEY}`,
    "Idempotency-Key": "summer-urban-clock-meta-001",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    uploadId: "upl_0123456789abcdef0123456789abcdef.mp4",
    title: "Summer · urban clock",
    channel: "digital",
    digital: { platform: "meta", placement: "reels", objective: "awareness" },
  }),
});
console.log(res.status, await res.json()); // 202
```

```python Python theme={null}
import os
import requests

res = requests.post(
    "https://myunite.ai/api/v1/pretests",
    headers={
        "Authorization": f"Bearer {os.environ['UNITE_API_KEY']}",
        "Idempotency-Key": "summer-urban-clock-meta-001",
    },
    json={
        "uploadId": "upl_0123456789abcdef0123456789abcdef.mp4",
        "title": "Summer · urban clock",
        "channel": "digital",
        "digital": {"platform": "meta", "placement": "reels", "objective": "awareness"},
    },
)
print(res.status_code, res.json())  # 202
```

Videos longer than 30 seconds respond [`video_too_long`](https://docs.myunite.ai/en/errors#video_too_long) and do not consume quota.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.