Sending
One request checks the customer, the recipient, the template, the daily limit and the credits, then queues the message.
POST /partner/messages
Idempotency-Key: invoice-1042-2026-12
{"external_id": "acc-1042", "to": "+905551112233",
"template": {"name": "invoice_ready", "language": "tr"},
"variables": {"body": {"2": "1 Aralık"}, "buttons": {"0": "inv-1042"}},
"header_media": {"link": "https://files.example/fatura.pdf", "filename": "fatura.pdf"}}This template has a document header, a body with {{1}} (the company name)
and {{2}}, and a URL button with a variable. Send only what your template
has: a value for a part it lacks is 422. A text header's variable is
"header": {"1": "Fatura"} in variables, without header_media.
- The customer is
customer_idorexternal_id(exactly one). variablesholds text values by variable name ({{first_name}}) or number ({{1}}), asGET /partner/templateslists them;buttonsfills URL buttons with a variable by position;header_mediais the https file of an image, video or document header.- Without
phone_number_idthe send goes from your only number in notification mode, else your default number.
The answer is 202 with the send (Send a template);
Get a send returns the same object
later, and List sends lists them
newest first (filter by customer, status and days).
{"id": "019a8c2e-…", "customer": {"id": "019a8c2e-…", "external_id": "acc-1042", "display_name": "Yıldız Muhasebe"},
"to": "+905551112233", "phone_number_id": "019a8c2e-…", "template": {"name": "invoice_ready", "language": "tr"},
"status": "queued", "wamid": null, "credits": {"amount": 2, "state": "reserved", "unlimited": false}, "error": null,
"created_at": "2026-12-02T09:00:00Z", "sent_at": null, "delivered_at": null, "read_at": null, "failed_at": null}status is queued, accepted (Meta took the request and has not
reported on it yet), sent, delivered, read, failed or unknown;
credits.state is reserved, consumed, released or free.
The checks, in order
All of it happens in one transaction; any refusal changes nothing (no credits are held, nothing is queued).
- Idempotency. A send made earlier with the same
Idempotency-Keyis returned (200). - Active customer, else
409 PARTNER_CUSTOMER_SUSPENDED. - Opt-outs. The recipient has not opted out of every customer or of
this one, else
422 RECIPIENT_OPTED_OUT. - Template. Approved on the sending number's account, and every
variable gets a value, else
422naming what is missing. - Cost from your tariff.
- Daily limit, else
429 PARTNER_DAILY_LIMIT. - Credits reserved, else
402 INSUFFICIENT_CREDITS. - The regular sender's checks, as for every message: the message
balance of a number connected through Messora's Meta app, else
402 MESSAGE_BALANCE_EXHAUSTED; and what is known about the recipient, else422 CONTACT_UNDELIVERABLE,CONTACT_OPTED_OUTorMARKETING_STOPPED(see Error codes). Then it is queued.
Idempotency
Idempotency-Key (8–200 characters) is required and unique per provider
for good, not only for a day:
- the same key and the same request returns the first send (
200), so a retry after a timeout never sends twice or charges twice; - the same key with a different request (another recipient, template,
customer or variables) is
409 IDEMPOTENCY_KEY_REUSED.
Use a key that names the notification in your system, e.g.
invoice-1042-2026-12.
The company name
Every send fills one template variable with the sub-customer's
display_name, so one template carries every customer's own name. The
variable is chosen in this order:
- a value the request gives for that variable always wins;
- the variable you chose for the template:
PUT /partner/templates/{templateName}/company-namewith{"variable": "body.1"}(header.<key>orbody.<key>, the key being the variable's name or number; for every language of the template;nullremoves the choice; a variable the template does not have is422); - without a choice, a header or body variable named
company_name(the body's first); - otherwise nothing is filled, and the request must give every value.
GET /partner/templates shows each template's choice as
company_name: {"variable": "body.1", "source": "mapped" | "convention" | "none"}.
The daily limit
Your number's quality rating and Meta's messaging limit are shared by all
your sub-customers. daily_limit on a sub-customer
(PATCH /partner/customers/{customerId}, 1–10,000,000, null removes it)
caps its sends per calendar day in your workspace's time zone.
A send over the limit is refused, not queued for later:
429 PARTNER_DAILY_LIMIT with details daily_limit and resets_at (the
start of the next day) and a Retry-After header with the seconds until
then. Sends whose credits were released (failed) do not count.
Opt-outs
A recipient on your opt-out list cannot be messaged:
- global (
customernull): from no sub-customer at all; - per customer: from that sub-customer only.
Record an opt-out adds one,
List opt-outs lists them and
Remove an opt-out
(DELETE /partner/opt-outs?phone=…[&customer_id=…]) removes the global one
or the customer's. A stop word the recipient sends records a global opt-out
(see Webhooks) and also ends their consent to marketing; removing the global
opt-out restores it.
Templates the Partner API cannot send
Templates that need what a send request does not carry are refused with
422: one-time passwords, copy-code buttons, Flows, limited-time offers,
carousels and location headers.