Create Template

Templates

Create Template

Saves a WhatsApp template as a draft, after the console's own checks of WhatsApp's rules for the body, header, footer, buttons and an authentication template's code. Review is a separate, deliberate step — Submit Template, or submit: true here — because once a name is approved it can never be reused for different words; if that submission is refused, the draft is kept and message says why. Limited-time offers, carousels and buttons that open a WhatsApp form are made in the console. Needs a full key.

POST/templates

Headers

Katexs-Workspacestring
Developers only: the customer workspace this request acts in — its org_… id from POST /customers. Leave it out to act in your own workspace. Refused with 404 (Workspace not found.) when the id is unknown, is not one of your customers, or is not an org_… id; 410 when that customer was deleted (restore it with POST /customers/{id}/restore until it is erased); 403 when the key belongs to one customer workspace (it cannot act as another); 400 when your workspace is not a developer workspace. /customers/* and GET /customers/usage are your own workspace's and refuse the header with 400: call them without it.

Request body

namestringrequired
Lowercase letters, numbers and underscores only. Unique per language in your workspace.
languagestring
A language WhatsApp templates support, such as en, en_US or hi. Default: en.
categorystringrequired
utility for something the customer is expecting (an order or appointment update), marketing for promotions, authentication for one-time codes. One of: utility, marketing, authentication.
bodystring
The message, with blanks numbered {{1}}, {{2}} … in order. A blank cannot be at the very start or end, two cannot sit next to each other, and there must be enough words around them. Required unless category is authentication, where WhatsApp writes the body.
samplesstring[]
One example value per body blank, in order. WhatsApp's reviewers read the template with these filled in, so every blank needs one.
headerobject | null
The line or media above the body. null means no header.
header.kindstringrequired
What the header is. One of: none, text, image, video, document.
header.textstring
A text header's words. Required for text; no placeholders.
header.mediaUrlstring (uri)
For image, video or document: an https link to an example file WhatsApp's reviewers can fetch. Required for those kinds.
footerstring | null
One line of small print, with no blanks. A marketing template needs a way to opt out — "Reply STOP to opt out" here, or a quick-reply button.
buttonsobject[] | null
The template's buttons, in order.
authobject
An authentication template's settings. WhatsApp writes the message itself ("123456 is your verification code."), so these are all you choose.
auth.expiryMinutesinteger
How long the code is valid, shown as "Expires in 10 minutes." Default: 10. Range: 1–90.
auth.securityRecommendationboolean
Adds "For your security, do not share this code." Default: true.
auth.otpTypestring
copy_code: a button that copies the code. one_tap: fills it into your Android app, which needs supportedApps. One of: copy_code, one_tap. Default: copy_code.
auth.supportedAppsobject[]
Required for one_tap: the apps the code fills into.
agentstring | null
The agent the template belongs to (ag_…). Leave it out for the agent on your connected WhatsApp number (or your oldest agent).
submitboolean
true also sends it to WhatsApp for review, as Submit Template does. If that is refused, the draft is kept and message says why. Default: false.

Example request

bash
curl -X POST "https://app.katexs.com/api/v1/templates" \
  -H "Authorization: Bearer $KATEXS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "order_ready",
  "language": "en",
  "category": "utility",
  "body": "Hello {{1}}, your Kesar Naturals order {{2}} is packed and on its way.",
  "samples": [
    "Priya",
    "#10432"
  ],
  "footer": "Kesar Naturals, Jaipur",
  "buttons": [
    {
      "kind": "url",
      "label": "Track order",
      "url": "https://kesarnaturals.in/track/{{1}}",
      "sample": "10432"
    }
  ],
  "submit": false
}'

Responses

StatusDescription
201Saved. The template as Get Template shows it, plus message: saved as a draft, sent for review, or saved as a draft with the reason the submission was refused.
400A field is missing or has the wrong type, agent is not an agent id, submit is not a boolean, or the body carries an offer or carousel (made in the console). The message names the field.
401The key is missing, wrong or revoked. The answer is always the same, whichever it is.
403The key's access level (read-only or build) does not allow this request, the plan does not include it, or a customer's key named another workspace in Katexs-Workspace. code says which: key_scope_read, key_scope_build, workspace_header_forbidden, or forbidden.
404No agent with that id in this workspace.
409A template with this name and language already exists, or the workspace has no agent yet (a template belongs to one).
410The customer named in Katexs-Workspace was deleted. POST /customers/{id}/restore brings it back until its erase date.
422The template breaks one of WhatsApp's rules: placeholders out of order or at the very start or end, a missing example, too many blanks for the length, a footer or header over 60 characters, too many buttons of a kind, a marketing template with no way to opt out, or an authentication template's expiry or button.
429Over a per-minute limit. Wait for Retry-After seconds. code and limit say which limit: rate_limit_resources (240 requests a minute for the workspace), rate_limit_family (2,400 across a developer's customers), rate_limit_calls, rate_limit_messages, rate_limit_codes, rate_limit_code_recipient, concurrent_calls or number_daily_limit.

Response fields

namestringrequired
The template's name — what Send Message and Create Campaign take.
languagestringrequired
Its language code.
categorystringrequired
WhatsApp's category, which decides its price and its rules. One of: utility, marketing, authentication.
statusstringrequired
draft until submitted, pending while WhatsApp reviews it, then approved or rejected. WhatsApp may later pause an approved template that recipients flag. Only approved can be sent. One of: draft, pending, approved, rejected, paused.
agentstringrequired
The agent the template belongs to (ag_…).
bodystringrequired
The message, with {{1}}, {{2}} … for the blanks. For an authentication template, the sentence WhatsApp writes around the code.
variableCountintegerrequired
How many body values a send must carry, in order: the highest {{n}} in the body. Range: 0–.
variableLabelsobject[]required
The example given for each body blank.
buttonVariableCountintegerrequired
How many button values a send must carry: one per link button whose address ends in a blank. Range: 0–.
headerKindstringrequired
The header. image, video or document means a send must pass a media link for it. One of: none, text, image, video, document.
agentMaySendbooleanrequired
Whether an agent may send this template during a call or chat (its send_whatsapp tool). Only a Utility template with no blank in a link button can be. Every language of a name agrees. Change it with Update Template, sending agentMaySend alone.
createdAtstring (date-time)required
When it was created.
headerTextstring | nullrequired
A text header's words. null for any other header.
footerstringrequired
The footer line. Empty when there is none.
buttonsobject[]required
The template's buttons, in order.
reviewNotestring | nullrequired
Why WhatsApp refused it, when it did. null otherwise.
messagestringrequired
What happened: saved as a draft, sent for review, or — with submit: true — saved as a draft with the reason the submission was refused.
201 response
{
  "name": "order_ready",
  "language": "en",
  "category": "utility",
  "status": "draft",
  "agent": "ag_5c4a5f93-2b1e-4c0a-9d3f-7e8a1b2c3d4e",
  "body": "Hello {{1}}, your Kesar Naturals order {{2}} is packed and on its way.",
  "variableCount": 2,
  "variableLabels": [
    {
      "position": 1,
      "sample": "Priya"
    },
    {
      "position": 2,
      "sample": "#10432"
    }
  ],
  "buttonVariableCount": 1,
  "headerKind": "none",
  "agentMaySend": false,
  "createdAt": "2026-10-06T10:00:01.874Z",
  "headerText": null,
  "footer": "Kesar Naturals, Jaipur",
  "buttons": [
    {
      "kind": "url",
      "label": "Track order",
      "url": "https://kesarnaturals.in/track/{{1}}"
    }
  ],
  "reviewNote": null,
  "message": "Saved as a draft."
}

Last updated November 2026 · Found a problem? Email support@katexs.com