Media
Upload a file for a message, or let Watification fetch it from an https address, and use expiring media links from webhook payloads.
Before you send an image, video, document, audio file, or sticker through Send messages, store the file with POST /api/v1/media. The route returns a mediaId that you then pass as mediaId in the message. The request needs an API key with the messages.send scope.
Media links from webhook payloads work differently. They are read-only links to a received file. See Expiring media links.
Upload a file
Send the file bytes as the raw request body. Use the vendor media type application/vnd.watification.api-upload as Content-Type. Two more headers are required:
| Header | Required | Value |
|---|---|---|
Content-Type | Yes | application/vnd.watification.api-upload |
X-Content-Type | Yes | The file's real type, such as application/pdf or image/jpeg. |
X-Filename | Yes | The file name, from 1 to 200 characters. |
X-Media-Kind | No | The Media kind to store the file as: image, video, audio, document, or sticker. |
If you leave out X-Media-Kind, Watification reads the kind from the file type. A WebP file is stored as an image unless you declare sticker. A kind that does not allow the file's type answers 415 MEDIA_TYPE_NOT_ALLOWED.
Upload a sticker by declaring its kind:
curl -sS -X POST \
-H 'Authorization: Bearer wtf_xxxxxxxxxxxx_REPLACE_WITH_YOUR_SECRET' \
-H 'Content-Type: application/vnd.watification.api-upload' \
-H 'X-Content-Type: image/webp' \
-H 'X-Filename: thumbs-up.webp' \
-H 'X-Media-Kind: sticker' \
--data-binary @thumbs-up.webp \
'https://api.watification.com/api/v1/media'curl -sS -X POST \
-H 'Authorization: Bearer wtf_xxxxxxxxxxxx_REPLACE_WITH_YOUR_SECRET' \
-H 'Content-Type: application/vnd.watification.api-upload' \
-H 'X-Content-Type: application/pdf' \
-H 'X-Filename: ORD-1042.pdf' \
--data-binary @ORD-1042.pdf \
'https://api.watification.com/api/v1/media'Fetch a file from a URL
Send a JSON body with Content-Type: application/json. Watification downloads the file from url:
curl -sS -X POST \
-H 'Authorization: Bearer wtf_xxxxxxxxxxxx_REPLACE_WITH_YOUR_SECRET' \
-H 'Content-Type: application/json' \
-d '{ "url": "https://files.example.com/invoices/ORD-1042.pdf", "filename": "ORD-1042.pdf" }' \
'https://api.watification.com/api/v1/media'The url must follow these rules:
- It must use
https. - It must point to a public address. Private network addresses and cloud metadata addresses are refused.
- Watification follows at most 3 redirects, and checks every redirect against the same rules.
- The download must finish within 30 seconds.
filename is optional. Pass it when the address does not end in a useful file name.
If any rule fails, or the file cannot be downloaded, the request answers 422 MEDIA_FETCH_FAILED. The response does not say which rule failed.
Limits
Both forms use the same size and type limits as files uploaded in the Inbox. A file that is too large answers 413 MEDIA_TOO_LARGE. A file type that is not allowed answers 415 MEDIA_TYPE_NOT_ALLOWED.
Stored files count toward your workspace's media storage, which depends on your plan. While a file uploads, the size limit of its kind is held against the storage. When the storage is full, the upload answers 413 MEDIA_STORAGE_QUOTA_EXCEEDED and nothing is stored. The answer shows how many bytes the workspace uses and its limit:
{
"type": "https://docs.watification.com/errors/media-storage-quota-exceeded",
"title": "Developer request failed",
"status": 413,
"code": "MEDIA_STORAGE_QUOTA_EXCEEDED",
"detail": "The developer request could not be completed.",
"usedBytes": 1072693248,
"limitBytes": 1073741824,
"instance": "/api/v1/media",
"correlationId": "0199b7b1-9430-7000-8000-000000000001"
}Delete files you no longer need, or upgrade your plan, then upload again. Files that arrive in messages from WhatsApp, Instagram, Messenger, TikTok, Telegram, email, and SMS are always stored, even when the storage is full.
The 201 answer
{
"mediaId": "44444444-4444-4444-8444-444444444444",
"kind": "document",
"mimeType": "application/pdf",
"sizeBytes": 183204,
"filename": "ORD-1042.pdf",
"expiresAt": "2026-10-20T09:00:00.000Z"
}kind shows how the file will be sent: image, video, audio, document, or sticker.
A mediaId can be used in a message for 24 hours. After expiresAt, upload the file again. Use the mediaId in the matching message type:
{
"conversationId": "22222222-2222-4222-8222-222222222222",
"message": {
"type": "document",
"mediaId": "44444444-4444-4444-8444-444444444444",
"filename": "ORD-1042.pdf"
}
}Expiring media links
Webhook payloads for received messages contain a media object with a link:
{
"url": "https://api.watification.com/api/v1/public/media/Qm9keS1leGFtcGxlLXRva2Vu",
"expiresAt": "2026-10-02T09:00:00.000Z",
"mimeType": "image/jpeg",
"filename": "receipt.jpg",
"sizeBytes": 48210
}GET /api/v1/public/media/:token needs no key. It answers 302 Found with a short-lived storage address for the file, so your client follows the redirect to download it. Use curl -L to follow it.
- A link is valid for 24 hours from the moment the message was received.
- An expired or unknown link answers
404 MEDIA_LINK_NOT_FOUND. - Each link can be requested 60 times per minute. Requests above that answer
429 RATE_LIMITED.
Download the file as soon as you receive the event. Do not store the link itself as a long-term address.
Errors
| Code | HTTP | When |
|---|---|---|
API_KEY_SCOPE_MISSING | 403 | The key does not have messages.send. |
DEVELOPER_INVALID_INPUT | 422 | A required header is missing or invalid, or the JSON body is not valid. |
MEDIA_TOO_LARGE | 413 | The file is larger than the limit. |
MEDIA_STORAGE_QUOTA_EXCEEDED | 413 | The workspace is out of media storage. |
MEDIA_TYPE_NOT_ALLOWED | 415 | The file type is not allowed. |
MEDIA_FETCH_FAILED | 422 | The url could not be fetched, or was refused. |
MEDIA_LINK_NOT_FOUND | 404 | The media link is unknown or expired. |
See the error reference for every code.
Send messages
Send a WhatsApp, Messenger, or Instagram message from your backend, with the target, message kinds, reply window, and idempotency rules.
Contacts and conversations
Find and update contacts, change labels, assign and resolve conversations, add notes, and read the lists that fill dropdowns.