Skip to main content
POST /v1/messages sends a message through a channel. This guide covers sending text. For templates, see Send a template.
Required scope: messages:write.

Request

Provide one of text and template. With neither, the API returns 422 content_rejected.
Do not send both together. The API does not refuse the request: it sends the template and ignores text.

Response

The API responds 202 Accepted with the message in the accepted state:
Store the id. It is the key to retrieve the message and to correlate delivery events. Every response also carries the Routa-Request-Id header; quote it when you contact support.

Avoid duplicates

If the network fails after you send the request, you do not know whether it arrived. Resending carelessly could create two messages. To avoid that, send a unique Idempotency-Key per logical message:
  • Use a UUID v4 and generate it once, before the first attempt. Reuse the same key on every retry.
  • A second request with the same key and the same body returns the original response, with the Idempotent-Replay: true header.
  • Reusing the key with a different body returns 409 idempotency_key_reuse.
The SDK generates and reuses the key automatically. Details in Idempotency.

Common errors

See Errors for the full format.

Next step

The message was accepted, not delivered. Track delivery with webhooks.