# WhatsApp Templates

URL: https://docs.dixa.io/openapi/dixa-api/beta/whatsapp-templates

## Get WhatsApp template

Get a WhatsApp template by id with template's category and approval status.

### GET /beta/whatsapp/templates/{templateId}

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

```bash
curl -X GET 'https://dev.dixa.io/beta/whatsapp/templates/{templateId}' \
  -H 'Authorization: <API token>'
```

#### Response examples

##### 200 The WhatsApp template

```json
{
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "name": "order_confirmation",
    "language": "en",
    "createdAt": "2026-01-01T00:00:00Z",
    "category": "UTILITY",
    "approvalStatus": "approved",
    "body": "Your order {{1}} has been confirmed.",
    "variables": {
      "1": "12345"
    }
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## List WhatsApp templates

List WhatsApp templates for the organization, newest first. To find out a template's approval status and category, use the get template endpoint.

### GET /beta/whatsapp/templates

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

```bash
curl -X GET 'https://dev.dixa.io/beta/whatsapp/templates' \
  -H 'Authorization: <API token>'
```

#### Response examples

##### 200 The list of WhatsApp templates

```json
{
  "data": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "name": "order_confirmation",
      "language": "en",
      "createdAt": "2026-01-01T00:00:00Z"
    },
    {
      "id": "517eedd9-bf71-4a84-bd95-2dd21360de3f",
      "name": "delivery_info",
      "language": "en",
      "createdAt": "2026-01-01T00:00:00Z"
    }
  ],
  "meta": {
    "next": "/beta/whatsapp/templates?pageKey=a2V5c2V0UGFnZUtleT1iMlptYzJWMFBUVXcmcGFnZUxpbWl0PTUwJmRpcj1mb3J3YXJk"
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## Create WhatsApp template

Create a new WhatsApp template. The template body is limited to 1024 characters.

### POST /beta/whatsapp/templates

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

#### Request example

Text template:

```bash
curl -X POST 'https://dev.dixa.io/beta/whatsapp/templates' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "order_confirmation",
  "language": "en",
  "templateType": {
    "body": "Your order {{1}} has been confirmed.",
    "_type": "Text"
  },
  "category": "UTILITY",
  "variables": {
    "1": "12345"
  }
}'
```

Text template without variables:

```bash
curl -X POST 'https://dev.dixa.io/beta/whatsapp/templates' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "office_closed",
  "language": "en",
  "templateType": {
    "body": "Our office is closed today.",
    "_type": "Text"
  },
  "category": "UTILITY"
}'
```

Media template:

```bash
curl -X POST 'https://dev.dixa.io/beta/whatsapp/templates' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "shipping_update",
  "language": "en",
  "templateType": {
    "body": "Your package {{1}} has shipped and will arrive on {{2}}.",
    "mediaUrl": "https://example.com/brand-logo.jpg",
    "_type": "Media"
  },
  "category": "MARKETING",
  "variables": {
    "1": "PKG-9876",
    "2": "2026-08-01"
  }
}'
```

#### Response examples

##### 201 The created WhatsApp template

```json
{
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}
```

##### 400

```json
{
  "message": "Decoding failure in request"
}
```

##### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

##### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## OpenAPI definition

The operations and the schemas used, from the full spec at https://docs.dixa.io/openapi-specs/dixa-beta.yaml. Request and response examples are above.

```yaml
openapi: 3.0.3
info:
  title: Dixa API
  version: beta
servers:
  - url: https://dev.dixa.io
security:
  - ApiKeyAuth: []
paths:
  /beta/whatsapp/templates/{templateId}:
    get:
      tags:
        - WhatsApp Templates
      summary: Get WhatsApp template
      description: Get a WhatsApp template by id with template's category and approval
        status.
      operationId: getWhatsappTemplatesTemplateid
      parameters:
        - name: templateId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        "200":
          description: The WhatsApp template
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetWhatsappTemplateOutput"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
  /beta/whatsapp/templates:
    get:
      tags:
        - WhatsApp Templates
      summary: List WhatsApp templates
      description: List WhatsApp templates for the organization, newest first. To find
        out a template's approval status and category, use the get template
        endpoint.
      operationId: getWhatsappTemplates
      parameters:
        - name: pageLimit
          in: query
          description: Maximum number of results per page. May be used in combination with
            pageKey to change the number of results in between page requests.
          required: false
          schema:
            type: integer
            format: int32
        - name: pageKey
          in: query
          description: Base64 encoded form of pagination query parameters. Do not try to
            construct or change programmatically as the internal structure may
            change without notice.
          required: false
          schema:
            type: string
      responses:
        "200":
          description: The list of WhatsApp templates
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListWhatsappTemplatesOutput"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
    post:
      tags:
        - WhatsApp Templates
      summary: Create WhatsApp template
      description: Create a new WhatsApp template. The template body is limited to
        1024 characters.
      operationId: postWhatsappTemplates
      requestBody:
        description: The WhatsApp template to create
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTemplateInput"
        required: true
      responses:
        "201":
          description: The created WhatsApp template
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateWhatsappTemplateOutput"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      name: Authorization
      in: header
  schemas:
    GetWhatsappTemplateOutput:
      title: GetWhatsappTemplateOutput
      type: object
      required:
        - data
      properties:
        data:
          $ref: "#/components/schemas/WhatsappTemplate"
    WhatsappTemplate:
      title: WhatsappTemplate
      type: object
      required:
        - id
        - name
        - language
        - createdAt
        - body
        - variables
      properties:
        id:
          type: string
        name:
          type: string
        language:
          type: string
        createdAt:
          type: string
        category:
          type: string
        approvalStatus:
          type: string
        body:
          type: string
        variables:
          $ref: "#/components/schemas/Map_String"
    Map_String:
      title: Map_String
      type: object
      additionalProperties:
        type: string
    BadRequest:
      title: BadRequest
      type: object
      required:
        - message
      properties:
        message:
          type: string
    NotFound:
      title: NotFound
      type: object
      required:
        - message
      properties:
        message:
          type: string
    ServerError:
      title: ServerError
      type: object
      required:
        - message
      properties:
        message:
          type: string
    ListWhatsappTemplatesOutput:
      title: ListWhatsappTemplatesOutput
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/WhatsappTemplateListItem"
        meta:
          $ref: "#/components/schemas/PaginationLinks"
    WhatsappTemplateListItem:
      title: WhatsappTemplateListItem
      type: object
      required:
        - id
        - name
        - language
        - createdAt
      properties:
        id:
          type: string
        name:
          type: string
        language:
          type: string
        createdAt:
          type: string
    PaginationLinks:
      title: PaginationLinks
      type: object
      properties:
        previous:
          description: url
          type: string
        next:
          description: url
          type: string
    CreateTemplateInput:
      title: CreateTemplateInput
      type: object
      required:
        - name
        - language
        - templateType
        - category
      properties:
        name:
          description: Template name; may only contain lowercase letters, digits, and
            underscores
          type: string
        language:
          description: "Supported language codes: ar, bg, hr, cs, da, nl, en, et, fi, fr,
            de, el, he, hu, it, ja, ko, lv, lt, nb, pl, ro, ru, sr, sk, sl, es,
            sv, th, tr, uk, pt_PT, zh_CN, zh_TW, zh_HK"
          type: string
        templateType:
          $ref: "#/components/schemas/TemplateTypeInput"
        category:
          description: "values: [UTILITY, MARKETING]"
          type: string
        variables:
          $ref: "#/components/schemas/Map_String"
          description: "Sample values for the template's placeholders (e.g. {\"1\":
            \"John\"}), submitted to WhatsApp as example content during template
            approval. Omit for a template whose body has no placeholders."
    TemplateTypeInput:
      title: TemplateTypeInput
      description: Template body and type; use Text for text-only messages, Media for
        messages with an attachment
      oneOf:
        - $ref: "#/components/schemas/Media"
        - $ref: "#/components/schemas/Text3"
    Media:
      title: Media
      type: object
      required:
        - body
        - mediaUrl
      properties:
        body:
          description: Template body text; maximum 1024 characters
          type: string
        mediaUrl:
          type: string
    Text3:
      title: Text
      type: object
      required:
        - body
      properties:
        body:
          description: Template body text; maximum 1024 characters
          type: string
    CreateWhatsappTemplateOutput:
      title: CreateWhatsappTemplateOutput
      type: object
      required:
        - data
      properties:
        data:
          $ref: "#/components/schemas/CreateTemplateOutput"
    CreateTemplateOutput:
      title: CreateTemplateOutput
      type: object
      required:
        - id
      properties:
        id:
          type: string
```
