> For the complete documentation index, see [llms.txt](https://docs.cartat.net/cartat-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cartat.net/cartat-api/whatsapp-official-api/templates/upload-media.md).

# Upload media

```http
POST /template/media
Authorization: Bearer <cartat_api_token>
Content-Type: multipart/form-data
```

Upload a media file before creating templates that use image, video, or document headers. Use the returned media handle in `components[].example.header_handle`.

### Form data

| Field  | Type | Required | Description                                     |
| ------ | ---- | -------: | ----------------------------------------------- |
| `file` | file |      Yes | Media file used as the template header example. |

### Example

```bash
curl -X POST "https://api.cartat.net/template/media" \
  -H "Authorization: Bearer <cartat_api_token>" \
  -F "file=@/path/to/file.pdf"
```

### Response

```json
{
  "handle": "uploaded_media_handle"
}
```
