Criar template
curl --request POST \
--url https://pilotstatus.com.br/v1/templates \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "promo_cupom",
"category": "MARKETING",
"language": "pt_BR",
"body": {
"header": {
"type": "IMAGE",
"base64": "data:image/png;base64,..."
},
"body": {
"text": "Oi {{nome}}! Use e ganhe {{desconto}} de desconto."
},
"footer": {
"text": "Promoção por tempo limitado"
},
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Quero!"
},
{
"type": "URL",
"text": "Comprar",
"url": "https://loja.com/promo/{{link}}"
},
{
"type": "PHONE_NUMBER",
"text": "Falar",
"phone_number": "+5511999998888"
},
{
"type": "COPY_CODE",
"example": [
"PROMO10"
]
}
]
},
"examples": {
"nome": "Maria",
"desconto": "10%",
"link": "abc123"
}
}
'import requests
url = "https://pilotstatus.com.br/v1/templates"
payload = {
"name": "promo_cupom",
"category": "MARKETING",
"language": "pt_BR",
"body": {
"header": {
"type": "IMAGE",
"base64": "data:image/png;base64,..."
},
"body": { "text": "Oi {{nome}}! Use e ganhe {{desconto}} de desconto." },
"footer": { "text": "Promoção por tempo limitado" },
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Quero!"
},
{
"type": "URL",
"text": "Comprar",
"url": "https://loja.com/promo/{{link}}"
},
{
"type": "PHONE_NUMBER",
"text": "Falar",
"phone_number": "+5511999998888"
},
{
"type": "COPY_CODE",
"example": ["PROMO10"]
}
]
},
"examples": {
"nome": "Maria",
"desconto": "10%",
"link": "abc123"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'promo_cupom',
category: 'MARKETING',
language: 'pt_BR',
body: JSON.stringify({
header: {type: 'IMAGE', base64: 'data:image/png;base64,...'},
body: JSON.stringify({text: 'Oi {{nome}}! Use e ganhe {{desconto}} de desconto.'}),
footer: {text: 'Promoção por tempo limitado'},
buttons: [
{type: 'QUICK_REPLY', text: 'Quero!'},
{type: 'URL', text: 'Comprar', url: 'https://loja.com/promo/{{link}}'},
{type: 'PHONE_NUMBER', text: 'Falar', phone_number: '+5511999998888'},
{type: 'COPY_CODE', example: ['PROMO10']}
]
}),
examples: {nome: 'Maria', desconto: '10%', link: 'abc123'}
})
};
fetch('https://pilotstatus.com.br/v1/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pilotstatus.com.br/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([
'name' => 'promo_cupom',
'category' => 'MARKETING',
'language' => 'pt_BR',
'body' => [
'header' => [
'type' => 'IMAGE',
'base64' => 'data:image/png;base64,...'
],
'body' => [
'text' => 'Oi {{nome}}! Use e ganhe {{desconto}} de desconto.'
],
'footer' => [
'text' => 'Promoção por tempo limitado'
],
'buttons' => [
[
'type' => 'QUICK_REPLY',
'text' => 'Quero!'
],
[
'type' => 'URL',
'text' => 'Comprar',
'url' => 'https://loja.com/promo/{{link}}'
],
[
'type' => 'PHONE_NUMBER',
'text' => 'Falar',
'phone_number' => '+5511999998888'
],
[
'type' => 'COPY_CODE',
'example' => [
'PROMO10'
]
]
]
],
'examples' => [
'nome' => 'Maria',
'desconto' => '10%',
'link' => 'abc123'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://pilotstatus.com.br/v1/templates"
payload := strings.NewReader("{\n \"name\": \"promo_cupom\",\n \"category\": \"MARKETING\",\n \"language\": \"pt_BR\",\n \"body\": {\n \"header\": {\n \"type\": \"IMAGE\",\n \"base64\": \"data:image/png;base64,...\"\n },\n \"body\": {\n \"text\": \"Oi {{nome}}! Use e ganhe {{desconto}} de desconto.\"\n },\n \"footer\": {\n \"text\": \"Promoção por tempo limitado\"\n },\n \"buttons\": [\n {\n \"type\": \"QUICK_REPLY\",\n \"text\": \"Quero!\"\n },\n {\n \"type\": \"URL\",\n \"text\": \"Comprar\",\n \"url\": \"https://loja.com/promo/{{link}}\"\n },\n {\n \"type\": \"PHONE_NUMBER\",\n \"text\": \"Falar\",\n \"phone_number\": \"+5511999998888\"\n },\n {\n \"type\": \"COPY_CODE\",\n \"example\": [\n \"PROMO10\"\n ]\n }\n ]\n },\n \"examples\": {\n \"nome\": \"Maria\",\n \"desconto\": \"10%\",\n \"link\": \"abc123\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://pilotstatus.com.br/v1/templates")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"promo_cupom\",\n \"category\": \"MARKETING\",\n \"language\": \"pt_BR\",\n \"body\": {\n \"header\": {\n \"type\": \"IMAGE\",\n \"base64\": \"data:image/png;base64,...\"\n },\n \"body\": {\n \"text\": \"Oi {{nome}}! Use e ganhe {{desconto}} de desconto.\"\n },\n \"footer\": {\n \"text\": \"Promoção por tempo limitado\"\n },\n \"buttons\": [\n {\n \"type\": \"QUICK_REPLY\",\n \"text\": \"Quero!\"\n },\n {\n \"type\": \"URL\",\n \"text\": \"Comprar\",\n \"url\": \"https://loja.com/promo/{{link}}\"\n },\n {\n \"type\": \"PHONE_NUMBER\",\n \"text\": \"Falar\",\n \"phone_number\": \"+5511999998888\"\n },\n {\n \"type\": \"COPY_CODE\",\n \"example\": [\n \"PROMO10\"\n ]\n }\n ]\n },\n \"examples\": {\n \"nome\": \"Maria\",\n \"desconto\": \"10%\",\n \"link\": \"abc123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"promo_cupom\",\n \"category\": \"MARKETING\",\n \"language\": \"pt_BR\",\n \"body\": {\n \"header\": {\n \"type\": \"IMAGE\",\n \"base64\": \"data:image/png;base64,...\"\n },\n \"body\": {\n \"text\": \"Oi {{nome}}! Use e ganhe {{desconto}} de desconto.\"\n },\n \"footer\": {\n \"text\": \"Promoção por tempo limitado\"\n },\n \"buttons\": [\n {\n \"type\": \"QUICK_REPLY\",\n \"text\": \"Quero!\"\n },\n {\n \"type\": \"URL\",\n \"text\": \"Comprar\",\n \"url\": \"https://loja.com/promo/{{link}}\"\n },\n {\n \"type\": \"PHONE_NUMBER\",\n \"text\": \"Falar\",\n \"phone_number\": \"+5511999998888\"\n },\n {\n \"type\": \"COPY_CODE\",\n \"example\": [\n \"PROMO10\"\n ]\n }\n ]\n },\n \"examples\": {\n \"nome\": \"Maria\",\n \"desconto\": \"10%\",\n \"link\": \"abc123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "tpl_01HZX...",
"name": "promo_cupom",
"category": "MARKETING",
"metaStatus": "PENDING"
}{
"code": "TEMPLATE_EXAMPLES_REQUIRED",
"details": {
"missing": [
"nome"
]
}
}{
"error": "Unauthorized"
}{
"error": "Tenant-scoped keys cannot call number endpoints",
"code": "TENANT_SCOPE_NOT_ALLOWED"
}{
"error": "Too many requests"
}Autorizações
Sua chave de API ps_
Corpo
Nome do template (apenas letras/números; separadores viram _).
"promo_cupom"
Conteúdo do template: objeto { header?, body, footer?, buttons? } (recomendado), o mesmo JSON como string, ou texto puro (embrulhado automaticamente).
{ "body": { "text": "Oi {{nome}}!" } }
Cabeçalho opcional. TEXT: text com 0–1 variável (até 60 caracteres). IMAGE/VIDEO/DOCUMENT: informe url (http/https) OU base64 (data URI); base64 é re-hospedado no servidor. Sem cabeçalho de localização.
{
"type": "IMAGE",
"base64": "data:image/png;base64,..."
}
Rodapé opcional, até 60 caracteres, sem variáveis.
{ "text": "Promoção por tempo limitado" }
Até 10 botões: QUICK_REPLY (≤ 10; text), URL (≤ 2; text + url estática ou dinâmica com {{1}} no fim), PHONE_NUMBER (≤ 1; text + phone_number E.164), COPY_CODE (≤ 1; código em example). Quick-reply e CTA podem coexistir.
Show child attributes
Show child attributes
[
{
"type": "URL",
"text": "Comprar",
"url": "https://loja.com/promo/{{link}}"
},
{
"type": "COPY_CODE",
"example": ["PROMO10"]
}
]
Obrigatório quando há variáveis: mapeia cada variável usada no body/header (e na URL dinâmica) a um valor de amostra. O código do COPY_CODE vai em button.example, não aqui. Faltando → 400 TEMPLATE_EXAMPLES_REQUIRED.
Show child attributes
Show child attributes
{
"nome": "Maria",
"desconto": "10%",
"link": "abc123"
}
Categoria do template (padrão UTILITY).
"MARKETING"
Idioma do template (padrão pt_BR).
"pt_BR"
Resposta
Criar template completo
Esta página foi útil?
curl --request POST \
--url https://pilotstatus.com.br/v1/templates \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "promo_cupom",
"category": "MARKETING",
"language": "pt_BR",
"body": {
"header": {
"type": "IMAGE",
"base64": "data:image/png;base64,..."
},
"body": {
"text": "Oi {{nome}}! Use e ganhe {{desconto}} de desconto."
},
"footer": {
"text": "Promoção por tempo limitado"
},
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Quero!"
},
{
"type": "URL",
"text": "Comprar",
"url": "https://loja.com/promo/{{link}}"
},
{
"type": "PHONE_NUMBER",
"text": "Falar",
"phone_number": "+5511999998888"
},
{
"type": "COPY_CODE",
"example": [
"PROMO10"
]
}
]
},
"examples": {
"nome": "Maria",
"desconto": "10%",
"link": "abc123"
}
}
'import requests
url = "https://pilotstatus.com.br/v1/templates"
payload = {
"name": "promo_cupom",
"category": "MARKETING",
"language": "pt_BR",
"body": {
"header": {
"type": "IMAGE",
"base64": "data:image/png;base64,..."
},
"body": { "text": "Oi {{nome}}! Use e ganhe {{desconto}} de desconto." },
"footer": { "text": "Promoção por tempo limitado" },
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Quero!"
},
{
"type": "URL",
"text": "Comprar",
"url": "https://loja.com/promo/{{link}}"
},
{
"type": "PHONE_NUMBER",
"text": "Falar",
"phone_number": "+5511999998888"
},
{
"type": "COPY_CODE",
"example": ["PROMO10"]
}
]
},
"examples": {
"nome": "Maria",
"desconto": "10%",
"link": "abc123"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'promo_cupom',
category: 'MARKETING',
language: 'pt_BR',
body: JSON.stringify({
header: {type: 'IMAGE', base64: 'data:image/png;base64,...'},
body: JSON.stringify({text: 'Oi {{nome}}! Use e ganhe {{desconto}} de desconto.'}),
footer: {text: 'Promoção por tempo limitado'},
buttons: [
{type: 'QUICK_REPLY', text: 'Quero!'},
{type: 'URL', text: 'Comprar', url: 'https://loja.com/promo/{{link}}'},
{type: 'PHONE_NUMBER', text: 'Falar', phone_number: '+5511999998888'},
{type: 'COPY_CODE', example: ['PROMO10']}
]
}),
examples: {nome: 'Maria', desconto: '10%', link: 'abc123'}
})
};
fetch('https://pilotstatus.com.br/v1/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pilotstatus.com.br/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([
'name' => 'promo_cupom',
'category' => 'MARKETING',
'language' => 'pt_BR',
'body' => [
'header' => [
'type' => 'IMAGE',
'base64' => 'data:image/png;base64,...'
],
'body' => [
'text' => 'Oi {{nome}}! Use e ganhe {{desconto}} de desconto.'
],
'footer' => [
'text' => 'Promoção por tempo limitado'
],
'buttons' => [
[
'type' => 'QUICK_REPLY',
'text' => 'Quero!'
],
[
'type' => 'URL',
'text' => 'Comprar',
'url' => 'https://loja.com/promo/{{link}}'
],
[
'type' => 'PHONE_NUMBER',
'text' => 'Falar',
'phone_number' => '+5511999998888'
],
[
'type' => 'COPY_CODE',
'example' => [
'PROMO10'
]
]
]
],
'examples' => [
'nome' => 'Maria',
'desconto' => '10%',
'link' => 'abc123'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://pilotstatus.com.br/v1/templates"
payload := strings.NewReader("{\n \"name\": \"promo_cupom\",\n \"category\": \"MARKETING\",\n \"language\": \"pt_BR\",\n \"body\": {\n \"header\": {\n \"type\": \"IMAGE\",\n \"base64\": \"data:image/png;base64,...\"\n },\n \"body\": {\n \"text\": \"Oi {{nome}}! Use e ganhe {{desconto}} de desconto.\"\n },\n \"footer\": {\n \"text\": \"Promoção por tempo limitado\"\n },\n \"buttons\": [\n {\n \"type\": \"QUICK_REPLY\",\n \"text\": \"Quero!\"\n },\n {\n \"type\": \"URL\",\n \"text\": \"Comprar\",\n \"url\": \"https://loja.com/promo/{{link}}\"\n },\n {\n \"type\": \"PHONE_NUMBER\",\n \"text\": \"Falar\",\n \"phone_number\": \"+5511999998888\"\n },\n {\n \"type\": \"COPY_CODE\",\n \"example\": [\n \"PROMO10\"\n ]\n }\n ]\n },\n \"examples\": {\n \"nome\": \"Maria\",\n \"desconto\": \"10%\",\n \"link\": \"abc123\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://pilotstatus.com.br/v1/templates")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"promo_cupom\",\n \"category\": \"MARKETING\",\n \"language\": \"pt_BR\",\n \"body\": {\n \"header\": {\n \"type\": \"IMAGE\",\n \"base64\": \"data:image/png;base64,...\"\n },\n \"body\": {\n \"text\": \"Oi {{nome}}! Use e ganhe {{desconto}} de desconto.\"\n },\n \"footer\": {\n \"text\": \"Promoção por tempo limitado\"\n },\n \"buttons\": [\n {\n \"type\": \"QUICK_REPLY\",\n \"text\": \"Quero!\"\n },\n {\n \"type\": \"URL\",\n \"text\": \"Comprar\",\n \"url\": \"https://loja.com/promo/{{link}}\"\n },\n {\n \"type\": \"PHONE_NUMBER\",\n \"text\": \"Falar\",\n \"phone_number\": \"+5511999998888\"\n },\n {\n \"type\": \"COPY_CODE\",\n \"example\": [\n \"PROMO10\"\n ]\n }\n ]\n },\n \"examples\": {\n \"nome\": \"Maria\",\n \"desconto\": \"10%\",\n \"link\": \"abc123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"promo_cupom\",\n \"category\": \"MARKETING\",\n \"language\": \"pt_BR\",\n \"body\": {\n \"header\": {\n \"type\": \"IMAGE\",\n \"base64\": \"data:image/png;base64,...\"\n },\n \"body\": {\n \"text\": \"Oi {{nome}}! Use e ganhe {{desconto}} de desconto.\"\n },\n \"footer\": {\n \"text\": \"Promoção por tempo limitado\"\n },\n \"buttons\": [\n {\n \"type\": \"QUICK_REPLY\",\n \"text\": \"Quero!\"\n },\n {\n \"type\": \"URL\",\n \"text\": \"Comprar\",\n \"url\": \"https://loja.com/promo/{{link}}\"\n },\n {\n \"type\": \"PHONE_NUMBER\",\n \"text\": \"Falar\",\n \"phone_number\": \"+5511999998888\"\n },\n {\n \"type\": \"COPY_CODE\",\n \"example\": [\n \"PROMO10\"\n ]\n }\n ]\n },\n \"examples\": {\n \"nome\": \"Maria\",\n \"desconto\": \"10%\",\n \"link\": \"abc123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "tpl_01HZX...",
"name": "promo_cupom",
"category": "MARKETING",
"metaStatus": "PENDING"
}{
"code": "TEMPLATE_EXAMPLES_REQUIRED",
"details": {
"missing": [
"nome"
]
}
}{
"error": "Unauthorized"
}{
"error": "Tenant-scoped keys cannot call number endpoints",
"code": "TENANT_SCOPE_NOT_ALLOWED"
}{
"error": "Too many requests"
}