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

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# Update template by id

> WhatsApp. Update one variant's components and/or its message_send_ttl_seconds by its Meta id. Name, language and category cannot change.

### Editing limits

- Meta only allows editing templates in `APPROVED`, `REJECTED` or `PAUSED` state. - An approved template can be edited once per 24 hours and up to 10 times per 30 days. - A variant already in `PENDING` cannot be edited again until Meta finishes reviewing it.

### Review

A component update sends the variant back to Meta for review, so the `status` returned here is normally `PENDING`. A TTL-only update keeps an APPROVED variant approved.

A write: needs messaging:write and is audited.

## Request contract

* **Method and path:** PATCH /apis/v1/social/messaging/whatsapp/templates/id/\{templateId}
* **Availability:** enabled
* **Request URL template:** `https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates/id/{templateId}`
* **templateId:** path; required
* **connectionId:** query; required

[Complete OpenAPI definition](https://aisa.one/docs/openapi/aisa-messaging.json)

Effective request declaration (including authentication and referenced schemas):

```json theme={null}
{
  "operationId": "patch_aisa_messaging_apis_v1_social_messaging_wha_443769",
  "method": "PATCH",
  "path": "/apis/v1/social/messaging/whatsapp/templates/id/{templateId}",
  "servers": [
    {
      "url": "https://api.aisa.one"
    }
  ],
  "parameters": [
    {
      "description": "Meta template id (numeric).",
      "in": "path",
      "name": "templateId",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Your messaging connection (msc_...), from GET /apis/v1/social/messaging/connections. On a request with a JSON body it may be sent as a top-level body member instead.",
      "in": "query",
      "name": "connectionId",
      "required": true,
      "schema": {
        "pattern": "^msc_[0-9A-Za-z]+$",
        "type": "string"
      }
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "example": {
          "components": [
            {
              "format": "text",
              "type": "header"
            }
          ],
          "message_send_ttl_seconds": 1
        },
        "schema": {
          "additionalProperties": false,
          "properties": {
            "components": {
              "description": "Updated template components. Optional when only message_send_ttl_seconds changes; at least one of the two is required.",
              "items": {
                "oneOf": [
                  {
                    "properties": {
                      "example": {
                        "properties": {
                          "header_handle": {
                            "description": "When the header format is a media type (image, video, gif, document), provide a public URL here.",
                            "items": {
                              "format": "uri",
                              "type": "string"
                            },
                            "maxItems": 1,
                            "minItems": 1,
                            "type": "array"
                          },
                          "header_text": {
                            "description": "Sample values for header text variables",
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "header_text_named_params": {
                            "description": "Sample values for NAMED header variables (templates using {{customer_name}}-style tokens with parameter_format: NAMED).",
                            "items": {
                              "properties": {
                                "example": {
                                  "description": "Sample value for this variable.",
                                  "type": "string"
                                },
                                "param_name": {
                                  "description": "Variable name as it appears in the text, without braces (e.g. customer_name for {{customer_name}}).",
                                  "pattern": "^[a-z0-9_]+$",
                                  "type": "string"
                                }
                              },
                              "required": [
                                "param_name",
                                "example"
                              ],
                              "type": "object"
                            },
                            "type": "array"
                          }
                        },
                        "type": "object"
                      },
                      "format": {
                        "enum": [
                          "text",
                          "image",
                          "video",
                          "gif",
                          "document",
                          "location"
                        ],
                        "type": "string"
                      },
                      "text": {
                        "description": "Header text (may include {{1}} variable). Used when format is TEXT.",
                        "type": "string"
                      },
                      "type": {
                        "enum": [
                          "header"
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "format"
                    ],
                    "type": "object"
                  },
                  {
                    "properties": {
                      "add_security_recommendation": {
                        "description": "Add security recommendation text (authentication templates only)",
                        "type": "boolean"
                      },
                      "example": {
                        "properties": {
                          "body_text": {
                            "description": "Sample values for body variables (array of arrays)",
                            "items": {
                              "items": {
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "type": "array"
                          },
                          "body_text_named_params": {
                            "description": "Sample values for NAMED body variables (templates using {{customer_name}}-style tokens with parameter_format: NAMED).",
                            "items": {
                              "properties": {
                                "example": {
                                  "description": "Sample value for this variable.",
                                  "type": "string"
                                },
                                "param_name": {
                                  "description": "Variable name as it appears in the text, without braces (e.g. customer_name for {{customer_name}}).",
                                  "pattern": "^[a-z0-9_]+$",
                                  "type": "string"
                                }
                              },
                              "required": [
                                "param_name",
                                "example"
                              ],
                              "type": "object"
                            },
                            "type": "array"
                          }
                        },
                        "type": "object"
                      },
                      "text": {
                        "description": "Body text with optional {{n}} variables",
                        "type": "string"
                      },
                      "type": {
                        "enum": [
                          "body"
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "type": "object"
                  },
                  {
                    "properties": {
                      "code_expiration_minutes": {
                        "description": "OTP code expiry in minutes (authentication templates only)",
                        "minimum": 1,
                        "type": "integer"
                      },
                      "text": {
                        "description": "Static footer text",
                        "type": "string"
                      },
                      "type": {
                        "enum": [
                          "footer"
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "type"
                    ],
                    "type": "object"
                  },
                  {
                    "properties": {
                      "buttons": {
                        "items": {
                          "properties": {
                            "autofill_text": {
                              "type": "string"
                            },
                            "example": {
                              "description": "Example value(s). Accepts either a string or an array of strings. For URL buttons, an array of URL-suffix samples; for copy_code (marketing) buttons, the coupon code as a single string. Left untyped (string | string[]) on purpose: a typed oneOf of string-vs-array breaks several SDK code generators."
                            },
                            "flow_action": {
                              "type": "string"
                            },
                            "flow_id": {
                              "type": "string"
                            },
                            "flow_json": {
                              "type": "string"
                            },
                            "flow_name": {
                              "type": "string"
                            },
                            "navigate_screen": {
                              "type": "string"
                            },
                            "otp_type": {
                              "description": "Required when type is otp",
                              "enum": [
                                "copy_code",
                                "one_tap",
                                "zero_tap"
                              ],
                              "type": "string"
                            },
                            "package_name": {
                              "type": "string"
                            },
                            "phone_number": {
                              "description": "Required when type is phone_number",
                              "type": "string"
                            },
                            "signature_hash": {
                              "type": "string"
                            },
                            "text": {
                              "description": "Visible button label. Required for all types except copy_code (whose label is fixed by WhatsApp) and otp (omit it and WhatsApp supplies its own label, localized to the template language; an English label on a non-English template is rejected).",
                              "type": "string"
                            },
                            "type": {
                              "enum": [
                                "quick_reply",
                                "url",
                                "phone_number",
                                "otp",
                                "copy_code",
                                "flow",
                                "mpm",
                                "catalog"
                              ],
                              "type": "string"
                            },
                            "url": {
                              "description": "Required when type is URL",
                              "format": "uri",
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        "minItems": 1,
                        "type": "array"
                      },
                      "type": {
                        "enum": [
                          "buttons"
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "buttons"
                    ],
                    "type": "object"
                  },
                  {
                    "properties": {
                      "cards": {
                        "description": "2-10 cards. Meta requires all cards to share the same component structure; a mismatch surfaces as a rejected_reason. MARKETING category only.",
                        "items": {
                          "properties": {
                            "components": {
                              "description": "Per-card components. Each card carries its own media header + optional body + up to 2 buttons. Footer and nested carousel are not allowed inside cards.",
                              "items": {
                                "oneOf": [
                                  {
                                    "properties": {
                                      "example": {
                                        "properties": {
                                          "header_handle": {
                                            "description": "When the header format is a media type (image, video, gif, document), provide a public URL here.",
                                            "items": {
                                              "format": "uri",
                                              "type": "string"
                                            },
                                            "maxItems": 1,
                                            "minItems": 1,
                                            "type": "array"
                                          },
                                          "header_text": {
                                            "description": "Sample values for header text variables",
                                            "items": {
                                              "type": "string"
                                            },
                                            "type": "array"
                                          },
                                          "header_text_named_params": {
                                            "description": "Sample values for NAMED header variables (templates using {{customer_name}}-style tokens with parameter_format: NAMED).",
                                            "items": {
                                              "properties": {
                                                "example": {
                                                  "description": "Sample value for this variable.",
                                                  "type": "string"
                                                },
                                                "param_name": {
                                                  "description": "Variable name as it appears in the text, without braces (e.g. customer_name for {{customer_name}}).",
                                                  "pattern": "^[a-z0-9_]+$",
                                                  "type": "string"
                                                }
                                              },
                                              "required": [
                                                "param_name",
                                                "example"
                                              ],
                                              "type": "object"
                                            },
                                            "type": "array"
                                          }
                                        },
                                        "type": "object"
                                      },
                                      "format": {
                                        "enum": [
                                          "text",
                                          "image",
                                          "video",
                                          "gif",
                                          "document",
                                          "location"
                                        ],
                                        "type": "string"
                                      },
                                      "text": {
                                        "description": "Header text (may include {{1}} variable). Used when format is TEXT.",
                                        "type": "string"
                                      },
                                      "type": {
                                        "enum": [
                                          "header"
                                        ],
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "format"
                                    ],
                                    "type": "object"
                                  },
                                  {
                                    "properties": {
                                      "add_security_recommendation": {
                                        "description": "Add security recommendation text (authentication templates only)",
                                        "type": "boolean"
                                      },
                                      "example": {
                                        "properties": {
                                          "body_text": {
                                            "description": "Sample values for body variables (array of arrays)",
                                            "items": {
                                              "items": {
                                                "type": "string"
                                              },
                                              "type": "array"
                                            },
                                            "type": "array"
                                          },
                                          "body_text_named_params": {
                                            "description": "Sample values for NAMED body variables (templates using {{customer_name}}-style tokens with parameter_format: NAMED).",
                                            "items": {
                                              "properties": {
                                                "example": {
                                                  "description": "Sample value for this variable.",
                                                  "type": "string"
                                                },
                                                "param_name": {
                                                  "description": "Variable name as it appears in the text, without braces (e.g. customer_name for {{customer_name}}).",
                                                  "pattern": "^[a-z0-9_]+$",
                                                  "type": "string"
                                                }
                                              },
                                              "required": [
                                                "param_name",
                                                "example"
                                              ],
                                              "type": "object"
                                            },
                                            "type": "array"
                                          }
                                        },
                                        "type": "object"
                                      },
                                      "text": {
                                        "description": "Body text with optional {{n}} variables",
                                        "type": "string"
                                      },
                                      "type": {
                                        "enum": [
                                          "body"
                                        ],
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "text"
                                    ],
                                    "type": "object"
                                  },
                                  {
                                    "properties": {
                                      "buttons": {
                                        "items": {
                                          "properties": {
                                            "autofill_text": {
                                              "type": "string"
                                            },
                                            "example": {
                                              "description": "Example value(s). Accepts either a string or an array of strings. For URL buttons, an array of URL-suffix samples; for copy_code (marketing) buttons, the coupon code as a single string. Left untyped (string | string[]) on purpose: a typed oneOf of string-vs-array breaks several SDK code generators."
                                            },
                                            "flow_action": {
                                              "type": "string"
                                            },
                                            "flow_id": {
                                              "type": "string"
                                            },
                                            "flow_json": {
                                              "type": "string"
                                            },
                                            "flow_name": {
                                              "type": "string"
                                            },
                                            "navigate_screen": {
                                              "type": "string"
                                            },
                                            "otp_type": {
                                              "description": "Required when type is otp",
                                              "enum": [
                                                "copy_code",
                                                "one_tap",
                                                "zero_tap"
                                              ],
                                              "type": "string"
                                            },
                                            "package_name": {
                                              "type": "string"
                                            },
                                            "phone_number": {
                                              "description": "Required when type is phone_number",
                                              "type": "string"
                                            },
                                            "signature_hash": {
                                              "type": "string"
                                            },
                                            "text": {
                                              "description": "Visible button label. Required for all types except copy_code (whose label is fixed by WhatsApp) and otp (omit it and WhatsApp supplies its own label, localized to the template language; an English label on a non-English template is rejected).",
                                              "type": "string"
                                            },
                                            "type": {
                                              "enum": [
                                                "quick_reply",
                                                "url",
                                                "phone_number",
                                                "otp",
                                                "copy_code",
                                                "flow",
                                                "mpm",
                                                "catalog"
                                              ],
                                              "type": "string"
                                            },
                                            "url": {
                                              "description": "Required when type is URL",
                                              "format": "uri",
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "type"
                                          ],
                                          "type": "object"
                                        },
                                        "minItems": 1,
                                        "type": "array"
                                      },
                                      "type": {
                                        "enum": [
                                          "buttons"
                                        ],
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "buttons"
                                    ],
                                    "type": "object"
                                  }
                                ]
                              },
                              "minItems": 1,
                              "type": "array"
                            }
                          },
                          "required": [
                            "components"
                          ],
                          "type": "object"
                        },
                        "maxItems": 10,
                        "minItems": 2,
                        "type": "array"
                      },
                      "type": {
                        "enum": [
                          "carousel"
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "cards"
                    ],
                    "type": "object"
                  },
                  {
                    "properties": {
                      "limited_time_offer": {
                        "properties": {
                          "has_expiration": {
                            "description": "Toggles the countdown timer. The actual coupon code + expiry are bound at SEND time, not here.",
                            "type": "boolean"
                          },
                          "text": {
                            "description": "Short offer label (<=16 chars). MARKETING only.",
                            "maxLength": 16,
                            "minLength": 1,
                            "type": "string"
                          }
                        },
                        "required": [
                          "text"
                        ],
                        "type": "object"
                      },
                      "type": {
                        "enum": [
                          "limited_time_offer"
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "limited_time_offer"
                    ],
                    "type": "object"
                  }
                ]
              },
              "minItems": 1,
              "type": "array"
            },
            "connectionId": {
              "description": "The connection, when not sent as the connectionId query parameter.",
              "pattern": "^msc_[0-9A-Za-z]+$",
              "type": "string"
            },
            "message_send_ttl_seconds": {
              "description": "Delivery validity window in seconds: a message not delivered within it is dropped.\n\n**Range by category:**\n\n- AUTHENTICATION: 30 to 900. - UTILITY: 30 to 43200 (12h). - MARKETING: 43200 to 2592000 (30 days).\n\nThe value -1 is not accepted here (Meta treats it as an empty edit); send a value in range. Meta defaults to 600 for AUTHENTICATION and 30 days otherwise.\n\nA TTL-only edit keeps an APPROVED template approved, with no re-review. If Meta later recategorises the template, it clears the TTL (read it back to check).",
              "type": "integer"
            }
          },
          "type": "object"
        }
      }
    },
    "required": true
  },
  "x-aisa-status": "enabled",
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  }
}
```

## Cost and request rules

No additional charge for this operation.


## OpenAPI

````yaml openapi/aisa-messaging.json PATCH /apis/v1/social/messaging/whatsapp/templates/id/{templateId}
openapi: 3.1.0
info:
  description: ''
  title: AIsa Messaging
  version: '1'
  x-aisa-capabilities:
    idempotency: Idempotency-Key
    max_price: X-AISA-Max-Price-USD
    quote:
      header: X-AISA-Cost-Mode
      value: quote
  x-aisa-catalogs:
    aisa-messaging:
      description: ''
      title: AIsa Messaging
      x-aisa-capabilities:
        idempotency: Idempotency-Key
        max_price: X-AISA-Max-Price-USD
        quote:
          header: X-AISA-Cost-Mode
          value: quote
      x-aisa-document:
        facts_hash: 3f75dbfba86cc5ac46b20ee9310446322890eeeb034619f5c221a47d6b1064a2
        generator_version: '3'
        protocol_version: '1'
        schema_version: '1'
      x-aisa-plans:
        builder: 1
        display_plan: payg
        payg: 1
        similarweb_payg: 1
        team: 1
        version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
  x-aisa-configured-paths: []
  x-aisa-document:
    composer_version: '31'
    document_hash: sha256:989b0c03378fa66fa7653d6c34e54850322e6be4bc7d9f0f130ac18a459676eb
    facts_hash: 3f75dbfba86cc5ac46b20ee9310446322890eeeb034619f5c221a47d6b1064a2
    generator_version: '3'
    protocol_version: '1'
    response_pending: []
    schema_version: '1'
  x-aisa-plans:
    builder: 1
    display_plan: payg
    payg: 1
    similarweb_payg: 1
    team: 1
    version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
  x-aisa-provider: aisa-messaging
servers:
  - url: https://api.aisa.one
security:
  - bearerAuth: []
paths:
  /apis/v1/social/messaging/whatsapp/templates/id/{templateId}:
    patch:
      summary: Update template by id
      description: >-
        WhatsApp. Update one variant's components and/or its
        message_send_ttl_seconds by its Meta id. Name, language and category
        cannot change.


        ### Editing limits


        - Meta only allows editing templates in `APPROVED`, `REJECTED` or
        `PAUSED` state. - An approved template can be edited once per 24 hours
        and up to 10 times per 30 days. - A variant already in `PENDING` cannot
        be edited again until Meta finishes reviewing it.


        ### Review


        A component update sends the variant back to Meta for review, so the
        `status` returned here is normally `PENDING`. A TTL-only update keeps an
        APPROVED variant approved.


        A write: needs messaging:write and is audited.
      operationId: patch_aisa_messaging_apis_v1_social_messaging_wha_443769
      parameters:
        - description: Meta template id (numeric).
          in: path
          name: templateId
          required: true
          schema:
            type: string
        - description: >-
            Your messaging connection (msc_...), from GET
            /apis/v1/social/messaging/connections. On a request with a JSON body
            it may be sent as a top-level body member instead.
          in: query
          name: connectionId
          required: true
          schema:
            pattern: ^msc_[0-9A-Za-z]+$
            type: string
      requestBody:
        content:
          application/json:
            example:
              components:
                - format: text
                  type: header
              message_send_ttl_seconds: 1
            schema:
              additionalProperties: false
              properties:
                components:
                  description: >-
                    Updated template components. Optional when only
                    message_send_ttl_seconds changes; at least one of the two is
                    required.
                  items:
                    oneOf:
                      - properties:
                          example:
                            properties:
                              header_handle:
                                description: >-
                                  When the header format is a media type (image,
                                  video, gif, document), provide a public URL
                                  here.
                                items:
                                  format: uri
                                  type: string
                                maxItems: 1
                                minItems: 1
                                type: array
                              header_text:
                                description: Sample values for header text variables
                                items:
                                  type: string
                                type: array
                              header_text_named_params:
                                description: >-
                                  Sample values for NAMED header variables
                                  (templates using {{customer_name}}-style
                                  tokens with parameter_format: NAMED).
                                items:
                                  properties:
                                    example:
                                      description: Sample value for this variable.
                                      type: string
                                    param_name:
                                      description: >-
                                        Variable name as it appears in the text,
                                        without braces (e.g. customer_name for
                                        {{customer_name}}).
                                      pattern: ^[a-z0-9_]+$
                                      type: string
                                  required:
                                    - param_name
                                    - example
                                  type: object
                                type: array
                            type: object
                          format:
                            enum:
                              - text
                              - image
                              - video
                              - gif
                              - document
                              - location
                            type: string
                          text:
                            description: >-
                              Header text (may include {{1}} variable). Used
                              when format is TEXT.
                            type: string
                          type:
                            enum:
                              - header
                            type: string
                        required:
                          - type
                          - format
                        type: object
                      - properties:
                          add_security_recommendation:
                            description: >-
                              Add security recommendation text (authentication
                              templates only)
                            type: boolean
                          example:
                            properties:
                              body_text:
                                description: >-
                                  Sample values for body variables (array of
                                  arrays)
                                items:
                                  items:
                                    type: string
                                  type: array
                                type: array
                              body_text_named_params:
                                description: >-
                                  Sample values for NAMED body variables
                                  (templates using {{customer_name}}-style
                                  tokens with parameter_format: NAMED).
                                items:
                                  properties:
                                    example:
                                      description: Sample value for this variable.
                                      type: string
                                    param_name:
                                      description: >-
                                        Variable name as it appears in the text,
                                        without braces (e.g. customer_name for
                                        {{customer_name}}).
                                      pattern: ^[a-z0-9_]+$
                                      type: string
                                  required:
                                    - param_name
                                    - example
                                  type: object
                                type: array
                            type: object
                          text:
                            description: Body text with optional {{n}} variables
                            type: string
                          type:
                            enum:
                              - body
                            type: string
                        required:
                          - type
                          - text
                        type: object
                      - properties:
                          code_expiration_minutes:
                            description: >-
                              OTP code expiry in minutes (authentication
                              templates only)
                            minimum: 1
                            type: integer
                          text:
                            description: Static footer text
                            type: string
                          type:
                            enum:
                              - footer
                            type: string
                        required:
                          - type
                        type: object
                      - properties:
                          buttons:
                            items:
                              properties:
                                autofill_text:
                                  type: string
                                example:
                                  description: >-
                                    Example value(s). Accepts either a string or
                                    an array of strings. For URL buttons, an
                                    array of URL-suffix samples; for copy_code
                                    (marketing) buttons, the coupon code as a
                                    single string. Left untyped (string |
                                    string[]) on purpose: a typed oneOf of
                                    string-vs-array breaks several SDK code
                                    generators.
                                flow_action:
                                  type: string
                                flow_id:
                                  type: string
                                flow_json:
                                  type: string
                                flow_name:
                                  type: string
                                navigate_screen:
                                  type: string
                                otp_type:
                                  description: Required when type is otp
                                  enum:
                                    - copy_code
                                    - one_tap
                                    - zero_tap
                                  type: string
                                package_name:
                                  type: string
                                phone_number:
                                  description: Required when type is phone_number
                                  type: string
                                signature_hash:
                                  type: string
                                text:
                                  description: >-
                                    Visible button label. Required for all types
                                    except copy_code (whose label is fixed by
                                    WhatsApp) and otp (omit it and WhatsApp
                                    supplies its own label, localized to the
                                    template language; an English label on a
                                    non-English template is rejected).
                                  type: string
                                type:
                                  enum:
                                    - quick_reply
                                    - url
                                    - phone_number
                                    - otp
                                    - copy_code
                                    - flow
                                    - mpm
                                    - catalog
                                  type: string
                                url:
                                  description: Required when type is URL
                                  format: uri
                                  type: string
                              required:
                                - type
                              type: object
                            minItems: 1
                            type: array
                          type:
                            enum:
                              - buttons
                            type: string
                        required:
                          - type
                          - buttons
                        type: object
                      - properties:
                          cards:
                            description: >-
                              2-10 cards. Meta requires all cards to share the
                              same component structure; a mismatch surfaces as a
                              rejected_reason. MARKETING category only.
                            items:
                              properties:
                                components:
                                  description: >-
                                    Per-card components. Each card carries its
                                    own media header + optional body + up to 2
                                    buttons. Footer and nested carousel are not
                                    allowed inside cards.
                                  items:
                                    oneOf:
                                      - properties:
                                          example:
                                            properties:
                                              header_handle:
                                                description: >-
                                                  When the header format is a media type
                                                  (image, video, gif, document), provide a
                                                  public URL here.
                                                items:
                                                  format: uri
                                                  type: string
                                                maxItems: 1
                                                minItems: 1
                                                type: array
                                              header_text:
                                                description: Sample values for header text variables
                                                items:
                                                  type: string
                                                type: array
                                              header_text_named_params:
                                                description: >-
                                                  Sample values for NAMED header variables
                                                  (templates using {{customer_name}}-style
                                                  tokens with parameter_format: NAMED).
                                                items:
                                                  properties:
                                                    example:
                                                      description: Sample value for this variable.
                                                      type: string
                                                    param_name:
                                                      description: >-
                                                        Variable name as it appears in the text,
                                                        without braces (e.g. customer_name for
                                                        {{customer_name}}).
                                                      pattern: ^[a-z0-9_]+$
                                                      type: string
                                                  required:
                                                    - param_name
                                                    - example
                                                  type: object
                                                type: array
                                            type: object
                                          format:
                                            enum:
                                              - text
                                              - image
                                              - video
                                              - gif
                                              - document
                                              - location
                                            type: string
                                          text:
                                            description: >-
                                              Header text (may include {{1}}
                                              variable). Used when format is TEXT.
                                            type: string
                                          type:
                                            enum:
                                              - header
                                            type: string
                                        required:
                                          - type
                                          - format
                                        type: object
                                      - properties:
                                          add_security_recommendation:
                                            description: >-
                                              Add security recommendation text
                                              (authentication templates only)
                                            type: boolean
                                          example:
                                            properties:
                                              body_text:
                                                description: >-
                                                  Sample values for body variables (array
                                                  of arrays)
                                                items:
                                                  items:
                                                    type: string
                                                  type: array
                                                type: array
                                              body_text_named_params:
                                                description: >-
                                                  Sample values for NAMED body variables
                                                  (templates using {{customer_name}}-style
                                                  tokens with parameter_format: NAMED).
                                                items:
                                                  properties:
                                                    example:
                                                      description: Sample value for this variable.
                                                      type: string
                                                    param_name:
                                                      description: >-
                                                        Variable name as it appears in the text,
                                                        without braces (e.g. customer_name for
                                                        {{customer_name}}).
                                                      pattern: ^[a-z0-9_]+$
                                                      type: string
                                                  required:
                                                    - param_name
                                                    - example
                                                  type: object
                                                type: array
                                            type: object
                                          text:
                                            description: Body text with optional {{n}} variables
                                            type: string
                                          type:
                                            enum:
                                              - body
                                            type: string
                                        required:
                                          - type
                                          - text
                                        type: object
                                      - properties:
                                          buttons:
                                            items:
                                              properties:
                                                autofill_text:
                                                  type: string
                                                example:
                                                  description: >-
                                                    Example value(s). Accepts either a
                                                    string or an array of strings. For URL
                                                    buttons, an array of URL-suffix samples;
                                                    for copy_code (marketing) buttons, the
                                                    coupon code as a single string. Left
                                                    untyped (string | string[]) on purpose:
                                                    a typed oneOf of string-vs-array breaks
                                                    several SDK code generators.
                                                flow_action:
                                                  type: string
                                                flow_id:
                                                  type: string
                                                flow_json:
                                                  type: string
                                                flow_name:
                                                  type: string
                                                navigate_screen:
                                                  type: string
                                                otp_type:
                                                  description: Required when type is otp
                                                  enum:
                                                    - copy_code
                                                    - one_tap
                                                    - zero_tap
                                                  type: string
                                                package_name:
                                                  type: string
                                                phone_number:
                                                  description: Required when type is phone_number
                                                  type: string
                                                signature_hash:
                                                  type: string
                                                text:
                                                  description: >-
                                                    Visible button label. Required for all
                                                    types except copy_code (whose label is
                                                    fixed by WhatsApp) and otp (omit it and
                                                    WhatsApp supplies its own label,
                                                    localized to the template language; an
                                                    English label on a non-English template
                                                    is rejected).
                                                  type: string
                                                type:
                                                  enum:
                                                    - quick_reply
                                                    - url
                                                    - phone_number
                                                    - otp
                                                    - copy_code
                                                    - flow
                                                    - mpm
                                                    - catalog
                                                  type: string
                                                url:
                                                  description: Required when type is URL
                                                  format: uri
                                                  type: string
                                              required:
                                                - type
                                              type: object
                                            minItems: 1
                                            type: array
                                          type:
                                            enum:
                                              - buttons
                                            type: string
                                        required:
                                          - type
                                          - buttons
                                        type: object
                                  minItems: 1
                                  type: array
                              required:
                                - components
                              type: object
                            maxItems: 10
                            minItems: 2
                            type: array
                          type:
                            enum:
                              - carousel
                            type: string
                        required:
                          - type
                          - cards
                        type: object
                      - properties:
                          limited_time_offer:
                            properties:
                              has_expiration:
                                description: >-
                                  Toggles the countdown timer. The actual coupon
                                  code + expiry are bound at SEND time, not
                                  here.
                                type: boolean
                              text:
                                description: >-
                                  Short offer label (<=16 chars). MARKETING
                                  only.
                                maxLength: 16
                                minLength: 1
                                type: string
                            required:
                              - text
                            type: object
                          type:
                            enum:
                              - limited_time_offer
                            type: string
                        required:
                          - type
                          - limited_time_offer
                        type: object
                  minItems: 1
                  type: array
                connectionId:
                  description: >-
                    The connection, when not sent as the connectionId query
                    parameter.
                  pattern: ^msc_[0-9A-Za-z]+$
                  type: string
                message_send_ttl_seconds:
                  description: >-
                    Delivery validity window in seconds: a message not delivered
                    within it is dropped.


                    **Range by category:**


                    - AUTHENTICATION: 30 to 900. - UTILITY: 30 to 43200 (12h). -
                    MARKETING: 43200 to 2592000 (30 days).


                    The value -1 is not accepted here (Meta treats it as an
                    empty edit); send a value in range. Meta defaults to 600 for
                    AUTHENTICATION and 30 days otherwise.


                    A TTL-only edit keeps an APPROVED template approved, with no
                    re-review. If Meta later recategorises the template, it
                    clears the TTL (read it back to check).
                  type: integer
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  success:
                    type: boolean
                  template:
                    properties:
                      id:
                        type: string
                      language:
                        type: string
                      name:
                        type: string
                      status:
                        description: >-
                          Approval state read back from Meta after the update,
                          normally PENDING. If the state cannot be read back,
                          the last known status is returned instead.
                        type: string
                    type: object
                type: object
          description: Success
        default:
          content:
            application/json:
              schema:
                properties:
                  error:
                    properties:
                      code:
                        type:
                          - string
                          - 'null'
                      details:
                        additionalProperties: {}
                        type:
                          - object
                          - 'null'
                      message:
                        type:
                          - string
                          - 'null'
                      param:
                        type:
                          - string
                          - 'null'
                      retryHint:
                        type:
                          - string
                          - 'null'
                      retryable:
                        type:
                          - boolean
                          - 'null'
                      type:
                        type:
                          - string
                          - 'null'
                    type:
                      - object
                      - 'null'
                type: object
          description: Error. The code field is stable; see the error catalog.
components:
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````

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