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

# Create Template

> Create a new message template.

Automatically extracts variables from content.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/templates
openapi: 3.1.0
info:
  title: wazzapi Public API
  description: >-
    Public API surface for external API-key clients. Only stable /api/v1
    endpoints are included.


    ## Webhook deliveries

    This reference also includes the webhook requests Wazzapi sends to your
    endpoint for incoming messages, message status updates, and device status
    changes. See the `Incoming webhooks` section in the sidebar for headers,
    payload fields, and concrete examples.
  version: 1.0.0
servers: []
security: []
tags:
  - name: Incoming webhooks
    description: >-
      POST deliveries that Wazzapi sends to your webhook endpoint after you
      subscribe to supported events. Verify the signature against the raw body
      and return a 2xx response quickly.
paths:
  /api/v1/templates:
    post:
      tags:
        - templates
      summary: Create Template
      description: |-
        Create a new message template.

        Automatically extracts variables from content.
      operationId: create_template_api_v1_templates_post
      parameters:
        - name: Authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateCreateRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    TemplateCreateRequest:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        content:
          type: string
          maxLength: 4000
          minLength: 1
          title: Content
        category:
          type: string
          title: Category
          default: marketing
        media_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Media Type
        media_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Media Url
      type: object
      required:
        - name
        - content
      title: TemplateCreateRequest
      description: Request to create a template.
    TemplateResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        category:
          type: string
          title: Category
        content:
          type: string
          title: Content
        variables:
          items:
            type: string
          type: array
          title: Variables
        builtin_variables:
          items:
            type: string
          type: array
          title: Builtin Variables
        custom_variables:
          items:
            type: string
          type: array
          title: Custom Variables
        media_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Media Type
        media_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Media Url
        is_active:
          type: boolean
          title: Is Active
        times_used:
          type: integer
          title: Times Used
        last_used_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Used At
        created_at:
          type: string
          title: Created At
        updated_at:
          type: string
          title: Updated At
      type: object
      required:
        - id
        - name
        - category
        - content
        - variables
        - builtin_variables
        - custom_variables
        - is_active
        - times_used
        - created_at
        - updated_at
      title: TemplateResponse
      description: Full template response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````