curl --request POST https://api.routa.chat/v1/templates \
--header "Authorization: Bearer $ROUTA_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"channel": "chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"name": "order_confirmation",
"language": "en_US",
"category": "utility",
"body_text": "Hi {{1}}! Your order {{2}} is confirmed.",
"variable_examples": [
"Ana",
"1234"
],
"components": {
"buttons": [
{
"kind": "url",
"text": "Track order",
"url": "https://example.com/orders/{{1}}",
"example": "1234"
}
]
}
}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channel: 'chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ',
name: 'order_confirmation',
language: 'en_US',
category: 'utility',
body_text: 'Hi {{1}}! Your order {{2}} is confirmed.'
})
};
fetch('https://api.routa.chat/v1/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.routa.chat/v1/templates"
payload = {
"channel": "chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"name": "order_confirmation",
"language": "en_US",
"category": "utility",
"body_text": "Hi {{1}}! Your order {{2}} is confirmed."
}
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/templates",
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',
'name' => 'order_confirmation',
'language' => 'en_US',
'category' => 'utility',
'body_text' => 'Hi {{1}}! Your order {{2}} is confirmed.'
]),
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/templates"
payload := strings.NewReader("{\n \"channel\": \"chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ\",\n \"name\": \"order_confirmation\",\n \"language\": \"en_US\",\n \"category\": \"utility\",\n \"body_text\": \"Hi {{1}}! Your order {{2}} is confirmed.\"\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": "tmpl_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"channel": "chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"name": "order_confirmation",
"language": "en_US",
"category": "marketing",
"body_text": "Hi {{1}}! Your order {{2}} is confirmed.",
"variables": [
{
"index": 1,
"example": "Ana"
}
],
"status": "draft",
"rejection_reason": "abusive_content",
"failure_code": null,
"failure_detail": null,
"deletion_requested": false,
"deletion_failure_detail": null,
"origin": "routa",
"read_only": false,
"unsupported_components": [],
"created_at": "2026-09-04T13:22:41.031Z",
"updated_at": "2026-09-04T13:22:41.031Z",
"components": {
"header": {
"kind": "text",
"text": "<string>",
"example": "<string>"
},
"footer": {
"text": "<string>"
},
"buttons": [
{
"kind": "quick_reply",
"text": "<string>"
}
]
}
}{
"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": {}
}
}Create template
Creates a template and sends it to WhatsApp for approval. The provider decides on approval, in its own time. Follow it through the template.* events or by retrieving the template.
Only approved templates can be used in POST /v1/messages. See Templates.
Every variable needs an example, which WhatsApp reads when it reviews the template: variable_examples for the body, components.header.example for the variable of a text header and components.buttons[].example for each URL button with a variable (only the value that replaces {{1}}). No recipient receives the examples, but they are stored, returned by the API and sent in events and webhooks: do not use real personal data or tokens.
Routa refuses right away, with 422, what WhatsApp is already known to refuse. The error then points at the right field, instead of leaving you with a failed template minutes later. The error.param field says which part of the request failed.
| Rule | Error and error.param |
|---|---|
The name uses only a-z, 0-9 and _, up to 512 characters | template_name_invalid, name |
| The body has up to 1024 characters | template_components_invalid, body_text |
Variables are numbered in sequence starting at {{1}} | template_variables_invalid |
The body does not start or end with a {{n}} variable | template_variables_invalid |
| The text header has up to 60 characters and one variable | template_components_invalid, components.header |
| The footer has up to 60 characters | template_components_invalid, components.footer |
| At most 10 buttons, 1 phone button and 2 URL buttons | template_components_invalid, components.buttons |
| Quick reply buttons stay together, with no other button between them | template_components_invalid, components.buttons |
| Button text has up to 25 characters, the URL up to 2000 and the phone number up to 20 | template_components_invalid, components.buttons |
The {{1}} variable of a URL goes at its end, and the URL does not point to api.whatsapp.com | template_components_invalid, components.buttons |
An authentication template takes no buttons of its own | template_components_invalid, components.buttons |
| Every body variable has an example | template_variables_invalid, variable_examples or variable_examples.<position> |
| The header variable and the variable of each URL button have an example, and whatever has no variable takes no example | template_variables_invalid, components.header.example or components.buttons.<position>.example |
WhatsApp decides on approval. A rule Routa does not check can still lead to rejected or failed.
curl --request POST https://api.routa.chat/v1/templates \
--header "Authorization: Bearer $ROUTA_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"channel": "chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"name": "order_confirmation",
"language": "en_US",
"category": "utility",
"body_text": "Hi {{1}}! Your order {{2}} is confirmed.",
"variable_examples": [
"Ana",
"1234"
],
"components": {
"buttons": [
{
"kind": "url",
"text": "Track order",
"url": "https://example.com/orders/{{1}}",
"example": "1234"
}
]
}
}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channel: 'chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ',
name: 'order_confirmation',
language: 'en_US',
category: 'utility',
body_text: 'Hi {{1}}! Your order {{2}} is confirmed.'
})
};
fetch('https://api.routa.chat/v1/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.routa.chat/v1/templates"
payload = {
"channel": "chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"name": "order_confirmation",
"language": "en_US",
"category": "utility",
"body_text": "Hi {{1}}! Your order {{2}} is confirmed."
}
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/templates",
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',
'name' => 'order_confirmation',
'language' => 'en_US',
'category' => 'utility',
'body_text' => 'Hi {{1}}! Your order {{2}} is confirmed.'
]),
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/templates"
payload := strings.NewReader("{\n \"channel\": \"chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ\",\n \"name\": \"order_confirmation\",\n \"language\": \"en_US\",\n \"category\": \"utility\",\n \"body_text\": \"Hi {{1}}! Your order {{2}} is confirmed.\"\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": "tmpl_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"channel": "chan_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"name": "order_confirmation",
"language": "en_US",
"category": "marketing",
"body_text": "Hi {{1}}! Your order {{2}} is confirmed.",
"variables": [
{
"index": 1,
"example": "Ana"
}
],
"status": "draft",
"rejection_reason": "abusive_content",
"failure_code": null,
"failure_detail": null,
"deletion_requested": false,
"deletion_failure_detail": null,
"origin": "routa",
"read_only": false,
"unsupported_components": [],
"created_at": "2026-09-04T13:22:41.031Z",
"updated_at": "2026-09-04T13:22:41.031Z",
"components": {
"header": {
"kind": "text",
"text": "<string>",
"example": "<string>"
},
"footer": {
"text": "<string>"
},
"buttons": [
{
"kind": "quick_reply",
"text": "<string>"
}
]
}
}{
"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": {}
}
}Authorizations
Body
Template body, with positional placeholders {{1}}, {{2}}, …, up to 1024 characters. It cannot start or end with a variable.
"Hi {{1}}! Your order {{2}} is confirmed."
One example for each variable of body_text, the first one for {{1}}: the order of the numbers counts, not the order in the text. Required when the body has a variable, with exactly one item per variable, none empty or blank. Do not use real personal data or tokens.
["Ana", "1234"]
Response
Resource created
Approval state. Only approved allows sending. rejected means the provider reviewed the template and refused it. failed means Routa could not send it to the provider. A failed or rejected template can be edited and sent again in the dashboard, and then goes back to submitted.
draft, submitted, pending, approved, rejected, paused, disabled, failed Components of an imported template that Routa cannot reproduce. Empty when read_only is false.
named_parameters, media_header, location_header, carousel, flow_button, otp_button, copy_code_button, catalog, limited_time_offer, other []