Create Code Template

One-time codes

Create Code Template

Saves an authentication template as a draft. WhatsApp writes the words; you choose how long the code lasts, whether to add "For your security, do not share this code.", and the button — copy_code (works everywhere) or one_tap (hands the code to your Android app, which needs apps). Nothing is sent to WhatsApp until Submit Code Template. A build key may do this.

POST/codes/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, digits and underscores, as WhatsApp allows. Unique with language.
languagestringrequired
A WhatsApp template language code. One of: en, hi, mr, bn, ta, te, kn, ml, gu, pa, ur, ar, es, pt_BR, fr, de, it, nl, ru, tr, id, ms, th, vi, fil, ja, ko, zh_CN, zh_TW, he, sw, en_GB, en_US.
expiryMinutesinteger
How long the code lasts. WhatsApp shows it to the customer in their own language. Default: 10. Range: 1–90.
securityRecommendationboolean
Adds "For your security, do not share this code." Default: true.
buttonstring
copy_code: the customer taps to copy, then pastes — works everywhere. one_tap: hands the code straight to your Android app; needs apps. One of: copy_code, one_tap. Default: copy_code.
appsobject[]
Required for one_tap: the Android apps the code may be handed to. Ignored for copy_code.
apps[].packageNamestringrequired
Your Android app's package name.
apps[].signatureHashstringrequired
Your app's signing-key hash, as WhatsApp's one-tap autofill asks for it.

Example request

bash
curl -X POST "https://app.katexs.com/api/v1/codes/templates" \
  -H "Authorization: Bearer $KATEXS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "login_code",
  "language": "en",
  "expiryMinutes": 10,
  "securityRecommendation": true,
  "button": "copy_code"
}'

Responses

StatusDescription
201The draft.
400A field is missing or out of range.
401The key is missing, wrong or revoked. The answer is always the same, whichever it is.
403The key's access level does not allow this, or the plan has no WhatsApp.
404The Katexs-Workspace header names a workspace that is unknown, is not one of your customers, or is not an org_… id. Always this one sentence, so a key cannot learn which ids exist in other accounts.
409A template with that name and language already exists, or the workspace has no agent yet.
410The customer named in Katexs-Workspace was deleted. POST /customers/{id}/restore brings it back until its erase date.
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

idstring (uuid)required
The template's id (a bare uuid).
namestringrequired
The template's name — what template on Send One-Time Code takes.
languagestringrequired
Its language code.
statusstringrequired
draft: yours to change. pending: with WhatsApp for review. approved: sends. rejected: see reviewNote. paused: WhatsApp paused it. One of: draft, pending, approved, rejected, paused.
reviewNotestring | nullrequired
WhatsApp's reason, when it gave one.
settingsobject | nullrequired
The three choices. Null only for a template saved before these settings existed.
previewobject | nullrequired
What the customer reads, in WhatsApp's words, with a sample code.
agentstringrequired
The agent the template belongs to (ag_…).
createdAtstring (date-time)required
When it was created.
201 response
{
  "id": "5e1d8c3b-7a2f-4d96-b4e0-9c6a2f1d8e73",
  "name": "login_code",
  "language": "en",
  "status": "draft",
  "reviewNote": null,
  "settings": {
    "expiryMinutes": 10,
    "securityRecommendation": true,
    "button": "copy_code",
    "apps": []
  },
  "preview": {
    "body": "*123456* is your verification code. For your security, do not share this code.",
    "footer": "Expires in 10 minutes."
  },
  "agent": "ag_2c7e9a14-5b3d-4f8e-a1c6-7d9b0e3f5a21",
  "createdAt": "2026-10-06T10:02:17.904Z"
}

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