POST/v1/messages
Send a WhatsApp message.
Needs the messages:send scope.
Text can be sent while the customer's 24-hour window is open (they wrote to you in the last 24 hours); otherwise send an approved template (window_closed, 409). The message is queued (status queued) and sent at once; read it again or listen for message.status to follow it. 201: a new message. 200: this Idempotency-Key was used before — the first message is returned. Other errors: number_required (400), invalid_template (400), template_not_approved, quota_reached, number_not_connected, idempotency_key_reused (409).
Parameters
Idempotency-Keystring, in the headerrequired
Request body (JSON)
tostringrequiredThe recipient's phone number with its country code, like +14155550123.
number_idstring (uuid)The number to send from (GET /v1/numbers). May be left out when the workspace has exactly one.
typestringrequiredOne of:
text,templatetextstringFor type text: up to 4,096 characters.
template_idstring (uuid)For type template: an approved template (GET /v1/templates).
template_componentslist of objectThe template's variables, in WhatsApp's components format.
namestringStored as the contact's name when the contact is new.
Answers
- 200 OK
- 201 Created
- 400 Invalid request
- 401 Missing or invalid API key
- 403 Not allowed
- 409 Not possible right now
- 429 Too many requests
curl -X POST "https://api.zotrion.com/v1/messages" \
-H "Authorization: Bearer $ZOTRION_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-1042-ready" \
-d '{
"to": "+14155550123",
"type": "text",
"text": "Hi! Your jacket is ready for pickup.",
"name": "Sara Kim"
}'const res = await fetch("https://api.zotrion.com/v1/messages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ZOTRION_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": "order-1042-ready",
},
body: JSON.stringify({
"to": "+14155550123",
"type": "text",
"text": "Hi! Your jacket is ready for pickup.",
"name": "Sara Kim"
}),
});
const data = await res.json();import os
import requests
res = requests.post(
"https://api.zotrion.com/v1/messages",
headers={
"Authorization": f"Bearer {os.environ['ZOTRION_API_KEY']}",
"Content-Type": "application/json",
"Idempotency-Key": "order-1042-ready",
},
json={
"to": "+14155550123",
"type": "text",
"text": "Hi! Your jacket is ready for pickup.",
"name": "Sara Kim"
},
)
data = res.json() if res.content else None{
"id": "0b6f0f7a-1111-4222-8333-444455556666",
"conversation_id": "5d2c8e31-7a44-4b0e-9f21-6a1c0d8e7b52",
"direction": "in",
"origin": "customer",
"type": "text",
"body": "Hi! Your jacket is ready for pickup.",
"status": "queued",
"error": {
"code": "invalid_request",
"message": "A plain-words explanation of what went wrong."
},
"media": {
"id": "0b6f0f7a-1111-4222-8333-444455556666",
"mime": "image/jpeg",
"filename": "jacket.jpg",
"size_bytes": 48213,
"available": true
},
"template_id": "e7b2d4a1-93c6-4f08-a5d1-8b6c3e9f0a74",
"sent_by_user_id": "0b6f0f7a-1111-4222-8333-444455556666",
"timestamp": "2026-11-22T10:15:00Z"
}