Media
Upload a file
# Upload a file
A file to send: multipart, the file in `file` and the channel it goes on in `channel`: `whatsapp`. Instagram takes no uploads, only links. The response's `id` is the `media_id` a send names, valid until `expires_at`, 30 days on WhatsApp. The channel keeps the file, and we keep only its id. WhatsApp takes a photo as JPEG or PNG up to 5 MB, a video as MP4 or 3GP (H.264 and AAC) up to 16 MB, and audio as AAC, AMR, MP3, M4A or OGG (Opus, mono) up to 16 MB. With a test key the file is checked and stays on the simulator.
## Form fields
- `file` (file, required): The file. A photo as JPEG or PNG up to 5 MB, a video as MP4 or 3GP and audio as AAC, AMR, MP3, M4A or OGG, each up to 16 MB.
- `channel` (string, required): The channel the file goes on: `whatsapp`. Instagram takes files only by link.
## Errors
| Code | HTTP | What it means |
| --- | --- | --- |
| `invalid_request` | 422 | The request is not filled in correctly. |
| `channel_unavailable` | 422 | The channel is unavailable: it is not connected to the workspace or was disconnected. Connect it on the workspace's Channels page. |
| `media_format` | 422 | The file's format does not fit. A photo goes as JPEG or PNG, a video as MP4 or 3GP (H.264 and AAC), audio as AAC, AMR, MP3, M4A or OGG (Opus, mono), and a voice note only as OGG with the Opus codec, mono: an uploaded file of that format, or a link ending in .ogg or .opus. |
| `media_too_large` | 422 | The file is larger than the channel takes: up to 5 MB for a photo, 16 MB for audio and video. |
| `media_rejected` | 422 | The channel did not take the file: its format did not fit or its link did not open. Check the format and size, and that the link opens without signing in. |
| `channel_error` | 422 | The channel did not take the message. Try again later, and if it still fails, write to us. |
## Response 201
```json
{
"id": "med_0199c5e2-5c18-7a3f-9d2e-1b0c4a6e8f72",
"channel": "whatsapp",
"mime_type": "audio/ogg",
"size": 14695,
"expires_at": "2026-11-08T09:30:00+00:00"
}
```
POST /v1/media
A file to send: multipart, the file in file and the channel it goes on in channel: whatsapp. Instagram takes no uploads, only links. The response's id is the media_id a send names, valid until expires_at, 30 days on WhatsApp. The channel keeps the file, and we keep only its id. WhatsApp takes a photo as JPEG or PNG up to 5 MB, a video as MP4 or 3GP (H.264 and AAC) up to 16 MB, and audio as AAC, AMR, MP3, M4A or OGG (Opus, mono) up to 16 MB. With a test key the file is checked and stays on the simulator.
Form fields
-
filefile required - The file. A photo as JPEG or PNG up to 5 MB, a video as MP4 or 3GP and audio as AAC, AMR, MP3, M4A or OGG, each up to 16 MB.
-
channelstring required - The channel the file goes on:
whatsapp. Instagram takes files only by link.
Errors
| Code | HTTP | What it means |
|---|---|---|
invalid_request | 422 | The request is not filled in correctly. |
channel_unavailable | 422 | The channel is unavailable: it is not connected to the workspace or was disconnected. Connect it on the workspace's Channels page. |
media_format | 422 | The file's format does not fit. A photo goes as JPEG or PNG, a video as MP4 or 3GP (H.264 and AAC), audio as AAC, AMR, MP3, M4A or OGG (Opus, mono), and a voice note only as OGG with the Opus codec, mono: an uploaded file of that format, or a link ending in .ogg or .opus. |
media_too_large | 422 | The file is larger than the channel takes: up to 5 MB for a photo, 16 MB for audio and video. |
media_rejected | 422 | The channel did not take the file: its format did not fit or its link did not open. Check the format and size, and that the link opens without signing in. |
channel_error | 422 | The channel did not take the message. Try again later, and if it still fails, write to us. |
Any request can also get the codes on Errors, such as unauthenticated and rate_limited.