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

# WhatsApp templates

> The approved template names an agent is allowed to send.

`name` is what goes in an agent's `builtin_tools.send_whatsapp_template.allowed_templates`.

<Note>
  **Check a name here before you set it.** `allowed_templates` accepts any string, so a typo is
  stored without complaint and the agent then cannot send - with nothing in the response to say
  why. This is the list to compare against.
</Note>

## Only approved templates

WhatsApp reviews every template before it can be sent. This endpoint returns the ones that passed.

| Not returned | Why                             |
| ------------ | ------------------------------- |
| `DRAFT`      | never submitted for review      |
| `PENDING`    | still being reviewed            |
| `REJECTED`   | review failed                   |
| `PAUSED`     | temporarily blocked for quality |

All four mean the same thing to an agent - it cannot send with them - so offering them would
invite exactly the silent failure above.

## A name is not unique on its own

The same template can be approved in several languages, so a row is a `name` **and** a `language`:

```json theme={"dark"}
[ { "name": "order_shipped", "language": "en", "category": "UTILITY" },
  { "name": "order_shipped", "language": "hi", "category": "UTILITY" } ]
```

`allowed_templates` takes the name. Which language is sent is decided at send time from the
conversation, not here.

`category` is what WhatsApp classified the template as - `UTILITY`, `MARKETING` or
`AUTHENTICATION` - which decides when it may be sent. It is `null` until they have classified it.

Creating a template and submitting it for review are dashboard actions.


## OpenAPI

````yaml developers/openapi.json GET /v1/whatsapp/templates
openapi: 3.1.0
info:
  title: Vocily API
  description: >-
    Public REST API for Vocily. Build and configure an agent, publish a version
    and put it live, place outbound calls, and read back calls, chats and what
    the agent remembered. Authenticate with a workspace API key as a Bearer
    token.


    Some things stay in the dashboard, by design: creating an API key, buying or
    connecting a phone number, setting an agent's webhook URL, connecting
    WhatsApp and its templates, building HTTP tools, and running batch
    campaigns.
  version: v1
servers:
  - url: https://api.vocily.ai
    description: Production
security: []
paths:
  /v1/whatsapp/templates:
    get:
      tags:
        - catalogues
      summary: List Whatsapp Templates
      description: >-
        Approved template names, for
        `builtin_tools.send_whatsapp_template.allowed_templates`.


        Without this, that list had to be typed from memory: a name with a typo
        is stored happily and

        the agent then simply cannot send, with nothing to compare against.


        Only `APPROVED` templates are returned. A `DRAFT` has never been sent to
        WhatsApp for review,

        and `PENDING`, `REJECTED` and `PAUSED` all mean the same thing to an
        agent — it cannot send

        with them — so offering them would invite exactly the silent failure
        this closes. Templates

        are created and submitted in the dashboard.
      operationId: list_whatsapp_templates_v1_whatsapp_templates_get
      parameters: []
      responses:
        '200':
          description: Approved templates you can name in `allowed_templates`.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                      description: >-
                        What goes in
                        `builtin_tools.send_whatsapp_template.allowed_templates`.
                    language:
                      type: string
                      description: >-
                        The language this template was approved in, e.g. `en` or
                        `hi`. The same name can be approved in several, which is
                        why a row is a name and a language together.
                    category:
                      type: string
                      nullable: true
                      description: >-
                        `MARKETING`, `UTILITY` or `AUTHENTICATION` — what
                        WhatsApp classified it as, which decides when it may be
                        sent. Null until they have classified it.
              example:
                - name: order_shipped
                  language: en
                  category: UTILITY
                - name: order_shipped
                  language: hi
                  category: UTILITY
                - name: autumn_offer
                  language: en
                  category: MARKETING
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                detail: Invalid API key
                code: UNAUTHORIZED
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Rate limit exceeded — honor `Retry-After`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                code: rate_limited
      security:
        - bearerAuth: []
components:
  schemas:
    ApiError:
      type: object
      description: >-
        Error envelope. `code` is derived from the HTTP status, so branch on it
        for the CLASS of failure; the specific reason is `detail.code`. Every
        public refusal carries both.
      properties:
        detail:
          type: object
          description: >-
            The reason. `code` is the domain reason (e.g. `call_not_found`) and
            `message` is a sentence safe to log. On a `422` it also carries
            `errors[]`, one entry per rejected field — see
            `HTTPValidationError`.
          properties:
            code:
              type: string
              example: call_not_found
            message:
              type: string
              example: Call not found
          required:
            - code
            - message
        code:
          type: string
          description: Derived from the HTTP status, not the domain reason.
          example: NOT_FOUND
    HTTPValidationError:
      type: object
      title: HTTPValidationError
      description: >-
        A request the API could not read: a field of the wrong type, out of
        range, missing, or one we do not accept. Same envelope as every other
        error.
      properties:
        detail:
          type: object
          description: >-
            What was wrong, as `code`, a one-line `message`, and every offending
            field in `errors`.
          required:
            - code
            - message
            - errors
          properties:
            code:
              type: string
              enum:
                - validation_error
            message:
              type: string
              description: >-
                The first problem in one line, with a count of the rest — e.g.
                `model.temperature: Input should be less than or equal to 2 (and
                1 more)`.
            errors:
              type: array
              items:
                $ref: '#/components/schemas/ValidationError'
              description: >-
                One entry per offending field. **Every problem is reported at
                once**, not just the first, so a malformed body needs one round
                trip to fix rather than one per field.
        code:
          type: string
          enum:
            - VALIDATION_ERROR
          description: Derived from the HTTP status, as on every error.
    ValidationError:
      type: object
      title: ValidationError
      required:
        - field
        - message
        - type
      properties:
        field:
          type: string
          description: >-
            The offending field as a path from the root of your request —
            `voice.speed`, `variables[0].key`, or `query.limit` for a query
            parameter. **This is the field to read.**
        message:
          type: string
          description: What is wrong with it, in plain language.
        type:
          type: string
          description: >-
            A stable machine code for the kind of failure, e.g.
            `extra_forbidden` for a field we do not accept, `missing` for a
            required one, or `less_than_equal` for a number out of range. Switch
            on this rather than on `message`, which may be reworded.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your API key as a Bearer token, e.g. `Authorization: Bearer vk_…`.'

````