Skip to content
Chatwise
Skip to Content
Developer docs

Create a WhatsApp template

POST /v1/whatsapp/templates. Creates a WhatsApp template and submits it to Meta for review, on the WhatsApp Business Account of the workspace's oldest connected number.

View as Markdown

POSThttps://api.chatwise.so/v1/whatsapp/templates

Creates a WhatsApp template and submits it to Meta for review, on the WhatsApp Business Account of the workspace's oldest connected number.

Send an Idempotency-Key with each new template and reuse it, with the same body, when you retry. A repeat answers 200 with the same template. Without the header, two identical submissions count as a repeat too.

The API key needs the templates:write scope. See authentication and scopes.

Example

curl -X POST 'https://api.chatwise.so/v1/whatsapp/templates' \
  -H "Authorization: Bearer $CHATWISE_API_KEY" \
  -H 'Idempotency-Key: order-ready-en-us-v1' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "order_ready",
  "language": "en_US",
  "category": "UTILITY",
  "parameterFormat": "NAMED",
  "components": {
    "body": {
      "text": "Your order {{order_number}} is ready to collect.",
      "examples": {
        "order_number": "A-1042"
      }
    }
  }
}'

Headers

NameTypeDescription
Idempotency-KeystringA key you choose for this template: 1 to 128 letters, digits, dots, underscores, hyphens or colons.

Body

JSON. Unknown fields are refused with a 400.

FieldTypeDescription
namestringRequired. Lowercase letters, digits and underscores, up to 100 characters. Spaces around it are ignored.
languagestringRequired. The language code, such as en_US. Each translation is a template of its own. Spaces around it are ignored.
categorystringRequired. UTILITY, MARKETING or AUTHENTICATION.
parameterFormatstringOnly when category is UTILITY or MARKETING. How variables are written: NAMED ({{order_number}}) or POSITIONAL ({{1}}). Default: NAMED.
componentsobjectRequired when category is UTILITY or MARKETING. What the template contains.
components.headerobjectA text header, or a media header with a sample.
components.header.formatstringRequired. The header's kind. One of TEXT, IMAGE, VIDEO, DOCUMENT.
components.header.textstringRequired when format is TEXT. The text, with at most one variable, which can't be at its start or end. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 60 characters.
components.header.examplesobjectOnly when format is TEXT. A sample value for the variable, by its name or number. At most 100 entries.
components.header.exampleMediaHandlestringRequired when format is IMAGE, VIDEO, or DOCUMENT. Meta's handle for a sample file. This API can't create one. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 2048 characters.
components.bodyobjectRequired. The message.
components.body.textstringRequired. The text. Variables must be inside it, not at its start or end. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 1024 characters.
components.body.examplesobjectA sample value for each variable, by its name or number. At most 100 entries.
components.footerstringFixed text below the body. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 60 characters.
components.buttonsarray of objectsUp to 10 buttons.
components.buttons[].typestringRequired. The button's kind. One of QUICK_REPLY, PHONE_NUMBER, URL.
components.buttons[].textstringRequired. The button's label. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 25 characters.
components.buttons[].phoneNumberstringRequired when type is PHONE_NUMBER. The number to call: 8 to 15 digits, with or without a +.
components.buttons[].urlstringRequired when type is URL. The page to open. It may end with one variable. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 2000 characters.
components.buttons[].exampleUrlstringOnly when type is URL. A complete sample URL, when the URL has a variable. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 2000 characters.
authenticationobjectRequired when category is AUTHENTICATION. Settings of an authentication template. Its text and copy code button are WhatsApp's own.
authentication.codeExpirationMinutesintegerRequired. How long the code is valid, from 1 to 90.
authentication.addSecurityRecommendationbooleanWhether to tell the customer not to share the code. Default: false.
authentication.buttonTextstringThe copy button's label. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates. At most 25 characters. Default: Copy Code.

Response

201. Submitted to Meta.

