> ## Documentation Index
> Fetch the complete documentation index at: https://docs.relayos.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /v1/templates — Create Template

> Register a new WhatsApp message template in your RelayOS project. Templates must be approved by Meta before they can be used to send messages.

Use this endpoint to register a new WhatsApp message template in your RelayOS project. After submission, Meta reviews the template and updates its status to `APPROVED` or `REJECTED`. You can only send messages using templates that have been approved.

## Request

**`POST https://api.relayos.com.br/v1/templates`**

<ParamField body="name" type="string" required>
  Template name in slug format (lowercase letters, numbers, and underscores only). This name is used when referencing the template in `POST /v1/messages`. Example: `order_confirmation`.
</ParamField>

<ParamField body="language" type="string" required>
  BCP-47 language code for the template. Examples: `pt_BR`, `en_US`, `es_MX`. Each language variant is registered as a separate template.
</ParamField>

<ParamField body="category" type="string" required>
  Template category as defined by Meta. Must be one of `UTILITY`, `MARKETING`, or `AUTHENTICATION`. The category affects delivery rules and pricing.
</ParamField>

<ParamField body="components" type="array" required>
  Array of component objects that define the template structure. Each component represents a section of the message: `HEADER`, `BODY`, or `FOOTER`. At minimum, a `BODY` component is required.
</ParamField>

```bash theme={null}
curl -X POST https://api.relayos.com.br/v1/templates \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "order_confirmation",
    "language": "pt_BR",
    "category": "UTILITY",
    "components": [
      {
        "type": "HEADER",
        "format": "TEXT",
        "text": "Pedido confirmado"
      },
      {
        "type": "BODY",
        "text": "Olá {{1}}, seu pedido #{{2}} foi confirmado e será entregue em até {{3}} dias úteis."
      },
      {
        "type": "FOOTER",
        "text": "RelayOS — mensagens que chegam"
      }
    ]
  }'
```

## Response

A `200` response returns the created template object.

<ResponseField name="id" type="string">
  Unique template identifier assigned by RelayOS.
</ResponseField>

<ResponseField name="name" type="string">
  The slug name you provided.
</ResponseField>

<ResponseField name="language" type="string">
  The language code for this template.
</ResponseField>

<ResponseField name="category" type="string">
  The template category (`UTILITY`, `MARKETING`, or `AUTHENTICATION`).
</ResponseField>

<ResponseField name="status" type="string">
  Approval status from Meta. Initially `PENDING`. Transitions to `APPROVED` or `REJECTED` after Meta review.
</ResponseField>

<ResponseField name="components" type="array">
  The components array as submitted.
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp of when the template was registered.
</ResponseField>

```json theme={null}
{
  "id": "tpl_01hwxyz123abc",
  "name": "order_confirmation",
  "language": "pt_BR",
  "category": "UTILITY",
  "status": "PENDING",
  "components": [
    {
      "type": "HEADER",
      "format": "TEXT",
      "text": "Pedido confirmado"
    },
    {
      "type": "BODY",
      "text": "Olá {{1}}, seu pedido #{{2}} foi confirmado e será entregue em até {{3}} dias úteis."
    },
    {
      "type": "FOOTER",
      "text": "RelayOS — mensagens que chegam"
    }
  ],
  "createdAt": "2026-05-14T12:00:00Z"
}
```

<Info>
  Meta typically reviews templates within 24 hours. You can poll `GET /v1/templates` to check approval status.
</Info>
