Upload a media file
POST/api/partner-gateway/media
Uploads a file to your media library and returns the new media item.
- How to send it: as
multipart/form-data, with the binary file in thefilepart. You can add aname, adescriptionand afolderId: withoutfolderId, or with-1, the file goes in the root of the library. - Any file type is accepted: its
type(IMAGE,VIDEO,AUDIO,DOCUMENTorFILE) is detected from the file content. - Size limit: the whole request, the file together with the other form fields, may be at most 10240 KiB (about 10 MB). A larger request is refused with
413. - Large images are scaled down: an image wider than 2560 or taller than 1440 pixels is scaled to fit within 2560x1440, keeping its aspect ratio, and re-encoded as JPEG. It loses any transparency and animation, while its
nameandmimeTypekeep the original type. Smaller images and all other files are stored as uploaded. - Channel limits are not checked here: each channel applies its own format and size limits when you send the file.
- Storage: the file counts against the media storage of your subscription plan.
The response is an array holding the new media item. Store its id: it is what you use to attach the file to an outbound message, such as an RCS rich card or a WhatsApp media message, or to the content of a campaign.
Request
Responses
- 201
- 400
- 401
- 404
- 413
- 429
- 502
- 504
Media uploaded. The response is an array holding the new media item.
The request is malformed, the file part is missing, the file is empty, or the folder is read-only.
The API key is missing, invalid, or lacks the MEDIA operation.
folderId is not one of your folders, or your company has no active subscription.
The request is larger than 10240 KiB.
The file would take your company past the media storage of its subscription plan.
The media storage service, or the subscription service it checks the storage with, is unavailable. Retry after a short delay.
The media storage service, or the subscription service it checks the storage with, did not answer in time. Retry after a short delay.