# Create a template

Creates a new WhatsApp message template. Templates must be approved by WhatsApp before they can be used for sending messages.

Endpoint: POST /api/template/create
Version: 2.1.0.0
Security: basicAuth, ApiKeyAuth

## Security:

  - `basicAuth` (unknown)
    http basic

  - `ApiKeyAuth` (unknown)
    apiKey in header X-Api-Key

## Request fields (application/json):

  - `language` (string, required)
    Default template language. See [supported languages](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates#supported-languages).
    Example: en

  - `category` (string, required)
    Template category. For `AUTHENTICATION` templates, contact Namirial support for the accepted parameters.
    Enum: "UTILITY", "MARKETING", "AUTHENTICATION"

  - `name` (string, required)
    Template name. Only alphabetic characters and underscores (max 100 characters).
    Example: signature_template

  - `description` (string, required)
    Template description.
    Example: sign a doc using a link

  - `body` (object, required)
    Template body component.

  - `body.text` (string | null)
    Static body text.

  - `body.parameters` (array | null)
    List of dynamic text parameters to substitute in the template body.

  - `body.parameters.text` (string | null)
    Parameter value to substitute in the template.

  - `urlButtons` (array | null)
    URL button components. Max 2 buttons.

  - `urlButtons.index` (integer | null)
    Zero-based index of the URL button in the template.

  - `urlButtons.urlPath` (string | null)
    Dynamic path suffix appended to the button's base URL.

  - `urlButtons.url` (string | null)
    Full URL override for the button.

  - `urlButtons.text` (string | null)
    Button label text.

  - `textHeader` (object)
    Template text header component.

  - `textHeader.text` (string | null)
    Header text.

  - `footer` (object)
    Template footer component.

  - `footer.text` (string | null)
    Footer text.

  - `footer.codeExpirationMinutes` (integer | null)
    OTP code expiration time in minutes.

## Response 200:

  - `200` (unknown)
    Template created successfully.

## Response 400:

  - `400` (unknown)
    Invalid request.

## Response 400 fields (application/json):

  - `type` (string)
    Exception type identifier.

  - `code` (integer)
    Numeric error code. See [Error codes](https://docs.namirial.app/products/whatsapp/) for the full list.

  - `message` (string)
    Human-readable error description.

  - `errorDetails` (array | null)
    Additional validation error details, present on constraint violations.

  - `errorDetails.field` (string)
    The field that failed validation.

  - `errorDetails.message` (string)
    Validation error message.

## Response 401:

  - `401` (unknown)
    Authentication failed — invalid or missing credentials.

## Response 403:

  - `403` (unknown)
    Forbidden — the account is not authorized to perform this operation.

## Response 400 examples:

  - `Invalid category` (unknown)

