Skip to main content
Use these endpoints to upload media files (images, documents, videos) for use in template and session WhatsApp messages, and to retrieve or download previously uploaded media.

Media Upload

string
required
API key generated for the TUC associated with the sending phone number.
string
application/json
Uploads a local file (multipart) or a remote file URL and returns a media ID/URL you can reference from send-message payloads (e.g. image.id, document.id).

Request parameters

string
required
WhatsApp phone number (with country code) for which media is being uploaded.
file
required
Media file to upload (image, document, video, etc.), sent as multipart form data.
As an alternative to file, send a url form field holding a remote file URL. Send one or the other, not both.

Sample cURL request

Sample JSON payload

Sample response payload

string
Media ID assigned to the uploaded file.
string
"success" on successful upload.
integer
HTTP status code of the upload operation.
string
Hosted URL of the uploaded media file.
Response

Error codes


Fetch Media URL

string
required
API key generated for the TUC associated with the sending phone number.
Retrieves the hosted URL for a previously uploaded media item by its media ID.

Query parameters

string
required
Media ID returned from the Media Upload endpoint.
string
required
WhatsApp sender phone number associated with the media.

Sample cURL request


Download Media

string
required
API key generated for the TUC associated with the sending phone number.
Downloads the media file content for a given hosted media URL.

Query parameters

string
required
Hosted media URL (e.g. the onextel_media_url value returned from Media Upload, or the URL returned from Fetch Media URL).
string
required
WhatsApp sender phone number associated with the media.

Sample cURL request