GET /v1/{media_id}
Turns a media id into the file. Inbound messages carry media as an id (for example
image.id in the webhook), and so do your own uploads. Fetching it
takes two calls, exactly as with Meta’s Cloud API:
GET /v1/{media_id}returns the media object, with aurl.GETthaturlwith the same API key to download the bytes.
The paths and responses match the WhatsApp Cloud API’s GET /{media_id}, so code written for
Meta works by changing only the base URL and the key. A Graph version segment is accepted and
ignored, so GET /v1/v21.0/{media_id} works too.
1. Look up the media
Section titled “1. Look up the media”GET /v1/{media_id}Authorization: Bearer hello_live_xxxxxxxxxxxxxxxxcurl "$HELLO_API_URL/v1/$MEDIA_ID" \ -H "Authorization: Bearer $HELLO_API_KEY"Path parameters
Section titled “Path parameters”| Parameter | Type | Description |
|---|---|---|
media_id |
string | The media ID, from an inbound message webhook or from POST /v1/{phone_number_id}/media |
Response 200
Section titled “Response 200”{ "messaging_product": "whatsapp", "url": "https://api.example.com/v1/1099999999993456/download", "mime_type": "image/jpeg", "sha256": "5f1c0e...", "file_size": 48213, "id": "1099999999993456"}url is a Hello URL, not WhatsApp’s. It needs your API key, so send the same
Authorization: Bearer header when you fetch it. The media is looked up through your
organization’s own connected numbers only.
2. Download the file
Section titled “2. Download the file”GET /v1/{media_id}/downloadAuthorization: Bearer hello_live_xxxxxxxxxxxxxxxxcurl -o photo.jpg "$(curl -s "$HELLO_API_URL/v1/$MEDIA_ID" \ -H "Authorization: Bearer $HELLO_API_KEY" | jq -r .url)" \ -H "Authorization: Bearer $HELLO_API_KEY"The response body is the file itself, with its Content-Type and, when known, Content-Length.
Errors come back as JSON in the envelope below.
WhatsApp keeps media for about 30 days; after that the id is unknown and both calls are 404.
Errors
Section titled “Errors”Errors use the same envelope as Meta’s Cloud API: Meta’s code in error.code and Hello’s own
code in error.error_data.hello_code. See Errors for every field.
{ "error": { "message": "media not found: the media id is unknown, expired, or belongs to another organization", "type": "OAuthException", "code": 100, "error_subcode": 33, "error_data": { "messaging_product": "whatsapp", "details": "media not found: the media id is unknown, expired, or belongs to another organization", "hello_code": "NOT_FOUND" }, "fbtrace_id": "3f9c2a1e-7b4d-4c8e-9a15-2d6f8e0b1c47" }}| Status | hello_code |
error.code |
Cause |
|---|---|---|---|
401 |
UNAUTHORIZED |
190 |
Missing, wrong or disabled API key. This is the only 401: an unknown media id is never one. |
404 |
NOT_FOUND |
100 (subcode 33) |
The media id is malformed, unknown, expired, or belongs to another organization |
502 |
META_UNAVAILABLE |
2 |
WhatsApp was unreachable. Retry. |
500 |
FETCH_FAILED |
131000 |
Temporary error. Retry. |