Skip to main content

Upload a multipart file to Meta

POST/v1/media

Upload a multipart file to Meta and get back a media ID.

Authentication

Send Authorization: Bearer <API_KEY> in the request headers; required scope: media:write. Which resources an API Key can reach is determined by its current authorization scope.

Request​

Base URL: https://api.bluehola.com

Parameters​

NameInRequiredType / constraintsDescription
phoneNumberIdqueryYesstringThe platform's phone number ID, pn_.... Required — missing or empty returns 400 VALIDATION_FAILED; it must also pass the API Key's phone number authorization check

Request body​

A request body is required. A single file part (at most 3 files per request); a file over 16 MB returns 400 VALIDATION_FAILED with the message invalid multipart upload (max 16MB per file, 3 files). Each file is also checked against a per-type size limit — see Upload size limits by media type below — and exceeding that returns 400 VALIDATION_FAILED with details: { mimeType, sizeBytes, limitBytes }. Content-Type: multipart/form-data Schema:

{
"type": "object",
"properties": {
"file": {
"type": "string",
"format": "binary"
}
},
"required": [
"file"
]
}

Response​

StatusDescription
201Created
4xxClient error

For the common error envelope and how to handle it, see Error Codes.

Notes​

phoneNumberId must be the platform's own phone number ID (pn_...) and must belong to the current account; the server resolves the Meta-side phone number ID from it before forwarding the upload. The media itself is not persisted on the platform (only the filename, type and owning phone number are recorded — not the bytes), and Meta-side media IDs typically expire after a few days, so it is not advisable to depend on the same ID long-term.

Upload size limits by media type​

The platform checks the uploaded file's size against a per-type table that mirrors Meta's own limits, instead of one flat cap:

TypeLimit
image/jpeg, image/png5 MB
audio/* (aac, amr, mpeg, mp4, ogg), video/3gpp, video/mp416 MB
Documents (text/plain, application/pdf, Word/Excel/PowerPoint)16 MB — stricter than Meta's own 100 MB, because the upload path buffers the whole file in memory
image/webp stickers100 KB static / 500 KB animated (read from the WebP container; a container the platform cannot recognize is treated as static, the stricter limit)
Any other MIME type16 MB, deferred to Meta's own check

A file over its type's limit is rejected (400 VALIDATION_FAILED) before it ever reaches Meta. Audio, video and documents up to 16 MB can now go through this upload channel directly; use the link form on the message instead only for assets past these limits (or past Meta's own 100 MB cap for documents).

The format allowlist and other per-type details still follow whatever Meta enforces when the media message is actually sent; the platform does not pre-check formats at this layer.