Skip to main content

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 an IMAGE, 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:
  1. Create an upload session for the file length and content type.
  2. Upload the bytes into that session and read back the handle.
The content type is derived from the uploaded part itself, validated against the allowed list, and checked against the size limit for its media type — all before anything reaches Meta. The app_id is verified to belong to the organization.
Template header: put the handle in header.examples alongside "format": "IMAGE" (or VIDEO / DOCUMENT). See Create Template.Profile picture: send the handle as profilePictureReference. See Update Business Profile.
A handle is single-use. It is consumed by the first request that references it and cannot be replayed — a second call with the same value fails. Upload the file again for each use, and never cache or share handles.

Endpoint

There are no query parameters. Unlike the other Public API endpoints, the body is 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

Take the handle from the upload response and send it as the header example:
The handle is spent by this call. See Update Business Profile.
A image/gif part is rejected before reaching Meta:
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: