Skip to main content

What it does

Creates a new WhatsApp message template and submits it to Meta for approval. On success the Meta ID is returned and the template is written through to the local DB (best-effort; the request does not fail even if the DB write fails). A newly created template’s status is usually PENDING.

Endpoint

There are no query parameters.

Headers

Authorization
string
required
Secret key in Bearer sk_... format. See Secret Key authentication.
Content-Type
string
required
Always application/json.

Path parameters

app_id
string
required
Application ID. Must belong to the organization (otherwise 404).

Request Body

Top-level fields

name
string
required
Template name (max 512 chars). Pattern: ^[a-z][a-z0-9_]*$ (must start with a lowercase letter; lowercase letters, digits, and underscores only). Must be unique.
language
string
required
Language code (BCP-47), e.g. tr, en, en_US.
category
string
required
See Template Category. Determines the component rules (see the Category rules section below).
header
object | null
Header component. See the header object below.
body
object
required
Body component. See the body object below.
Footer component. See the footer object below.
buttons
array | null
List of buttons (max 10). See the buttons object below.
allowCategoryChange
boolean | null
If true, Meta may automatically re-classify the template’s category.
messageSendTtlSeconds
integer | null
Message time-to-live. UTILITY: 30–43200, MARKETING: 43200–2592000, AUTHENTICATION: 30–900 (or -1).

header object

format
string
One of NONE (default), TEXT, IMAGE, VIDEO, DOCUMENT, LOCATION.
text
string
Only for TEXT headers (max 60 chars). Cannot start or end with a variable.
examples
string | string[]
Variable example for a TEXT header; for media headers, the uploaded media handle.

body object

text
string
Body text (max 1024 chars); supports {{1}}, {{2}} variables. Cannot start or end with a variable. Required for UTILITY/MARKETING.
examples
string[]
Example values for the variables (order matters). The count must equal the number of variables.
addSecurityRecommendation
boolean
AUTHENTICATION only; adds the security recommendation text.
text
string
Footer text (max 60 chars). Cannot be used in AUTHENTICATION.
codeExpirationMinutes
integer
AUTHENTICATION only (1–90); the code validity duration.

buttons object

Each item in the buttons array:
type
string
One of QUICK_REPLY, URL, PHONE_NUMBER, COPY_CODE, OTP.
text
string
Button text (2–25 chars). Required for URL / PHONE_NUMBER / QUICK_REPLY.
url
string
URL type target link (https://...); can be dynamic using {{1}}.
phoneNumber
string
PHONE_NUMBER type phone in E.164 format.
example
string[]
Dynamic URL example, or the COPY_CODE coupon code (required for COPY_CODE).
otpType
string
For OTP: one of COPY_CODE, ONE_TAP, ZERO_TAP.
autofillText
string
ONE_TAP / ZERO_TAP autofill text (max 25 chars).
packageName
string
ONE_TAP / ZERO_TAP Android package name.
signatureHash
string
ONE_TAP / ZERO_TAP signature hash.
zeroTapTermsAccepted
boolean
ZERO_TAP terms acceptance.

Category rules

AUTHENTICATION — no header; no body.text (only addSecurityRecommendation); no footer.text (only codeExpirationMinutes); buttons may only be OTP.
UTILITY / MARKETINGbody.text is required; addSecurityRecommendation and codeExpirationMinutes cannot be used; OTP buttons are not allowed; COPY_CODE is allowed in MARKETING only.
The body/header cannot start or end with a variable, and the number of examples must equal the number of variables.

Response

The envelope is { "data": {...}, "isSuccess": true } (HTTP 200). The data is a lean creation response:
isSuccess
boolean
true when the template was created and submitted.
data
object
The create response does not return components, qualityScore, rejectedReason, parameterFormat, or the DB id — use Get Template Detail or Get Templates for those.

Examples


Errors

errors
object
Error details with code, group, and description; isSuccess is false.

Auth / tenant

Request validation (before reaching Meta, 422)

Meta-side (create_template_async)