Download Media
GET Method
Download Media allows you to retrieve media that was uploaded through Kaleyra's WhatsApp Resumable Media API, which is optimized for large files and supports resuming interrupted uploads.
Prerequisites
- Before you get started, Create an API Key. To view the API Key and the SID, see View API Key and SID.
A prerequisite for using Kaleyra WhatsApp APIs is to have an active WhatsApp plan on Kaleyra platform. - To set up a WhatsApp account on Kaleyra platform, go through the Embedded Signup process.
- An active WhatsApp for Business API plan that includes:
- A WhatsApp business number.
- An associated profile with the business number.
- A WhatsApp verified and approved profile.
- A WABA ID onboarded on Kaleyra WhatsApp API V2.
API Domain and Value
| api_domain | Value |
|---|---|
| IN pod | api.in.kaleyra.io |
| SG Pod | api.ap.kaleyra.io |
| EU Pod | api.eu.kaleyra.io |
API request to download media
To download media, use the https://<api_domain>/v2/<sid>/whatsapp/<phone_number>/media/<media-id> endpoint.
The following is the request format to download media:
curl -L -X GET 'https://<api_domain>/v2/<sid>/whatsapp/<phone_number>/media/<media-id>' \
-H 'api-key: <api-key>' \
-H 'content-type: <content-type>'The following is the sample request format to upload resumable media:
curl -L -X GET 'https://api.in.kaleyra.io/v2/HXAP16XXXXXX97IN/whatsapp/918XXXXXX639/media?id=abc' \
-H 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3' \
-H 'content-type: application/json'Sample Success Response
The following success message appears:
200 OK
{
"media_url" : <Whatsapp_Media_URL>
}Sample Failure Response
The following are the failure responses:
401 Unauthorized
{
"code": "RBC001",
"message": "Incorrect SID or API key.",
"data": [],
"error": {
"error": "Incorrect SID or API key."
}
}401 Unauthorized phone number
{
"code": "WA401",
"message": "Phone number is not present or does not belong to the account.",
"data": {},
"error": {
"phone_number": "Phone number is not present or does not belong to the account."
}
}400 Incorrect payload
{
"code": "WA400",
"message": "Refer to correct payload format",
"data": {},
"error": {
"payload": "Incorrect payload format"
}
}500 Internal Server Error
{
"code": "WA500",
"message": "Please try again later",
"data": {},
"error": {
"error": "Internal server error"
}
}400 Low balance
{
"code": "E110",
"message": "Please check your balance, You have a low balance!",
"data": {},
"error": {
"balance": "Please check your balance, You have a low balance!"
}
}401 Unauthorised Account type
{
"code": "WA-401",
"message": "API is not available for given customer.Please contact support for more info",
"data": {},
"error": {
"account": "API is not available for given customer.Please contact support for more info"
}
}401 Unauthorized phone number version
{
"code": "WA-401",
"message": "The phone number you're using is associated with different Version of our WA API. Please use the appropriate endpoint.",
"data": {},
"error": {
"phone_number": "The phone number you're using is associated with different Version of our WA API. Please use the appropriate endpoint."
}
}400 Bad Request
{
"error": {
"message": "Unsupported get request. Object with ID '535XXXXXX014349' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "A2XXXXXX8fQWAzjYCJh7OsS"
}
}Updated about 6 hours ago
Did this page help you?

