Skip to Content

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_id or external_id (exactly one).
  • variables holds text values by variable name ({{first_name}}) or number ({{1}}), as GET /partner/templates lists them; buttons fills URL buttons with a variable by position; header_media is the https file of an image, video or document header.
  • Without phone_number_id the 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).

  1. Idempotency. A send made earlier with the same Idempotency-Key is returned (200).
  2. Active customer, else 409 PARTNER_CUSTOMER_SUSPENDED.
  3. Opt-outs. The recipient has not opted out of every customer or of this one, else 422 RECIPIENT_OPTED_OUT.
  4. Template. Approved on the sending number's account, and every variable gets a value, else 422 naming what is missing.
  5. Cost from your tariff.
  6. Daily limit, else 429 PARTNER_DAILY_LIMIT.
  7. Credits reserved, else 402 INSUFFICIENT_CREDITS.
  8. 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, else 422 CONTACT_UNDELIVERABLE, CONTACT_OPTED_OUT or MARKETING_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:

  1. a value the request gives for that variable always wins;
  2. the variable you chose for the template: PUT /partner/templates/{templateName}/company-name with {"variable": "body.1"} (header.<key> or body.<key>, the key being the variable's name or number; for every language of the template; null removes the choice; a variable the template does not have is 422);
  3. without a choice, a header or body variable named company_name (the body's first);
  4. 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 (customer null): 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.

On this page