Skip to content
API PlatformDevelopers
POST/v1/templates/samplesbeta

Upload a template header sample

Needs
Send WhatsApp messages; manage templates, quick messages and WhatsApp short links (messaging:write)
Plan
Any plan with API access
Limits
60 a minute per key
Dry run
Yes — every check runs with ?dry_run=true, nothing changes
Undo
Nothing to undo: an unused sample expires on its own.

WhatsApp reviews an IMAGE, VIDEO or DOCUMENT header by a sample file. Give the public https URL of one file (JPEG or PNG up to 5 MB, MP4 up to 16 MB, or PDF); it is downloaded, checked and uploaded to WhatsApp, and you get a handle to put in the draft's header.media_handle for Create a WhatsApp template.

The URL must be the file itself (no web page, no redirects) on a public address. Nothing is sent to customers. With ?dry_run=true (and with a test key) the file is not downloaded: only the URL (public https) and the file type its name declares are checked, and nothing is uploaded. The file's real type and size are checked when it is uploaded.

Try it

Body

Public https URL of the file.

The WhatsApp account the template will belong to. Needed only when your workspace has several.

Instead of `business_account_id`: a connected WhatsApp channel; its account is used.

Protects against doing it twice if you retry: a retry with the same key gets the first answer back instead of running again.

Test mode (dry run): nothing will change
Turns test mode off for this page only. It switches back when you leave the page.

Code and response

curl -X POST 'https://mcp.wa-api.cloud/v1/templates/samples?dry_run=true' \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "url": "https://cdn.example.com/banner.png"
}'

The code reads your key from $API_KEY.

Body

Body fields
FieldTypeWhat it is
urlrequiredstringPublic https URL of the file.12–2000 characters
business_account_idstringThe WhatsApp account the template will belong to. Needed only when your workspace has several.0–64 characters
channel_idstringInstead of business_account_id: a connected WhatsApp channel; its account is used.0–64 charactersSigned in? Pick one from your data with “My data”.

Headers

Headers
FieldTypeWhat it is
AuthorizationrequiredheaderBearer $API_KEY — your API key.
Api-VersionheaderThe API version to use, e.g. 2026-10-01. Default: the version your key is pinned to.one of: 2026-10-01 · pattern ^\d{4}-\d{2}-\d{2}$
Idempotency-KeyheaderAny unique string (8–128 characters). A retry with the same key returns the first answer instead of running twice. Kept 24 hours.pattern ^[A-Za-z0-9._:-]+$ · 8–128 characters

Response 200

The handle, and the header format the file fits.

Response fields
FieldTypeWhat it is
handlerequiredstringPut this in the draft's header.mediaHandle (valid for the template submission).
header_formatrequiredstringThe header format this file fits.one of: IMAGE, VIDEO, DOCUMENT
mime_typerequiredstring
bytesrequirednumber
business_account_idrequiredstring
business_account_namerequiredstring
dry_runbooleantrue when this was a dry run: every check ran and nothing changed.

Errors

Errors are application/problem+json. Branch on code.

StatusCodeWhen
400invalid_input

A field is missing or has the wrong format. errors[] points at each field. The URL is not a public https file, the type or size is not allowed, or the workspace has several WhatsApp accounts and none was chosen.

401unauthenticated

The Authorization header is missing, the key is unknown, expired or revoked.

403entitlement_required

The workspace's plan does not include API access (api_access).

403insufficient_scope

The key does not have the permission this operation needs.

409conflict

Also returned while a request with the same Idempotency-Key is still running.

429rate_limited

The key or workspace went over its rate limit. Wait for Retry-After seconds.

502upstream_error

WhatsApp did not accept the file.

503upstream_unavailable

A service behind the API is briefly unavailable. Safe to retry with backoff.

504timeout

The change did not finish in time. Retry with the same Idempotency-Key: it never runs twice.

Examples

An image header sample

Request body

{
  "url": "https://cdn.example.com/banner.png"
}

Response 200

{
  "handle": "4::aW1hZ2UvcG5n:ARbExample",
  "header_format": "IMAGE",
  "mime_type": "image/png",
  "bytes": 48213,
  "business_account_id": "4410",
  "business_account_name": "Main WhatsApp"
}

Operation path

The same operation is also at POST /v1/ops/messaging_upload_template_sample, with every field in the JSON body.