Crear un template de WhatsApp y enviarlo a Meta para aprobación
Templates
POST /v1/templates
Create a WhatsApp template and submit it to Meta for approval.
POST
Crear un template de WhatsApp y enviarlo a Meta para aprobación
Creates a template on the given WhatsApp channel and submits it to Meta for review. The response includes the template’s internal
Structure of
id and the status it landed in. Until Meta approves the template, you can’t use it in POST /v1/messages/template — use GET /v1/templates to check when it becomes APPROVED.
Endpoint
Required scope
templates:create
Headers
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer kbai_pk_<token> |
Content-Type | Yes | application/json |
Body
| Field | Type | Required | Description |
|---|---|---|---|
channel_id | string | Yes | ObjectId of the WhatsApp channel where the template is created. |
name | string | Yes | Template name. Lowercase letters, numbers, and underscores only. Max 512. |
language | string | Yes | Language code (es, es_CL, en_US, etc.). Max 10. |
category | string | Yes | MARKETING, UTILITY, or AUTHENTICATION. |
parameter_format | string | No | NAMED (recommended) or POSITIONAL. |
components | array | Yes | Template components. Same structure as Meta’s. |
metadata | object | No | Free-form metadata attached to the template. |
Structure of components[]
| Field | Type | Description |
|---|---|---|
type | string | HEADER, BODY, FOOTER, or BUTTONS. |
format | string | Only for HEADER: TEXT, IMAGE, VIDEO, or DOCUMENT. |
text | string | Component text. BODY supports {{name}} variables. Max 1024. |
buttons | array | Only for type: BUTTONS. Each button has type (QUICK_REPLY, URL, PHONE_NUMBER, FLOW, VOICE_CALL, COPY_CODE, OTP) and text (max 25). |
example | object | Variable examples Meta requires when reviewing (body_text, body_text_named_params, header_text, header_handle). |
add_security_recommendation | boolean | Only for authentication templates. |
code_expiration_minutes | number | Only for authentication templates. |
Example request
Response
201 Created
| Field | Type | Description |
|---|---|---|
id | string | Internal ObjectId of the newly created template. |
name | string | Name as it was registered. |
language | string | Language code. |
status | string | Initial status reported by Meta (PENDING or IN_REVIEW right after creation). |
category | string | Assigned category. |
parameter_format | string | NAMED or POSITIONAL. |
variables | string[] | Named variables detected in the body. |
400 / 401 / 403 / 404 / 409 / 429
Standard errors. Common cases:400 BAD_REQUEST: body validation (invalid characters in name, malformed components, missingexamplewhen Meta requires it).403 FORBIDDENwithcode: INSUFFICIENT_SCOPE: the PAT does not havetemplates:create.404 NOT_FOUND: thechannel_iddoes not belong to your tenant or does not exist.409 CONFLICT: a template with the samename+languagealready exists on that channel.502 UPSTREAM_ERROR: Meta rejected the creation. Thedetailsfield explains why.
Authorizations
Personal Access Token con prefijo kbai_pk_. Generar desde el portal con permiso developer.manage_tokens.
Body
application/json
ObjectId del canal WhatsApp donde se crea el template.
Nombre del template. Solo minúsculas, números y guiones bajos.
Maximum string length:
512Example:
"welcome_v2"
Maximum string length:
10Example:
"es_CL"
Available options:
MARKETING, UTILITY, AUTHENTICATION Available options:
NAMED, POSITIONAL