unsupported_media_type — Media type rejected
What the API returns
{
"error": {
"code": "unsupported_media_type",
"message": "This media type is not supported.",
"request_id": "req_01JRQ8F4X9N2K7YB3C5V6W8H0T"
}
}Every Wapito error is this one envelope. Branch on code, which is stable; message is written for people and can be reworded; details appears only when there is something specific to say; request_id is what to quote to support.
What it means
unsupported_media_type is an HTTP 415 error from the Wapito WhatsApp API: media type rejected. The response message reads “This media type is not supported.” It is not retryable: the same request fails again until you change it. 5 endpoints can raise it, POST /messages/image among them.
Why it happens
The file you attached is not an acceptable type for the kind of message you are sending. WhatsApp is strict about this: voice notes must be an Opus-encoded audio file, stickers must be WebP within size rules, images must be JPEG or PNG, and a video must use a codec the recipient's phone can play. Sending a file with the right extension but the wrong actual encoding fails here as well, because the content is sniffed rather than trusted.
How to fix unsupported_media_type
Match the file to the endpoint: use the document endpoint for anything that is not a genuine image, video or audio file.
Transcode voice notes to Opus in an Ogg container - an MP3 renamed to .ogg will still be rejected.
Check the real content type of the file rather than its extension before uploading; many CMS exports mislabel their files.
Endpoints that raise it
Where you will meet it
- Post Status
Feature guide
Retry guidance
Do not retry as sent
The same request fails the same way until something changes: the body, the credential, the recipient or the state of the channel. Keep it off every retry loop, fix the cause above, and send a corrected request once.
Frequently asked questions
Why was my sticker rejected when it is a PNG?
Stickers are a WebP-only format on WhatsApp, with their own dimension and size rules. A PNG has to be converted to WebP before it can be sent as a sticker. Sending it to the image endpoint instead works fine, but it appears as an ordinary photo rather than as a sticker.
Can I send any file as a document?
Almost. The document endpoint is deliberately permissive because documents are delivered as files rather than rendered, but very large files still hit the size ceiling and a few executable types are refused. When in doubt, send as a document and give it a clear filename.
Related
Try it on your own number
Create a channel, link a WhatsApp number by QR or pairing code, and call the API in a couple of minutes. The Sandbox plan is free and needs no card.