Media
Download a file
# Download a file
A file a customer sent, by the `media_id` from `message.received`. The response is the file itself, its type in `Content-Type`. We read the file from the channel while you download it and keep no copy, so the channel decides how long it lasts: until `expires_at`, 7 days on WhatsApp, and after that the response is 410 `media_expired`. With a test key it is a sample file.
## Path parameters
- `id` (string, required): The file's `media_id` from an incoming message, starting with `med_`.
## Errors
| Code | HTTP | What it means |
| --- | --- | --- |
| `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. |
| `channel_error` | 422 | The channel did not take the message. Try again later, and if it still fails, write to us. |
## Response 200
```text
Content-Type: audio/ogg
Content-Length: 14695
Content-Disposition: attachment; filename="med_0199c5e2-6a2a-7b41-8e0d-2f1c3a4b5d6f.ogg"
Cache-Control: no-store
```
GET /v1/media/{id}
A file a customer sent, by the media_id from message.received. The response is the file itself, its type in Content-Type. We read the file from the channel while you download it and keep no copy, so the channel decides how long it lasts: until expires_at, 7 days on WhatsApp, and after that the response is 410 media_expired. With a test key it is a sample file.
Path parameters
-
idstring required - The file's
media_idfrom an incoming message, starting withmed_.
Errors
| Code | HTTP | What it means |
|---|---|---|
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. |
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.