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

# Edit a message template

> Updates the components of an existing message template by its WhatsApp template ID. Only APPROVED templates can be edited, and editing resets the template to PENDING for re-review. APPROVED templates are limited to one edit per day.



## OpenAPI

````yaml /api-reference/openapi.json put /platforms/whatsapp/templates/{id}
openapi: 3.0.0
info:
  description: >-
    Unified social media inbox API. Read and respond to comments, DMs, reviews,
    and mentions across Instagram, Facebook, Threads, Google Business Profile,
    TikTok, LinkedIn, and YouTube through a single REST API. X/Twitter and
    Trustpilot coming soon.
  title: SocialAPI.AI
  contact:
    name: SocialAPI.AI Support
    email: support@social-api.ai
  license:
    name: MIT
  version: '1.0'
servers:
  - url: https://api.social-api.ai/v1
security: []
paths:
  /platforms/whatsapp/templates/{id}:
    put:
      tags:
        - WhatsApp
      summary: Edit a message template
      description: >-
        Updates the components of an existing message template by its WhatsApp
        template ID. Only APPROVED templates can be edited, and editing resets
        the template to PENDING for re-review. APPROVED templates are limited to
        one edit per day.
      parameters:
        - example: '1234567890123456'
          description: WhatsApp template platform ID
          name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_endpoints.WhatsAppEditTemplateRequest'
        description: Replacement components
        required: true
      responses:
        '204':
          description: Template updated
        '400':
          description: Missing or invalid components
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
        '404':
          description: Template not found or no WhatsApp account connected
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
        '502':
          description: WhatsApp/Meta upstream error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_endpoints.ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    api_endpoints.WhatsAppEditTemplateRequest:
      type: object
      properties:
        components:
          description: Components replaces the template's components.
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.WhatsAppTemplateComponentDef'
    api_endpoints.ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/api_endpoints.ErrorBody'
    api_endpoints.WhatsAppTemplateComponentDef:
      type: object
      properties:
        buttons:
          description: >-
            Buttons populate a BUTTONS component (one of QUICK_REPLY, URL,
            PHONE_NUMBER, COPY_CODE).
          type: array
          items:
            $ref: '#/components/schemas/api_endpoints.WhatsAppTemplateButtonDef'
        example:
          description: >-
            Example carries WhatsApp's sample values, forwarded verbatim. For a
            TEXT

            BODY/HEADER it is {"body_text":[["v1","v2"]]} /
            {"header_text":["v1"]}; for

            a media HEADER it is {"header_handle":["<url-or-handle>"]}. Required
            for

            approval when the component contains variables.
          type: object
        format:
          description: Format is required for HEADER components.
          type: string
          enum:
            - TEXT
            - IMAGE
            - VIDEO
            - DOCUMENT
          example: TEXT
        text:
          description: >-
            Text is the literal text for HEADER (when Format is TEXT), BODY, or
            FOOTER components.

            May contain 1-indexed placeholders such as {{1}}, {{2}}.
          type: string
          example: Hello {{1}}, your order {{2}} is confirmed.
        type:
          description: Type is the component slot.
          type: string
          enum:
            - HEADER
            - BODY
            - FOOTER
            - BUTTONS
          example: BODY
    api_endpoints.ErrorBody:
      type: object
      properties:
        code:
          type: string
          example: resource.not_found
        message:
          type: string
          example: Account not found
        meta:
          type: object
          additionalProperties: {}
    api_endpoints.WhatsAppTemplateButtonDef:
      type: object
      properties:
        example:
          description: >-
            Example carries the button's sample value(s), forwarded verbatim: a
            dynamic

            URL example (["https://..."]) or a COPY_CODE sample ("250FF").
          type: object
        phone_number:
          description: >-
            PhoneNumber is required when Type is PHONE_NUMBER. E.164 format with
            leading "+".
          type: string
          example: '+15551234567'
        text:
          description: >-
            Text is the button label. Not required for COPY_CODE (WhatsApp
            auto-labels it).
          type: string
          example: Visit
        type:
          description: Type is the button kind.
          type: string
          enum:
            - QUICK_REPLY
            - URL
            - PHONE_NUMBER
            - COPY_CODE
          example: URL
        url:
          description: >-
            URL is required when Type is URL. May contain a single {{1}}
            placeholder.
          type: string
          example: https://example.com/{{1}}
  securitySchemes:
    BearerAuth:
      description: >-
        Prefix your API key with "Bearer ". Example: `Authorization: Bearer
        sapi_key_...`
      type: apiKey
      name: Authorization
      in: header

````