---
docId: doc_4b50c5eba68b441ca49100cbaafbb201
title: Create a template
description: "Create a WhatsApp template and submit it for Meta review."
api:
  group: mensajes/plantillas
  auth: bearer
  operations:
    - operationId: createWhatsAppTemplate
      method: POST
      path: /v1/whatsapp/templates
      postmanName: Create a Template
---

<script>
  import { Ways, Note, Collapsible } from '$lib/components';
</script>

# Create a template

Create a template in the workspace's WhatsApp Business account (WABA) and submit it to Meta for review. It remains `PENDING` until Meta approves it as `APPROVED`; only then can it be sent.

If your credential covers several workspaces, add `?workspace=<id>` ([list workspaces](/api-reference/workspaces)); without it the answer is `400`.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl https://api.platic.ai/v1/whatsapp/templates \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "order_update",
    "language": "es_MX",
    "category": "UTILITY",
    "components": [
      {
        "type": "BODY",
        "text": "Your order {{1}} is on its way.",
        "example": { "body_text": [["1001"]] }
      }
    ]
  }'
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.whatsapp.templates.create({
  name: "order_update",
  language: "es_MX",
  category: "UTILITY",
  components: [{ type: "BODY", text: "Your order {{1}} is on its way.", example: { body_text: [["1001"]] } }],
});
```

</Ways.Way>
</Ways>

## Request body

```json
{
  "name": "order_update",
  "language": "es_MX",
  "category": "UTILITY",
  "components": [
    {
      "type": "BODY",
      "text": "Hi {{1}}, your order {{2}} is ready for pickup.",
      "example": { "body_text": [["Ana", "A-1024"]] }
    },
    { "type": "FOOTER", "text": "Acme" },
    { "type": "BUTTONS", "buttons": [{ "type": "QUICK_REPLY", "text": "On my way" }] }
  ]
}
```

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | ✓ | Template name: only lowercase letters, numbers and underscore, up to 512 characters. It is the one you use when sending it |
| `language` | string | ✓ | Meta language code, such as `es`, `es_MX` or `en_US`. `es-MX` and `es_mx` are read as `es_MX` |
| `category` | string | ✓ | `MARKETING`, `UTILITY` or `AUTHENTICATION`, in upper or lower case |
| `components` | array | ✓ | From 1 to 20 components in Meta's format, each with its `type`: `HEADER`, `BODY`, `FOOTER`, `BUTTONS` or `CAROUSEL` |
| `wabaId` | string | — | The WABA to create it in. Only needed if the workspace has several |
| `allowCategoryChange` | boolean | — | `true` lets Meta move it to the category it considers correct instead of rejecting it |
| `campaignId` | string | — | The campaign it is for. It stays among the templates that campaign sent for review and is created in the campaign's WABA, unless you indicate another. A campaign that does not exist answers `404 CAMPAIGN_NOT_FOUND` |
| `associateWithCampaign` | boolean | — | Only with `campaignId`: `true` makes it the campaign's chosen template. By default, the campaign keeps the one it had |

You can also send `wabaId` in the query (`?wabaId=`). If both the query and body include it, the body takes priority. An unrecognized field returns `400`.

### Components

`components` follows Meta's format: the reference is in [template components](https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/components). Each variable (`{{1}}`, `{{2}}`…) carries an example value in `example`.

For an image, video or document header, put the file's public URL in `example.header_url`. Platica downloads it and uploads it to Meta before sending the template.

```json
{
  "type": "HEADER",
  "format": "IMAGE",
  "example": { "header_url": ["https://shop.example.com/img/order.png"] }
}
```

## Response

Returns `201`:

```json
{
  "status": "success",
  "message": "Template submitted to Meta's review",
  "data": {
    "name": "order_update",
    "category": "UTILITY",
    "status": "PENDING",
    "language": "es_MX",
    "components": [
      {
        "type": "BODY",
        "text": "Hi {{1}}, your order {{2}} is ready for pickup.",
        "example": { "body_text": [["Ana", "A-1024"]] }
      },
      { "type": "FOOTER", "text": "Acme" },
      { "type": "BUTTONS", "buttons": [{ "type": "QUICK_REPLY", "text": "On my way" }] }
    ],
    "source": "meta",
    "content": "Hi {{1}}, your order {{2}} is ready for pickup.",
    "params": ["Ana", "A-1024"],
    "header": { "type": "none", "requiresMedia": false },
    "footer": "Acme",
    "buttons": [{ "type": "QUICK_REPLY", "text": "On my way" }],
    "id": "1234567890123456",
    "api_example": {
      "name": "order_update",
      "params": ["Ana", "A-1024"]
    },
    "dynamicButtonsCount": 0,
    "wabaId": "155512345678901",
    "workspaceId": "K7u9rQ2LmZx18BvC5tNd",
    "nextStep": "Meta reviews the template before it can be sent. Check its status with GET /v1/whatsapp/templates/order_update and, once it is APPROVED, send it with POST /v1/messages/template."
  }
}
```

| Field | Description |
|-------|-------------|
| `id` | Template ID at Meta |
| `status` | The status Meta answered. `PENDING` if it did not say another |
| `category` | The category Meta registered it with; with `allowCategoryChange` it can be another |
| `components` | The components you sent |
| `content`, `params`, `header`, `footer`, `buttons` | The template in the same shape as [get a template](/api-reference/whatsapp-templates/get) |
| `api_example` | The body to [send the template](/api-reference/messages/send-template) once Meta approves it |
| `wabaId`, `workspaceId` | Where it ended up |
| `campaignId`, `associatedWithCampaign` | Only with `campaignId`: the campaign and whether the template became its chosen one |
| `nextStep` | What comes next |

<Note type="important">

Subscribe to [`template.status.updated`](/api-reference/webhooks/payloads#whatsapp-templates) to receive Meta's decision, or check the status with [get a template](/api-reference/whatsapp-templates/get). The review may take time. When the status is `APPROVED`, use [send a template](/api-reference/messages/send-template).

</Note>

## Errors

<Collapsible summary="Show error codes and fixes">

| Status | `details.code` | When |
|--------|----------------|------|
| `400` | `INVALID_REQUEST` | The body is not valid or has an unknown field. `details.issues` says which |
| `400` | `INVALID_REQUEST` | Your credential covers several workspaces and you did not send `?workspace=`, or you sent one it does not cover. `details.available` has the IDs you can use |
| `400` | `WABA_REQUIRED` | The workspace has several WABAs and you did not send `wabaId`. `details.available` lists them |
| `400` | `TEMPLATE_INVALID` | Meta or Platica rejected the template. `details.message` has the reason |
| `401` | `UNAUTHENTICATED` | The credential is missing or not valid |
| `403` | `FORBIDDEN` | An OAuth token without the `platica:write` scope, or the person has no write permission in Conversations or Campaigns. The message is `Missing conversations or campaigns permission` |
| `404` | `WORKSPACE_NOT_FOUND` | The workspace does not exist |
| `404` | `WABA_NOT_FOUND` | The workspace has no connected WABA, or `wabaId` is not one of its own. `details.available` lists the ones it has |
| `404` | `CAMPAIGN_NOT_FOUND` | `campaignId` is not a campaign of the workspace |
| `409` | `LEGACY_PROVIDER` | The workspace sends WhatsApp through MessageBird. Its templates are read here, but created in MessageBird |
| `409` | `WHATSAPP_TOKEN_INVALID` | The WABA's access token expired or was revoked, or Platica has none that works. Reconnect the account in Platica |
| `409` | `WHATSAPP_PERMISSION_DENIED` | The WABA's token is missing a permission. Reconnect the account accepting all the WhatsApp permissions and check in Meta Business Manager that the app still has access to the WABA |
| `409` | `WHATSAPP_ACCOUNT_RESTRICTED` | Meta restricted the WABA. Check its status in WhatsApp Manager |
| `429` | `RATE_LIMITED` | WhatsApp is rate limiting the account's template requests. Wait a few minutes and try again |
| `502` | `UPSTREAM_ERROR` | Platica could not reach WhatsApp. Try again in a moment |
| `502` | `TEMPLATE_ID_MISSING` | With `campaignId`: Meta created the template but did not return its id, so it did not end up in the campaign. Check it with [get a template](/api-reference/whatsapp-templates/get) before trying again |
| `503` | `TEMPORARILY_UNAVAILABLE` | Platica could not read the workspace or its WABAs. Try again in a moment |
| `504` | `UPSTREAM_TIMEOUT` | WhatsApp did not answer in time. The template may or may not have been created: check it with [get a template](/api-reference/whatsapp-templates/get) before trying again |

For `WHATSAPP_TOKEN_INVALID`, `WHATSAPP_PERMISSION_DENIED`, `WHATSAPP_ACCOUNT_RESTRICTED`, or `RATE_LIMITED`, check the WhatsApp account. `details.metaCode` contains Meta's code when available; `details.upstreamMessage` contains its message. Editing the template does not resolve these errors. `UPSTREAM_ERROR` may also include `details.upstreamMessage`.

```json
{
  "code": 400,
  "error": "Bad Request - The request has validation errors",
  "details": {
    "code": "WABA_REQUIRED",
    "message": "This workspace has several WhatsApp Business Accounts. Send wabaId with the one the template belongs to.",
    "available": ["155512345678901", "155598765432109"]
  }
}
```

The general error format is in [Errors](/api-reference/errors).

</Collapsible>

## Notes

- The rules for names, categories and content are Meta's: check its [template guidelines](https://developers.facebook.com/docs/whatsapp/message-templates/guidelines) before creating one.
- If you recently deleted a template with the same name, Meta may reject the new one for a while.
- To change it later use [update a template](/api-reference/whatsapp-templates/update); to remove it, [delete a template](/api-reference/whatsapp-templates/delete).
