Messages
Send a voice note
# Send a voice note
A voice note to a customer who wrote to you in the last 24 hours, like free text: `type` is `voice`, and `voice` has an uploaded file's `media_id` or a public https `url` to an `.ogg` or `.opus` file the channel fetches itself, one of the two. On Instagram only `url`. A voice note is OGG with the Opus codec, mono: the customer's phone plays it at once and shows it with a microphone. Send any other audio with `type` `audio` and the same fields under `audio`.
## Headers
- `Idempotency-Key` (string): Makes a retry safe: the same key with the same body within 24 hours returns the first response and sends nothing again. Use an id of your own for the message, for example the order number. Up to 255 characters, not blank.
## Body
- `to` (string, required): The customer: an E.164 number on WhatsApp, or the `from` of their message on Instagram. Up to 32 characters.
- `channel` (string, required): `whatsapp`, `instagram`, or `auto` for the channel the customer last wrote on.
- `type` (string, required): `voice`, or `audio` for an audio file, with the same fields under `audio`.
- `voice.media_id` (string): The `id` of a file uploaded with `POST /v1/media`, on WhatsApp, up to 64 characters. Give this or `voice.url`.
- `voice.url` (string): An https link to the file, up to 2,048 characters. Give this or `voice.media_id`.
- `audio.media_id` (string): The `id` of a file uploaded with `POST /v1/media`, on WhatsApp, up to 64 characters. Give this or `audio.url`.
- `audio.url` (string): An https link to the file, up to 2,048 characters. Give this or `audio.media_id`.
## Errors
| Code | HTTP | What it means |
| --- | --- | --- |
| `invalid_request` | 422 | The request is not filled in correctly. |
| `invalid_phone` | 422 | Give the number in international format, for example +77011234567. |
| `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. |
| `payment_required` | 402 | The channel is unpaid, so sending on it is stopped. |
| `recipient_unknown` | 422 | This person has not written on Instagram yet. Put the `from` of their message in `to`. |
| `channel_unresolved` | 422 | The customer has not written to you on any connected channel, so auto cannot choose one. Name the channel, for example whatsapp. |
| `outside_window` | 422 | The customer has not written to you in the last 24 hours, and WhatsApp lets free text through only as a reply. Send an approved template. |
| `media_not_found` | 404 | No such file. A key sees only the files of its own workspace and its own mode, live or test. A file uploaded for one channel goes only on that channel, and GET /v1/media/{id} downloads only files customers sent. |
| `media_expired` | 410 | The channel no longer keeps this file: WhatsApp keeps a file a customer sent for 7 days and an uploaded one for 30. Download a customer's file sooner, and upload yours again. |
| `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. |
| `meta_payment` | 422 | Meta is not sending messages: the WhatsApp account has no working card. Add a card at Meta and try again. |
| `idempotency_mismatch` | 422 | This Idempotency-Key came with a different request before. Use a new key for a new message. |
| `idempotency_in_progress` | 409 | A request with this Idempotency-Key is still running. Try again in a moment. |
## Response 201
```json
{
"id": "0199c5e2-7b3a-7c51-9f0e-3a1d2b4c5e6f",
"to": "+77011234567",
"contact_id": "0199c5e2-1f0a-7a42-8d1e-5b7c9a2e4f10",
"channel": "whatsapp",
"type": "voice",
"voice": {
"media_id": "med_0199c5e2-5c18-7a3f-9d2e-1b0c4a6e8f72"
},
"status": "sent",
"error": null,
"sent_by": "api",
"created_at": "2026-10-09T09:30:00+00:00",
"sent_at": "2026-10-09T09:30:00+00:00",
"delivered_at": null,
"read_at": null
}
```
POST /v1/messages
A voice note to a customer who wrote to you in the last 24 hours, like free text: type is voice, and voice has an uploaded file's media_id or a public https url to an .ogg or .opus file the channel fetches itself, one of the two. On Instagram only url. A voice note is OGG with the Opus codec, mono: the customer's phone plays it at once and shows it with a microphone. Send any other audio with type audio and the same fields under audio.
Returns the message object.
Headers
-
Idempotency-Keystring - Makes a retry safe: the same key with the same body within 24 hours returns the first response and sends nothing again. Use an id of your own for the message, for example the order number. Up to 255 characters, not blank.
Body
-
tostring required - The customer: an E.164 number on WhatsApp, or the
fromof their message on Instagram. Up to 32 characters. -
channelstring required whatsapp,instagram, orautofor the channel the customer last wrote on.-
typestring required voice, oraudiofor an audio file, with the same fields underaudio.-
voice.media_idstring - The
idof a file uploaded with POST /v1/media, on WhatsApp, up to 64 characters. Give this orvoice.url. -
voice.urlstring - An https link to the file, up to 2,048 characters. Give this or
voice.media_id. -
audio.media_idstring - The
idof a file uploaded with POST /v1/media, on WhatsApp, up to 64 characters. Give this oraudio.url. -
audio.urlstring - An https link to the file, up to 2,048 characters. Give this or
audio.media_id.
Errors
| Code | HTTP | What it means |
|---|---|---|
invalid_request | 422 | The request is not filled in correctly. |
invalid_phone | 422 | Give the number in international format, for example +77011234567. |
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. |
payment_required | 402 | The channel is unpaid, so sending on it is stopped. |
recipient_unknown | 422 | This person has not written on Instagram yet. Put the from of their message in to.
|
channel_unresolved | 422 | The customer has not written to you on any connected channel, so auto cannot choose one. Name the channel, for example whatsapp. |
outside_window | 422 | The customer has not written to you in the last 24 hours, and WhatsApp lets free text through only as a reply. Send an approved template. |
media_not_found | 404 | No such file. A key sees only the files of its own workspace and its own mode, live or test. A file uploaded for one channel goes only on that channel, and GET /v1/media/{id} downloads only files customers sent. |
media_expired | 410 | The channel no longer keeps this file: WhatsApp keeps a file a customer sent for 7 days and an uploaded one for 30. Download a customer's file sooner, and upload yours again. |
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. |
meta_payment | 422 | Meta is not sending messages: the WhatsApp account has no working card. Add a card at Meta and try again. |
idempotency_mismatch | 422 | This Idempotency-Key came with a different request before. Use a new key for a new message. |
idempotency_in_progress | 409 | A request with this Idempotency-Key is still running. Try again in a moment. |
Any request can also get the codes on Errors, such as unauthenticated and rate_limited.