Editar un template existente
curl --request PATCH \
--url https://api.keebai.com/v1/templates/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channel_id": "<string>",
"name": "<string>",
"language": "<string>",
"components": [
{
"text": "<string>",
"buttons": [
{
"text": "<string>",
"url": "<string>",
"phone_number": "<string>",
"example": [
"<string>"
],
"flow_id": "<string>",
"coupon_code": "<string>",
"autofill_text": "<string>",
"package_name": "<string>",
"signature_hash": "<string>"
}
],
"example": {
"header_text": [
"<string>"
],
"header_text_named_params": [
{
"param_name": "nombre",
"example": "Juan"
}
],
"header_handle": [
"<string>"
],
"body_text": [
"<string>"
],
"body_text_named_params": [
{
"param_name": "nombre",
"example": "Juan"
}
]
},
"add_security_recommendation": true,
"code_expiration_minutes": 123
}
],
"metadata": {}
}
'import requests
url = "https://api.keebai.com/v1/templates/{id}"
payload = {
"channel_id": "<string>",
"name": "<string>",
"language": "<string>",
"components": [
{
"text": "<string>",
"buttons": [
{
"text": "<string>",
"url": "<string>",
"phone_number": "<string>",
"example": ["<string>"],
"flow_id": "<string>",
"coupon_code": "<string>",
"autofill_text": "<string>",
"package_name": "<string>",
"signature_hash": "<string>"
}
],
"example": {
"header_text": ["<string>"],
"header_text_named_params": [
{
"param_name": "nombre",
"example": "Juan"
}
],
"header_handle": ["<string>"],
"body_text": ["<string>"],
"body_text_named_params": [
{
"param_name": "nombre",
"example": "Juan"
}
]
},
"add_security_recommendation": True,
"code_expiration_minutes": 123
}
],
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channel_id: '<string>',
name: '<string>',
language: '<string>',
components: [
{
text: '<string>',
buttons: [
{
text: '<string>',
url: '<string>',
phone_number: '<string>',
example: ['<string>'],
flow_id: '<string>',
coupon_code: '<string>',
autofill_text: '<string>',
package_name: '<string>',
signature_hash: '<string>'
}
],
example: {
header_text: ['<string>'],
header_text_named_params: [{param_name: 'nombre', example: 'Juan'}],
header_handle: ['<string>'],
body_text: ['<string>'],
body_text_named_params: [{param_name: 'nombre', example: 'Juan'}]
},
add_security_recommendation: true,
code_expiration_minutes: 123
}
],
metadata: {}
})
};
fetch('https://api.keebai.com/v1/templates/{id}', 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://api.keebai.com/v1/templates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'channel_id' => '<string>',
'name' => '<string>',
'language' => '<string>',
'components' => [
[
'text' => '<string>',
'buttons' => [
[
'text' => '<string>',
'url' => '<string>',
'phone_number' => '<string>',
'example' => [
'<string>'
],
'flow_id' => '<string>',
'coupon_code' => '<string>',
'autofill_text' => '<string>',
'package_name' => '<string>',
'signature_hash' => '<string>'
]
],
'example' => [
'header_text' => [
'<string>'
],
'header_text_named_params' => [
[
'param_name' => 'nombre',
'example' => 'Juan'
]
],
'header_handle' => [
'<string>'
],
'body_text' => [
'<string>'
],
'body_text_named_params' => [
[
'param_name' => 'nombre',
'example' => 'Juan'
]
]
],
'add_security_recommendation' => true,
'code_expiration_minutes' => 123
]
],
'metadata' => [
]
]),
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.keebai.com/v1/templates/{id}"
payload := strings.NewReader("{\n \"channel_id\": \"<string>\",\n \"name\": \"<string>\",\n \"language\": \"<string>\",\n \"components\": [\n {\n \"text\": \"<string>\",\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"example\": [\n \"<string>\"\n ],\n \"flow_id\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"autofill_text\": \"<string>\",\n \"package_name\": \"<string>\",\n \"signature_hash\": \"<string>\"\n }\n ],\n \"example\": {\n \"header_text\": [\n \"<string>\"\n ],\n \"header_text_named_params\": [\n {\n \"param_name\": \"nombre\",\n \"example\": \"Juan\"\n }\n ],\n \"header_handle\": [\n \"<string>\"\n ],\n \"body_text\": [\n \"<string>\"\n ],\n \"body_text_named_params\": [\n {\n \"param_name\": \"nombre\",\n \"example\": \"Juan\"\n }\n ]\n },\n \"add_security_recommendation\": true,\n \"code_expiration_minutes\": 123\n }\n ],\n \"metadata\": {}\n}")
req, _ := http.NewRequest("PATCH", 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))
}HttpResponse<String> response = Unirest.patch("https://api.keebai.com/v1/templates/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"channel_id\": \"<string>\",\n \"name\": \"<string>\",\n \"language\": \"<string>\",\n \"components\": [\n {\n \"text\": \"<string>\",\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"example\": [\n \"<string>\"\n ],\n \"flow_id\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"autofill_text\": \"<string>\",\n \"package_name\": \"<string>\",\n \"signature_hash\": \"<string>\"\n }\n ],\n \"example\": {\n \"header_text\": [\n \"<string>\"\n ],\n \"header_text_named_params\": [\n {\n \"param_name\": \"nombre\",\n \"example\": \"Juan\"\n }\n ],\n \"header_handle\": [\n \"<string>\"\n ],\n \"body_text\": [\n \"<string>\"\n ],\n \"body_text_named_params\": [\n {\n \"param_name\": \"nombre\",\n \"example\": \"Juan\"\n }\n ]\n },\n \"add_security_recommendation\": true,\n \"code_expiration_minutes\": 123\n }\n ],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.keebai.com/v1/templates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channel_id\": \"<string>\",\n \"name\": \"<string>\",\n \"language\": \"<string>\",\n \"components\": [\n {\n \"text\": \"<string>\",\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"example\": [\n \"<string>\"\n ],\n \"flow_id\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"autofill_text\": \"<string>\",\n \"package_name\": \"<string>\",\n \"signature_hash\": \"<string>\"\n }\n ],\n \"example\": {\n \"header_text\": [\n \"<string>\"\n ],\n \"header_text_named_params\": [\n {\n \"param_name\": \"nombre\",\n \"example\": \"Juan\"\n }\n ],\n \"header_handle\": [\n \"<string>\"\n ],\n \"body_text\": [\n \"<string>\"\n ],\n \"body_text_named_params\": [\n {\n \"param_name\": \"nombre\",\n \"example\": \"Juan\"\n }\n ]\n },\n \"add_security_recommendation\": true,\n \"code_expiration_minutes\": 123\n }\n ],\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"language": "<string>",
"status": "<string>",
"category": "<string>",
"variables": [
"<string>"
],
"parameter_format": "<string>"
}Templates
PATCH /v1/templates/{id}
Edit an existing template: components, category, language, or status.
PATCH
/
v1
/
templates
/
{id}
Editar un template existente
curl --request PATCH \
--url https://api.keebai.com/v1/templates/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channel_id": "<string>",
"name": "<string>",
"language": "<string>",
"components": [
{
"text": "<string>",
"buttons": [
{
"text": "<string>",
"url": "<string>",
"phone_number": "<string>",
"example": [
"<string>"
],
"flow_id": "<string>",
"coupon_code": "<string>",
"autofill_text": "<string>",
"package_name": "<string>",
"signature_hash": "<string>"
}
],
"example": {
"header_text": [
"<string>"
],
"header_text_named_params": [
{
"param_name": "nombre",
"example": "Juan"
}
],
"header_handle": [
"<string>"
],
"body_text": [
"<string>"
],
"body_text_named_params": [
{
"param_name": "nombre",
"example": "Juan"
}
]
},
"add_security_recommendation": true,
"code_expiration_minutes": 123
}
],
"metadata": {}
}
'import requests
url = "https://api.keebai.com/v1/templates/{id}"
payload = {
"channel_id": "<string>",
"name": "<string>",
"language": "<string>",
"components": [
{
"text": "<string>",
"buttons": [
{
"text": "<string>",
"url": "<string>",
"phone_number": "<string>",
"example": ["<string>"],
"flow_id": "<string>",
"coupon_code": "<string>",
"autofill_text": "<string>",
"package_name": "<string>",
"signature_hash": "<string>"
}
],
"example": {
"header_text": ["<string>"],
"header_text_named_params": [
{
"param_name": "nombre",
"example": "Juan"
}
],
"header_handle": ["<string>"],
"body_text": ["<string>"],
"body_text_named_params": [
{
"param_name": "nombre",
"example": "Juan"
}
]
},
"add_security_recommendation": True,
"code_expiration_minutes": 123
}
],
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channel_id: '<string>',
name: '<string>',
language: '<string>',
components: [
{
text: '<string>',
buttons: [
{
text: '<string>',
url: '<string>',
phone_number: '<string>',
example: ['<string>'],
flow_id: '<string>',
coupon_code: '<string>',
autofill_text: '<string>',
package_name: '<string>',
signature_hash: '<string>'
}
],
example: {
header_text: ['<string>'],
header_text_named_params: [{param_name: 'nombre', example: 'Juan'}],
header_handle: ['<string>'],
body_text: ['<string>'],
body_text_named_params: [{param_name: 'nombre', example: 'Juan'}]
},
add_security_recommendation: true,
code_expiration_minutes: 123
}
],
metadata: {}
})
};
fetch('https://api.keebai.com/v1/templates/{id}', 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://api.keebai.com/v1/templates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'channel_id' => '<string>',
'name' => '<string>',
'language' => '<string>',
'components' => [
[
'text' => '<string>',
'buttons' => [
[
'text' => '<string>',
'url' => '<string>',
'phone_number' => '<string>',
'example' => [
'<string>'
],
'flow_id' => '<string>',
'coupon_code' => '<string>',
'autofill_text' => '<string>',
'package_name' => '<string>',
'signature_hash' => '<string>'
]
],
'example' => [
'header_text' => [
'<string>'
],
'header_text_named_params' => [
[
'param_name' => 'nombre',
'example' => 'Juan'
]
],
'header_handle' => [
'<string>'
],
'body_text' => [
'<string>'
],
'body_text_named_params' => [
[
'param_name' => 'nombre',
'example' => 'Juan'
]
]
],
'add_security_recommendation' => true,
'code_expiration_minutes' => 123
]
],
'metadata' => [
]
]),
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.keebai.com/v1/templates/{id}"
payload := strings.NewReader("{\n \"channel_id\": \"<string>\",\n \"name\": \"<string>\",\n \"language\": \"<string>\",\n \"components\": [\n {\n \"text\": \"<string>\",\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"example\": [\n \"<string>\"\n ],\n \"flow_id\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"autofill_text\": \"<string>\",\n \"package_name\": \"<string>\",\n \"signature_hash\": \"<string>\"\n }\n ],\n \"example\": {\n \"header_text\": [\n \"<string>\"\n ],\n \"header_text_named_params\": [\n {\n \"param_name\": \"nombre\",\n \"example\": \"Juan\"\n }\n ],\n \"header_handle\": [\n \"<string>\"\n ],\n \"body_text\": [\n \"<string>\"\n ],\n \"body_text_named_params\": [\n {\n \"param_name\": \"nombre\",\n \"example\": \"Juan\"\n }\n ]\n },\n \"add_security_recommendation\": true,\n \"code_expiration_minutes\": 123\n }\n ],\n \"metadata\": {}\n}")
req, _ := http.NewRequest("PATCH", 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))
}HttpResponse<String> response = Unirest.patch("https://api.keebai.com/v1/templates/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"channel_id\": \"<string>\",\n \"name\": \"<string>\",\n \"language\": \"<string>\",\n \"components\": [\n {\n \"text\": \"<string>\",\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"example\": [\n \"<string>\"\n ],\n \"flow_id\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"autofill_text\": \"<string>\",\n \"package_name\": \"<string>\",\n \"signature_hash\": \"<string>\"\n }\n ],\n \"example\": {\n \"header_text\": [\n \"<string>\"\n ],\n \"header_text_named_params\": [\n {\n \"param_name\": \"nombre\",\n \"example\": \"Juan\"\n }\n ],\n \"header_handle\": [\n \"<string>\"\n ],\n \"body_text\": [\n \"<string>\"\n ],\n \"body_text_named_params\": [\n {\n \"param_name\": \"nombre\",\n \"example\": \"Juan\"\n }\n ]\n },\n \"add_security_recommendation\": true,\n \"code_expiration_minutes\": 123\n }\n ],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.keebai.com/v1/templates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channel_id\": \"<string>\",\n \"name\": \"<string>\",\n \"language\": \"<string>\",\n \"components\": [\n {\n \"text\": \"<string>\",\n \"buttons\": [\n {\n \"text\": \"<string>\",\n \"url\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"example\": [\n \"<string>\"\n ],\n \"flow_id\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"autofill_text\": \"<string>\",\n \"package_name\": \"<string>\",\n \"signature_hash\": \"<string>\"\n }\n ],\n \"example\": {\n \"header_text\": [\n \"<string>\"\n ],\n \"header_text_named_params\": [\n {\n \"param_name\": \"nombre\",\n \"example\": \"Juan\"\n }\n ],\n \"header_handle\": [\n \"<string>\"\n ],\n \"body_text\": [\n \"<string>\"\n ],\n \"body_text_named_params\": [\n {\n \"param_name\": \"nombre\",\n \"example\": \"Juan\"\n }\n ]\n },\n \"add_security_recommendation\": true,\n \"code_expiration_minutes\": 123\n }\n ],\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"language": "<string>",
"status": "<string>",
"category": "<string>",
"variables": [
"<string>"
],
"parameter_format": "<string>"
}Updates an existing template. Internally syncs the changes with Meta when applicable (for example when editing
Same shape as
components or category). Only send the fields you want to change; the rest stays as-is.
Meta only allows editing templates in certain states (
APPROVED, REJECTED, or PAUSED, depending on the field). Editing a template in PENDING or IN_REVIEW may return 409 CONFLICT from upstream. If you need to change something critical before Meta approves it, it’s usually faster to create a new template with POST /v1/templates.Endpoint
PATCH https://api.keebai.com/v1/templates/{id}
Required scope
templates:update
Headers
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer kbai_pk_<token> |
Content-Type | Yes | application/json |
Path params
| Param | Type | Description |
|---|---|---|
id | string | Internal ObjectId of the template. This is the id returned by GET /v1/templates and POST /v1/templates. |
Body
| Field | Type | Required | Description |
|---|---|---|---|
channel_id | string | Yes | ObjectId of the channel that owns the template. Required by upstream to validate ownership. |
name | string | No | New name. Lowercase letters, numbers, and underscores only. Max 512. |
language | string | No | Language code. Max 10. |
category | string | No | MARKETING, UTILITY, or AUTHENTICATION. |
parameter_format | string | No | NAMED or POSITIONAL. |
components | array | No | Replaces the components list. Same structure as in POST /v1/templates. |
status | string | No | Status to force locally (PAUSED, DISABLED, etc.). Use with care. |
metadata | object | No | Free-form metadata. |
Example request
curl -X PATCH https://api.keebai.com/v1/templates/65f3a1b2c3d4e5f6a7b8c9d2 \
-H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "65f3a1b2c3d4e5f6a7b8c9d0",
"components": [
{
"type": "BODY",
"text": "Hola {{nombre}}, tu pedido por {{monto}} fue actualizado.",
"example": {
"body_text_named_params": [
{ "param_name": "nombre", "example": "Juan" },
{ "param_name": "monto", "example": "$15.000" }
]
}
}
]
}'
const resp = await fetch(
`https://api.keebai.com/v1/templates/${templateId}`,
{
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.KEEBAI_API_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
channel_id: "65f3a1b2c3d4e5f6a7b8c9d0",
components: [
{
type: "BODY",
text: "Hola {{nombre}}, tu pedido por {{monto}} fue actualizado.",
example: {
body_text_named_params: [
{ param_name: "nombre", example: "Juan" },
{ param_name: "monto", example: "$15.000" },
],
},
},
],
}),
},
);
const template = await resp.json();
import os, requests
resp = requests.patch(
f"https://api.keebai.com/v1/templates/{template_id}",
headers={
"Authorization": f"Bearer {os.environ['KEEBAI_API_TOKEN']}",
"Content-Type": "application/json",
},
json={
"channel_id": "65f3a1b2c3d4e5f6a7b8c9d0",
"components": [
{
"type": "BODY",
"text": "Hola {{nombre}}, tu pedido por {{monto}} fue actualizado.",
"example": {
"body_text_named_params": [
{"param_name": "nombre", "example": "Juan"},
{"param_name": "monto", "example": "$15.000"},
]
},
}
],
},
timeout=20,
)
resp.raise_for_status()
template = resp.json()
Response
200 OK
{
"id": "65f3a1b2c3d4e5f6a7b8c9d2",
"name": "welcome_v2",
"language": "es_CL",
"status": "PENDING",
"category": "UTILITY",
"parameter_format": "NAMED",
"variables": ["nombre", "monto"]
}
POST /v1/templates. If the edit triggered a fresh Meta review, status may sit in IN_REVIEW or PENDING until Meta approves it again.
400 / 401 / 403 / 404 / 409 / 429
Common cases:400 BAD_REQUEST: body validation.403 FORBIDDENwithcode: INSUFFICIENT_SCOPE: the PAT does not havetemplates:update.404 NOT_FOUND: the template does not exist or does not belong to your tenant.409 CONFLICT: Meta rejected the edit because the template is not in an editable state.502 UPSTREAM_ERROR: generic error from Meta.detailsdescribes the cause.
After editing components, poll
GET /v1/templates to confirm Meta has re-approved the template before continuing to send it in production.Authorizations
Personal Access Token con prefijo kbai_pk_. Generar desde el portal con permiso developer.manage_tokens.
Path Parameters
ObjectId del template
Body
application/json
ObjectId del canal WhatsApp dueño del template (requerido por upstream).
Maximum string length:
512Maximum string length:
10Available options:
MARKETING, UTILITY, AUTHENTICATION Available options:
NAMED, POSITIONAL Show child attributes
Show child attributes
Available options:
PENDING, IN_REVIEW, REJECTED, APPROVED, PAUSED, DISABLED, IN_APPEAL Was this page helpful?
⌘I