Enviar mídia de cabeçalho
curl --request POST \
--url https://api.routa.chat/v1/templates/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/octet-stream' \
--data '<string>'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/octet-stream'},
body: '<string>'
};
fetch('https://api.routa.chat/v1/templates/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.routa.chat/v1/templates/media"
payload = "<string>"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/octet-stream"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.routa.chat/v1/templates/media",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "<string>",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/octet-stream"
],
]);
$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/media"
payload := strings.NewReader("<string>")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/octet-stream")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "tmedia_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"format": "image",
"size_bytes": 123,
"content_type": "image/png",
"created_at": "2026-09-04T13:22:41.031Z"
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "<string>",
"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": "<string>",
"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": "<string>",
"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": "<string>",
"doc_url": "<string>",
"details": {}
}
}Templates
Enviar mídia de cabeçalho
Envia uma imagem, um vídeo ou um documento para usar como cabeçalho de um template. Envie os bytes do arquivo diretamente no corpo, com o Content-Type do arquivo. O formato é deduzido do tipo.
| Formato | Tipos aceitos | Tamanho máximo |
|---|---|---|
image | image/jpeg, image/png | 5 MB |
video | video/mp4 | 16 MB |
document | application/pdf | 100 MB |
Use o id retornado em components.header.media_id ao submeter o template.
POST
/
v1
/
templates
/
media
Enviar mídia de cabeçalho
curl --request POST \
--url https://api.routa.chat/v1/templates/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/octet-stream' \
--data '<string>'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/octet-stream'},
body: '<string>'
};
fetch('https://api.routa.chat/v1/templates/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.routa.chat/v1/templates/media"
payload = "<string>"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/octet-stream"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.routa.chat/v1/templates/media",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "<string>",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/octet-stream"
],
]);
$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/media"
payload := strings.NewReader("<string>")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/octet-stream")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "tmedia_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"format": "image",
"size_bytes": 123,
"content_type": "image/png",
"created_at": "2026-09-04T13:22:41.031Z"
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "<string>",
"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": "<string>",
"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": "<string>",
"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": "<string>",
"doc_url": "<string>",
"details": {}
}
}Authorizations
Chave de API do projeto, no formato rt_live_... ou rt_test_..., enviada como Authorization: Bearer <chave>.
Body
application/octet-stream
Os bytes do arquivo, com o Content-Type do arquivo (por exemplo image/png).
The body is of type file.
Response
Recurso criado
Identificador da mídia de cabeçalho. Use-o em components.header.media_id.
Example:
"tmedia_01J8ZK9M3Q7XABCDEFGHJKMNPQ"
Formato: image, video ou document.
Available options:
image, video, document Tamanho do arquivo, em bytes.
Tipo MIME do arquivo.
Example:
"image/png"
Quando o arquivo foi enviado.
Example:
"2026-09-04T13:22:41.031Z"