Media
Every request sends x-api-key. New here? Start with the
quickstart, or read API keys.
| Operation | SDK call | Endpoint |
|---|---|---|
| Upload a file | media.upload | POST /v1/media/ |
Upload a file
Upload a file and receive a med_ id to send with. Send the file as the body of a multipart/form-data request; no other fields are needed. The file is stored and registered with WhatsApp in one call, so the returned id is immediately usable. Idempotency-Key is honoured: the file itself is part of the fingerprint, so a retry replays the first result rather than storing a second copy.
Body
multipart/form-data with the file in a file part.
Response 201
{
"id": "med_7c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f",
"filename": "invoice.pdf",
"mimeType": "application/pdf"
}| Field | Type | Description |
|---|---|---|
id | string | Pass this to POST /v1/messages as mediaId. |
filename | string | The name the file was uploaded under. |
mimeType | string | The type we normalised to, which may differ from the one you declared. |
sizeBytes | integer | Size of the stored file. |
createdAt | string (ISO 8601) | When the file was uploaded. |
Errors
Returns 400, 401, 403, 429, 502, 503. Every one carries the standard envelope — branch on code, not the status. See Errors.