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

# Edit a WhatsApp template

> Edit a WhatsApp template’s components, category or validity period and resubmit it to Meta for approval. Name and language cannot change.

Send only the fields you are changing. After an edit the template goes back to `PENDING` until Meta approves it; a send that uses it in the meantime is refused with `422 template_pending`. Meta's own limits on how often a template can be edited come back as `400` errors with Meta's reason.

Requires the `whatsapp:write` scope.


## OpenAPI

````yaml patch /whatsapp/templates/{templateId}
openapi: 3.1.0
info:
  title: OpenCX API
  description: >

    OpenCX is an AI-powered, all-in-one platform for customer support and
    outbound communications.


    Use this API to manage your OpenCX organization's AI agents, actions,
    conversations, contacts, and more.


    To get started, generate a new API key from the dashboard.


    ## Authentication

    All API endpoints require authentication using a Bearer token. You can
    generate an API key from your OpenCX dashboard.


    ## Rate Limiting

    API requests are rate limited to ensure fair usage. The current limits are:

    - 100 requests per minute for standard endpoints

    - 1000 requests per minute for streaming endpoints


    ## Error Handling

    The API uses standard HTTP status codes and returns detailed error messages
    in the response body.
  version: 1.0-beta
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: http://localhost:8080
    description: Development
  - url: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /whatsapp/templates/{templateId}:
    patch:
      summary: Edit a WhatsApp template
      description: >-
        Change the components, category or validity period and resubmit to Meta.
        The template goes back to PENDING until Meta approves the edit, and
        sends that use it are refused until then; name and language cannot
        change. Meta's own edit limits come back as errors.
      operationId: updateWhatsappTemplate
      parameters:
        - schema:
            type: string
            minLength: 1
          in: path
          name: templateId
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWhatsAppTemplateDto'
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WhatsAppTemplateMutationResultDto'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    UpdateWhatsAppTemplateDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/UpdateWhatsAppTemplateDtoInput'
      type: object
      properties:
        category:
          type: string
          enum:
            - UTILITY
            - MARKETING
            - AUTHENTICATION
        components:
          minItems: 1
          type: array
          items:
            anyOf:
              - type: object
                properties:
                  type:
                    type: string
                    const: HEADER
                  format:
                    type: string
                    const: TEXT
                  text:
                    type: string
                    description: 60 chars max
                  example:
                    anyOf:
                      - type: object
                        properties:
                          header_text:
                            type: array
                            items:
                              type: string
                        required:
                          - header_text
                      - type: object
                        properties:
                          header_text_named_params:
                            type: array
                            items:
                              type: object
                              properties:
                                param_name:
                                  type: string
                                example:
                                  type: string
                              required:
                                - param_name
                                - example
                        required:
                          - header_text_named_params
                required:
                  - type
                  - format
                  - text
              - type: object
                properties:
                  type:
                    type: string
                    const: HEADER
                  format:
                    type: string
                    enum:
                      - IMAGE
                      - DOCUMENT
                      - VIDEO
                    description: |2-

                        /**
                         * IMAGE: JPG | PNG
                         * DOCUMENT: PDF
                         * VIDEO: MP4
                         */
                          
                  example:
                    type: object
                    properties:
                      header_handle:
                        anyOf:
                          - type: string
                          - type: array
                            items:
                              type: string
                        description: |2-

                              /**
                               * A handle for the media uploaded through the Resumable Upload API
                               * https://developers.facebook.com/docs/graph-api/guides/upload
                               */
                              
                    required:
                      - header_handle
                required:
                  - type
                  - format
              - type: object
                properties:
                  type:
                    type: string
                    const: HEADER
                  format:
                    type: string
                    const: LOCATION
                required:
                  - type
                  - format
              - type: object
                properties:
                  type:
                    type: string
                    const: BODY
                  text:
                    type: string
                    description: >-
                      1024 chars max, or 32768 if `body` is the only component
                      in the template
                  example:
                    anyOf:
                      - type: object
                        properties:
                          body_text:
                            type: array
                            items:
                              type: array
                              items:
                                type: string
                            description: >-
                              Yes, this is an array of arrays, but only the
                              first array is used, just like `header_text`
                        required:
                          - body_text
                      - type: object
                        properties:
                          body_text_named_params:
                            type: array
                            items:
                              type: object
                              properties:
                                param_name:
                                  type: string
                                example:
                                  type: string
                              required:
                                - param_name
                                - example
                        required:
                          - body_text_named_params
                required:
                  - type
                  - text
              - type: object
                properties:
                  type:
                    type: string
                    const: FOOTER
                  text:
                    type: string
                    description: 60 chars max
                required:
                  - type
                  - text
              - type: object
                properties:
                  type:
                    type: string
                    const: BUTTONS
                    description: |2-

                        /**
                         * Templates are limited to 10 quick reply buttons. If using quick reply buttons with other buttons,
                         * buttons must be organized into two groups: quick reply buttons and non-quick reply buttons.
                         * If grouped incorrectly, the API will return an error indicating an invalid combination.
                         *
                         * Examples of valid groupings:
                         * - Quick Reply, Quick Reply
                         * - Quick Reply, Quick Reply, URL, Phone
                         * - URL, Phone, Quick Reply, Quick Reply
                         *
                         * Examples of invalid groupings:
                         * - Quick Reply, URL, Quick Reply
                         * - URL, Quick Reply, URL
                         */
                        
                  buttons:
                    type: array
                    items:
                      oneOf:
                        - type: object
                          properties:
                            type:
                              type: string
                              const: QUICK_REPLY
                            text:
                              type: string
                              description: 25 chars max
                          required:
                            - type
                            - text
                        - type: object
                          properties:
                            type:
                              type: string
                              const: URL
                            text:
                              type: string
                            url:
                              type: string
                              description: 2000 chars max
                            example:
                              type: array
                              prefixItems:
                                - type: string
                                  description: 2000 chars max
                              items: false
                              minItems: 1
                              maxItems: 1
                          required:
                            - type
                            - text
                            - url
                        - type: object
                          properties:
                            type:
                              type: string
                              const: PHONE_NUMBER
                            text:
                              type: string
                              description: 25 chars max
                            phone_number:
                              type: string
                              description: 20 chars max
                          required:
                            - type
                            - text
                            - phone_number
                        - type: object
                          properties:
                            type:
                              type: string
                              const: COPY_CODE
                            example:
                              anyOf:
                                - type: string
                                - type: array
                                  items:
                                    type: string
                              description: 15 chars max
                          required:
                            - type
                            - example
                        - type: object
                          properties:
                            type:
                              type: string
                              const: FLOW
                            text:
                              type: string
                              description: 25 chars max
                            icon:
                              type: string
                              enum:
                                - DOCUMENT
                                - PROMOTION
                                - REVIEW
                            flow_id:
                              type: string
                            flow_name:
                              type: string
                            flow_json:
                              type: object
                              propertyNames:
                                type: string
                              additionalProperties: {}
                            flow_action:
                              type: string
                              enum:
                                - data_exchange
                                - navigate
                            navigate_screen:
                              type: string
                          required:
                            - type
                            - text
                            - icon
                            - flow_action
                        - type: object
                          properties:
                            type:
                              type: string
                              const: MPM
                            example:
                              type: string
                          required:
                            - type
                            - example
                required:
                  - type
                  - buttons
        message_send_ttl_seconds:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            Message validity period in seconds. Authentication: 30–900, Utility:
            30–43200, Marketing: 43200–2592000. -1 = explicit 30-day TTL
            (authentication/utility only).
    WhatsAppTemplateMutationResultDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/WhatsAppTemplateMutationResultDto'
      type: object
      properties:
        success:
          type: boolean
      required:
        - success
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.