{
  "data": {
    "id": "123456789012345",
    "name": "order_ready",
    "language": "en_US",
    "category": "UTILITY",
    "status": "PENDING",
    "rejectionReason": null,
    "sendable": false,
    "parameterFormat": "NAMED",
    "requiresOtp": false,
    "authentication": null,
    "components": {
      "header": null,
      "body": {
        "text": "Your order {{order_number}} is ready to collect.",
        "variables": [
          "order_number"
        ]
      },
      "footer": null,
      "buttons": []
    },
    "unsupportedReason": null,
    "createdAt": "2026-11-19T09:00:00.000Z",
    "updatedAt": "2026-11-19T09:00:00.000Z"
  }
}
FieldTypeDescription
data.idstringThe template's id: Meta's, or Chatwise's for an older template without one. Send it as templateId.
data.namestringThe template's name.
data.languagestringThe template's language code, such as en_US.
data.categorystring or nullThe template's category.
data.statusstring or nullMeta's review status, such as APPROVED, PENDING, REJECTED or PAUSED.
data.rejectionReasonstring or nullWhy Meta rejected it, when it is rejected.
data.sendablebooleanWhether the send routes can send it: approved, with a layout they support.
data.parameterFormatstring or nullHow its variables are written. Null without variables.
data.requiresOtpbooleanWhether sending it needs a one-time code, as the otp value in templateParams.
data.authenticationobject or nullSettings of an authentication template. Otherwise null.
data.authentication.addSecurityRecommendationboolean or nullWhether it tells the customer not to share the code.
data.authentication.codeExpirationMinutesnumber or nullHow long it says the code is valid.
data.componentsobjectWhat the template contains.
data.components.headerobject or nullThe header, if any.
data.components.header.formatstringTEXT, IMAGE, VIDEO or DOCUMENT.
data.components.header.textstring or nullThe text of a text header.
data.components.header.variablesarray of stringsThe header's variables.
data.components.bodyobjectThe body.
data.components.body.textstring or nullThe body's text.
data.components.body.variablesarray of stringsThe body's variables.
data.components.footerstring or nullThe footer's text, if any.
data.components.buttonsarray of objectsThe buttons.
data.components.buttons[].indexintegerThe button's position, from 0. Use it as index when sending.
data.components.buttons[].typestringThe button's type, such as URL, QUICK_REPLY, PHONE_NUMBER, COPY_CODE or OTP.
data.components.buttons[].textstring or nullThe button's label.
data.components.buttons[].urlstring or nullThe URL of a URL button.
data.components.buttons[].phoneNumberstring or nullThe phone number of a PHONE_NUMBER button.
data.components.buttons[].variablestring or nullThe variable at the end of a dynamic URL, if any.
data.components.buttons[].parameterTypestring or nullThe parameter the button takes when sending, if any.
data.components.buttons[].otpTypestring or nullThe kind of one-time code button, on authentication templates.
data.unsupportedReasonstring or nullWhy the send routes can't send it, if they can't because of its layout.
data.createdAtstringWhen Chatwise stored the template. ISO 8601, in UTC.
data.updatedAtstringWhen the template last changed in Chatwise. ISO 8601, in UTC.

200. A repeat of an earlier submission, with the template as it is now.

{
  "data": {
    "id": "123456789012345",
    "name": "order_ready",
    "language": "en_US",
    "category": "UTILITY",
    "status": "APPROVED",
    "rejectionReason": null,
    "sendable": true,
    "parameterFormat": "NAMED",
    "requiresOtp": false,
    "authentication": null,
    "components": {
      "header": null,
      "body": {
        "text": "Your order {{order_number}} is ready to collect.",
        "variables": [
          "order_number"
        ]
      },
      "footer": null,
      "buttons": []
    },
    "unsupportedReason": null,
    "createdAt": "2026-11-19T09:00:00.000Z",
    "updatedAt": "2026-11-19T09:05:00.000Z"
  }
}

Errors

StatusMessageWhat it means
400Expected property name or '}' in JSON at position 1 (line 1 column 2)The request body isn't valid JSON. The message says where.
400Validation failedA parameter or body field is missing, unknown or malformed. errors lists each one.
400Provide one sample value for each placeholderThe definition breaks one of WhatsApp's template rules. field and message say which.
400Meta rejected the template submission. Check the template details and try againMeta refused the submission.
401A valid Bearer API key is requiredThe Authorization header is missing or isn't Bearer <API key>.
401Invalid or revoked API keyThe key doesn't exist, was revoked, or has expired.
401Invalid API keyChatwise couldn't check the key. Try again.
403API key does not have the required scope: templates:writeThe key lacks the route's scope. Create a key that has it.
403The connected WhatsApp account is not authorized to create templatesThe connected WhatsApp account can't create templates.
403WHATSAPP_REAUTH_REQUIRED: WhatsApp authorization has expired. Ask an administrator to reconnect WhatsApp in Settings.Meta no longer accepts Chatwise's access to the number. Reconnect it in the dashboard. reason is expired, revoked or missing, and the message depends on it.
404Active WhatsApp connection not foundConnect a WhatsApp number in the dashboard first.
404Template not foundThe template this submission created was deleted since. Use a new Idempotency-Key.
409TEMPLATE_EXISTS: A WhatsApp template with this name and language already existsUse another name, or read the existing template.
409IDEMPOTENCY_KEY_REUSED: This Idempotency-Key was already used with different template detailsUse a new key for a new template.
409TEMPLATE_SUBMISSION_IN_PROGRESS: A submission for this template name and language is already in progressA submission of this name and language, with this key or another, is running or unconfirmed. Wait, then repeat the request with the key it was made with.
409TEMPLATE_SUBMISSION_UNCONFIRMED: Meta has not confirmed this submission. Retry using the same Idempotency-KeyRepeat the request later with the same key and body. If it keeps answering this, Meta doesn't have the template: submit it under another name.
409WHATSAPP_CONNECTION_CHANGED: The WhatsApp connection changed after this template was submittedThe workspace connected another WhatsApp Business Account since. Submit again with a new key.
413request entity too largeThe request body is larger than 100 KB.
429API key rate limit exceededWait the number of seconds in the Retry-After header.
500Internal server errorSomething failed in Chatwise. Repeat the request with the same key and body.
502WHATSAPP_LOOKUP_FAILED: Could not check the WhatsApp template submissionRepeat the request with the same key and body.
502TEMPLATE_SUBMISSION_UNCONFIRMED: The WhatsApp template submission could not be confirmed. Retry using the same Idempotency-KeyRepeat the request with the same key and body.
503WHATSAPP_RATE_LIMITED: WhatsApp is rate limiting template submissions. Retry with the same Idempotency-KeyWait, then repeat the request with the same key and body.

The body of an error is described in errors.

On this page