> ## 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

# Create template

> WhatsApp. Create a new message template. Supports two modes:

Custom template: Provide components with your own content. Submitted to Meta for review (can take up to 24h).

Library template: Provide library_template_name instead of components to use a pre-built template
from Meta's template library. Library templates are pre-approved (no review wait). You can optionally
customize parameters and buttons via library_template_body_inputs and library_template_button_inputs.

A write: needs messaging:write and is audited.

## Request contract

* **Method and path:** POST /apis/v1/social/messaging/whatsapp/templates
* **Availability:** enabled
* **Request URL template:** `https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates`
* **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": "post_aisa_messaging_apis_v1_social_messaging_what_d4bd65",
  "method": "POST",
  "path": "/apis/v1/social/messaging/whatsapp/templates",
  "servers": [
    {
      "url": "https://api.aisa.one"
    }
  ],
  "parameters": [
    {
      "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": {
          "category": "AUTHENTICATION",
          "language": "example",
          "name": "example"
        },
        "schema": {
          "additionalProperties": false,
          "properties": {
            "category": {
              "description": "Template category",
              "enum": [
                "AUTHENTICATION",
                "MARKETING",
                "UTILITY"
              ],
              "type": "string"
            },
            "components": {
              "description": "Template components (header, body, footer, buttons, carousel, limited_time_offer). Required for custom templates, omit when using library_template_name.",
              "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"
            },
            "language": {
              "description": "Template language code (e.g., en_US)",
              "type": "string"
            },
            "library_template_body_inputs": {
              "description": "Optional body customizations for library templates. Available options depend on the\ntemplate (e.g., add_contact_number, add_learn_more_link, add_security_recommendation,\nadd_track_package_link, code_expiration_minutes).",
              "type": "object"
            },
            "library_template_button_inputs": {
              "description": "Optional button customizations for library templates. Each item specifies button type\nand configuration (e.g., URL, phone number, quick reply).",
              "items": {
                "properties": {
                  "phone_number": {
                    "type": "string"
                  },
                  "type": {
                    "enum": [
                      "quick_reply",
                      "url",
                      "phone_number"
                    ],
                    "type": "string"
                  },
                  "url": {
                    "properties": {
                      "base_url": {
                        "type": "string"
                      }
                    },
                    "type": "object"
                  }
                },
                "type": "object"
              },
              "type": "array"
            },
            "library_template_name": {
              "description": "Name of a pre-built template from Meta's template library (e.g., \"appointment_reminder\",\n\"auto_pay_reminder_1\", \"address_update\"). When provided, the template is pre-approved\nby Meta with no review wait. Omit components when using this field.",
              "type": "string"
            },
            "message_send_ttl_seconds": {
              "description": "Delivery validity window in seconds: a message not delivered within it is dropped. Range by category:\n\n- AUTHENTICATION: 30 to 900. - UTILITY: 30 to 43200 (12h). - MARKETING: 43200 to 2592000 (30 days).\n\n-1 (create only) keeps the 30-day default on AUTHENTICATION and UTILITY. Meta defaults to 600 for AUTHENTICATION and 30 days otherwise. If Meta later recategorises the template, it clears the TTL (read it back to check).",
              "type": "integer"
            },
            "name": {
              "description": "Template name (lowercase, letters/numbers/underscores, must start with a letter)",
              "pattern": "^[a-z][a-z0-9_]*$",
              "type": "string"
            },
            "parameter_format": {
              "description": "Variable style: POSITIONAL ({{1}}, the default) or NAMED ({{customer_name}}). Named templates provide examples via body_text_named_params / header_text_named_params. Inferred as NAMED when omitted but a named-params example is present.",
              "enum": [
                "POSITIONAL",
                "NAMED",
                "positional",
                "named"
              ],
              "type": "string"
            }
          },
          "required": [
            "name",
            "category",
            "language"
          ],
          "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 POST /apis/v1/social/messaging/whatsapp/templates
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:
    post:
      summary: Create template
      description: >-
        WhatsApp. Create a new message template. Supports two modes:


        Custom template: Provide components with your own content. Submitted to
        Meta for review (can take up to 24h).


        Library template: Provide library_template_name instead of components to
        use a pre-built template

        from Meta's template library. Library templates are pre-approved (no
        review wait). You can optionally

        customize parameters and buttons via library_template_body_inputs and
        library_template_button_inputs.


        A write: needs messaging:write and is audited.
      operationId: post_aisa_messaging_apis_v1_social_messaging_what_d4bd65
      parameters:
        - 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:
              category: AUTHENTICATION
              language: example
              name: example
            schema:
              additionalProperties: false
              properties:
                category:
                  description: Template category
                  enum:
                    - AUTHENTICATION
                    - MARKETING
                    - UTILITY
                  type: string
                components:
                  description: >-
                    Template components (header, body, footer, buttons,
                    carousel, limited_time_offer). Required for custom
                    templates, omit when using library_template_name.
                  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
                language:
                  description: Template language code (e.g., en_US)
                  type: string
                library_template_body_inputs:
                  description: >-
                    Optional body customizations for library templates.
                    Available options depend on the

                    template (e.g., add_contact_number, add_learn_more_link,
                    add_security_recommendation,

                    add_track_package_link, code_expiration_minutes).
                  type: object
                library_template_button_inputs:
                  description: >-
                    Optional button customizations for library templates. Each
                    item specifies button type

                    and configuration (e.g., URL, phone number, quick reply).
                  items:
                    properties:
                      phone_number:
                        type: string
                      type:
                        enum:
                          - quick_reply
                          - url
                          - phone_number
                        type: string
                      url:
                        properties:
                          base_url:
                            type: string
                        type: object
                    type: object
                  type: array
                library_template_name:
                  description: >-
                    Name of a pre-built template from Meta's template library
                    (e.g., "appointment_reminder",

                    "auto_pay_reminder_1", "address_update"). When provided, the
                    template is pre-approved

                    by Meta with no review wait. Omit components when using this
                    field.
                  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).


                    -1 (create only) keeps the 30-day default on AUTHENTICATION
                    and UTILITY. Meta defaults to 600 for AUTHENTICATION and 30
                    days otherwise. If Meta later recategorises the template, it
                    clears the TTL (read it back to check).
                  type: integer
                name:
                  description: >-
                    Template name (lowercase, letters/numbers/underscores, must
                    start with a letter)
                  pattern: ^[a-z][a-z0-9_]*$
                  type: string
                parameter_format:
                  description: >-
                    Variable style: POSITIONAL ({{1}}, the default) or NAMED
                    ({{customer_name}}). Named templates provide examples via
                    body_text_named_params / header_text_named_params. Inferred
                    as NAMED when omitted but a named-params example is present.
                  enum:
                    - POSITIONAL
                    - NAMED
                    - positional
                    - named
                  type: string
              required:
                - name
                - category
                - language
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  success:
                    type: boolean
                  template:
                    properties:
                      category:
                        type: string
                      id:
                        type: string
                      language:
                        type: string
                      message_send_ttl_seconds:
                        description: Echoed when supplied on the request.
                        type: integer
                      name:
                        type: string
                      status:
                        description: APPROVED for library templates, PENDING for custom
                        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.