curl --request POST \
--url https://api.routa.chat/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channel": "chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"to": "+5581999999999",
"text": "Olá! Seu pedido foi confirmado."
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channel: 'chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ',
to: '+5581999999999',
text: 'Olá! Seu pedido foi confirmado.'
})
};
fetch('https://api.routa.chat/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.routa.chat/v1/messages"
payload = {
"channel": "chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"to": "+5581999999999",
"text": "Olá! Seu pedido foi confirmado."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.routa.chat/v1/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'channel' => 'chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ',
'to' => '+5581999999999',
'text' => 'Olá! Seu pedido foi confirmado.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.routa.chat/v1/messages"
payload := strings.NewReader("{\n \"channel\": \"chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ\",\n \"to\": \"+5581999999999\",\n \"text\": \"Olá! Seu pedido foi confirmado.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "msg_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"channel": "chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"direction": "outbound",
"origin": "api",
"from": "+5581988888888",
"to": "+5581999999999",
"content": {
"type": "text",
"body": "<string>"
},
"content_redacted_at": null,
"status": "accepted",
"failure_code": null,
"metadata": {},
"accepted_at": "2026-09-04T13:22:41.031Z",
"sent_at": "2026-09-04T13:22:41.031Z",
"delivered_at": "2026-09-04T13:22:41.031Z",
"read_at": null,
"failed_at": null
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}Enviar mensagem
Envia uma mensagem de texto ou de template por um canal.
A resposta é 202 Accepted: a mensagem foi gravada de forma durável, mas ainda não foi entregue. Acompanhe sent, delivered, read e failed por webhooks ou por GET /v1/messages/{id}.
Informe text ou template. Sem nenhum dos dois, a API retorna content_rejected. Com os dois, ela envia o template e ignora text. Envie o header Idempotency-Key para repetir a requisição com segurança. Veja Idempotência.
Um envio de template leva exatamente o que o template pede: um valor em body_parameters para cada variável do corpo, header_parameter quando o cabeçalho é um texto com variável ou uma mídia, e um item em button_parameters para cada botão de URL com variável. Um parâmetro ausente, sobrando, mal combinado ou vazio retorna 422 content_rejected, assim como um valor que o WhatsApp recusa. Veja Cabeçalho e botões.
A validação do canal, do destinatário, do template e do arquivo do cabeçalho acontece no aceite e retorna o erro imediatamente. Uma requisição recusada não grava a mensagem nem consome franquia. Um template importado e somente leitura retorna template_not_sendable.
curl --request POST \
--url https://api.routa.chat/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channel": "chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"to": "+5581999999999",
"text": "Olá! Seu pedido foi confirmado."
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channel: 'chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ',
to: '+5581999999999',
text: 'Olá! Seu pedido foi confirmado.'
})
};
fetch('https://api.routa.chat/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.routa.chat/v1/messages"
payload = {
"channel": "chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"to": "+5581999999999",
"text": "Olá! Seu pedido foi confirmado."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.routa.chat/v1/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'channel' => 'chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ',
'to' => '+5581999999999',
'text' => 'Olá! Seu pedido foi confirmado.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.routa.chat/v1/messages"
payload := strings.NewReader("{\n \"channel\": \"chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ\",\n \"to\": \"+5581999999999\",\n \"text\": \"Olá! Seu pedido foi confirmado.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "msg_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"channel": "chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"direction": "outbound",
"origin": "api",
"from": "+5581988888888",
"to": "+5581999999999",
"content": {
"type": "text",
"body": "<string>"
},
"content_redacted_at": null,
"status": "accepted",
"failure_code": null,
"metadata": {},
"accepted_at": "2026-09-04T13:22:41.031Z",
"sent_at": "2026-09-04T13:22:41.031Z",
"delivered_at": "2026-09-04T13:22:41.031Z",
"read_at": null,
"failed_at": null
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}Autorizações
Cabeçalhos
Chave única por mensagem lógica (um UUID v4, por exemplo). Repetir a requisição com a mesma chave e o mesmo corpo devolve a resposta original, com o header Idempotent-Replay: true. Uma chave reutilizada com outro corpo retorna 409 idempotency_key_reuse. O registro é mantido por 24 horas.
Corpo
Corpo da mensagem de texto, com até 4096 caracteres. É ignorado quando a requisição também traz template.
"Olá! Seu pedido foi confirmado."
Resposta
Aceito. O processamento é assíncrono
De onde veio uma mensagem outbound: api (enviada pela Routa) ou business_app (a empresa enviou pelo app do WhatsApp Business, em um número conectado em modo de coexistência). Uma mensagem business_app não é cobrada nem entra no uso. É null em uma mensagem inbound.
api, business_app "api"