GET/v1/messaging/messages/{messageId}/media

Media files are never linked from message objects or webhooks. Request a URL when you need the file, download it right away, and don't store the URL.

Authorization

Bearer token

Authorizationrequiredheader

Send your API key as Bearer YOUR_API_KEY.

Requires whatsapp.send for the media of messages you sent. The media of messages your customers sent you needs whatsapp.full_access: with a send-only key, those messages return 404. WhatsApp must be turned on for your organization.

Path parameters

messageIdrequiredstring

ID of a message with media, starting with msg_: an image, video, audio, document, or sticker, or a template with a media header.

Query parameters

expiresInSecondsoptionalinteger

How long the URL works, from 30 to 3600 seconds. Default 300.

Response

application/json200 OK

Example identifiers below are illustrative.

message_idstring

The message ID.

urlstring

Where to download the file: a short-lived URL, or the link you sent the file by.

expires_atstring or null

When url stops working. null for a link you sent the file by.

mime_typestring or null

The file type, such as image/jpeg.

size_bytesnumber or null

The file size in bytes. null for a link you sent the file by.

filenamestring or null

The file name, when known.

Errors

StatuscodeReturned when
400noneexpiresInSeconds is not a whole number from 30 to 3600.
401noneThe API key is missing, malformed, revoked, or expired.
403noneThe key lacks the whatsapp.send permission.
403FEATURE_NOT_AVAILABLEWhatsApp is not turned on for your organization.
404message_not_foundNo message with this ID exists in the key's project, it was deleted after 30 days, or it is a received message and the key lacks whatsapp.full_access.
404whatsapp_media_not_foundThe message has no media file, or the file was deleted.
409whatsapp_media_pendingThe file a customer sent is still being downloaded from WhatsApp.
409whatsapp_media_unavailableThe file a customer sent could not be downloaded from WhatsApp.
Nexiom Connect
Open dashboard