BIND
POST/media

Upload a header file

Stores an image, a video or a PDF for the header of a WhatsApp template, and answers its id. Put the id in a HEADER component's example.header_handle when you create or update the template (see TemplateCreate.components); Meta reviews the template with this file, and every message sent with the template shows it. An id works only for templates of the brand that uploaded it.

Send the file as multipart/form-data, in the field file. What the file is, is read from its bytes, never from its name or declared type:

  • image: JPEG, PNG or WebP, at most 700 KB (a larger image is a 400; make it smaller before uploading, nothing is resized for you);

  • video: MP4 with H.264 video and at most one AAC audio track, at most 16 MB;

  • document: PDF, at most 16 MB.

At most 3 uploads of your brand are received at a time; another is a 429 with Retry-After.

Daily quota: your company can upload 200 MB a day, counted in started megabytes and renewed at 00:00 UTC. The quota is shared with the uploads made in the portal: what the portal uploads counts against it, and the other way round. Once it is spent the upload is a 429 with Retry-After until midnight. Scope portal:write.

Example: upload an image, then use its id in a template.

-H "Authorization: Bearer $BIND_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -F "file=@autumn-sale.jpg"

The answer is 201 with {"id": "med_3f9c…a18.jpg", "kind": "image", "contentType": "image/jpeg", "sizeBytes": 182044}. Send that id as the header's sample in POST /templates: json {"type": "HEADER", "format": "IMAGE", "example": {"header_handle": ["med_3f9c2a71d8e44b05a6c1e2f7b90d4a18.jpg"]}} A video goes to a VIDEO header and a PDF to a DOCUMENT header the same way; the answer's kind says which format takes the file.

Headers

  • Idempotency-Keystring· min 1 chars· max 255 chars· pattern ^[\x21-\x7E]+$

    Any value of yours, such as a UUID; send one with every upload, so a retry never stores the file twice or spends the quota twice. A repeat within 24 hours with the same file, byte for byte, answers 200 with the media the first request stored; 409 while the first request is still being stored; 422 IDEMPOTENCY_KEY_REUSED when the file differs.

    Example: "header-autumn-sale-0001"

Request body

multipart/form-data
  • filestring (binary)required

    The file. Up to 10 other text fields of at most 1 KB each are ignored; more fields, or a longer one, is a 400 on file.

Responses

Ready to send your first message?

We set up your account, sender profiles and API key with you, and help you through the first integration.

Bind console showing an SMS profile going live