What it does
Uploads a file to Meta’s resumable upload API and returns a media handle. Two endpoints consume that handle: Create Template uses it as the header example for anIMAGE, VIDEO, or DOCUMENT header, and Update Business Profile uses it as profilePictureReference. Neither one accepts raw file bytes or a public URL.
The endpoint runs the two Meta steps for you in a single call:
- Create an upload session for the file length and content type.
- Upload the bytes into that session and read back the handle.
app_id is verified to belong to the organization.
Endpoint
multipart/form-data, not JSON.
Headers
string
required
Secret key in
Bearer sk_... format. See Secret Key authentication.string
required
Always
multipart/form-data (your HTTP client sets it, together with the boundary).Path parameters
string
required
Application ID. Must belong to the organization (otherwise
404).Request Body
file
required
The file part. Its MIME type must be one of the allowed content types and its size must stay within that media type’s limit — see Media Type and Content Type. Both the media type and the size are resolved from the uploaded part, so you do not send them separately.
Limits at a glance: image (
image/jpeg, image/png) up to 5 MB, video (video/mp4) up to 16 MB, document (application/pdf) up to 100 MB. Anything else is rejected with 422 before the request reaches Meta.Response
The envelope is{ "data": {...}, "isSuccess": true }.
boolean
true when the file was uploaded successfully.object
The handle identifies the uploaded bytes on Meta’s side; it is not a public URL and cannot be fetched directly. Because it is consumed on first use, upload the file once per template or profile update you want to attach it to — the same image used in two templates needs two uploads.
Examples
Demo 1 — upload an image
Demo 1 — upload an image
Demo 2 — use the handle in a template media header
Demo 2 — use the handle in a template media header
Take the
handle from the upload response and send it as the header example:Demo 3 — use the handle as the business profile picture
Demo 3 — use the handle as the business profile picture
Demo 4 — upload a document
Demo 4 — upload a document
Demo 5 — error: unsupported content type → 422
Demo 5 — error: unsupported content type → 422
A
image/gif part is rejected before reaching Meta:Demo 6 — error: file too large → 422
Demo 6 — error: file too large → 422
A 9 MB PNG exceeds the 5 MB image limit:
Errors
object
Error details with
code, group, and description; isSuccess is false.Auth / tenant
Request validation (before reaching Meta)
Meta-side
Meta-side
Example error responses: