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

# Create Template

> Create a new WhatsApp message template

## Authentication

<ParamField header="X-API-Key" type="string" required>
  Your API key for authentication
</ParamField>

## Request Body

<ParamField body="name" type="string" required="true">
  Template name (lowercase, underscore separated)
</ParamField>

<ParamField body="category" type="string" required="true">
  Template category: `MARKETING`, `UTILITY`, or `AUTHENTICATION`
</ParamField>

<ParamField body="language" type="string" required="true">
  Language code (e.g., `en`, `en_US`)
</ParamField>

<ParamField body="components" type="array" required>
  Array of template components (header, body, footer, buttons)

  <Expandable title="Component Object Properties">
    <ParamField body="type" type="string" required>
      Component type: `HEADER`, `BODY`, `FOOTER`, `BUTTONS`
    </ParamField>

    <ParamField body="format" type="string">
      Header format when type=HEADER: `TEXT`, `IMAGE`, `VIDEO`, `DOCUMENT`,
      `LOCATION`
    </ParamField>

    <ParamField body="text" type="string">
      Text content for BODY/FOOTER or HEADER when format=TEXT
    </ParamField>

    <ParamField body="example" type="object">
      Examples and named parameters for dynamic content

      <Expandable title="Example Properties">
        <ParamField body="header_text_named_params" type="array">
          Array of header parameter objects

          <Expandable title="Parameter Object">
            <ParamField body="param_name" type="string" required>
              Parameter name used in template placeholders
            </ParamField>

            <ParamField body="example" type="string" required>
              Example value for the parameter
            </ParamField>
          </Expandable>
        </ParamField>

        <ParamField body="body_text_named_params" type="array">
          Array of body parameter objects

          <Expandable title="Parameter Object">
            <ParamField body="param_name" type="string" required>
              Parameter name used in template placeholders
            </ParamField>

            <ParamField body="example" type="string" required>
              Example value for the parameter
            </ParamField>
          </Expandable>
        </ParamField>

        <ParamField body="header_handle" type="object|array">
          Media handle/reference for header images or videos
        </ParamField>

        <ParamField body="link" type="string">
          Example link URL for dynamic button URLs
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="buttons" type="array">
      Array of button objects (for BUTTONS component type)

      <Expandable title="Button Object Properties">
        <ParamField body="text" type="string" required>
          Button display text
        </ParamField>

        <ParamField body="type" type="string" required>
          Button type: `URL`, `PHONE_NUMBER`, `QUICK_REPLY`, `COPY_CODE`,
          `FLOW`, `MPM`, `OTP`, `VOICE_CALL`
        </ParamField>

        <ParamField body="url" type="string">
          URL for URL type buttons
        </ParamField>

        <ParamField body="phone_number" type="string">
          Phone number for PHONE\_NUMBER buttons (E.164 format)
        </ParamField>

        <ParamField body="example" type="string">
          Example text or URL parameter value
        </ParamField>

        <ParamField body="autofill_text" type="string">
          Text auto-filled when button is clicked
        </ParamField>

        <ParamField body="flow_action" type="string">
          Flow action identifier for WhatsApp Flows
        </ParamField>

        <ParamField body="flow_id" type="string">
          Flow ID for WhatsApp Flows integration
        </ParamField>

        <ParamField body="navigate_screen" type="string">
          Screen to navigate to in flow
        </ParamField>

        <ParamField body="icon" type="string">
          Icon identifier or URL
        </ParamField>

        <ParamField body="otp_type" type="string">
          OTP type: `ONE_TAP`, `ZERO_TAP`, `COPY_CODE`
        </ParamField>

        <ParamField body="zero_tap_terms_accepted" type="boolean">
          Terms acceptance flag for zero-tap authentication
        </ParamField>

        <ParamField body="supported_apps" type="array">
          Array of supported app identifiers for the button
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://backend.conversales.in/api/v1/createTemplate" \
    -H "X-API-Key: 3kJ9mP2nQ8rT5vW7xY1zA4bC6dE8fG0hI" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "order_confirmation",
      "category": "UTILITY",
      "language": "en",
      "components": [
        {
          "type": "HEADER",
          "format": "TEXT",
          "text": "Order #{{1}} confirmed",
          "example": {
            "header_text_named_params": [
              { "param_name": "order_id", "example": "#12345" }
            ]
          }
        },
        {
          "type": "BODY",
          "text": "Hi {{1}}, your order for {{2}} has been confirmed and will arrive by {{3}}.",
          "example": {
            "body_text_named_params": [
              { "param_name": "customer_name", "example": "Jane" },
              { "param_name": "product_name", "example": "Wireless earbuds" },
              { "param_name": "delivery_date", "example": "2025-11-05" }
            ]
          }
        },
        {
          "type": "BUTTONS",
          "buttons": [
            { "text": "View Order", "type": "URL", "url": "https://shop.example.com/orders/12345" },
            { "text": "Contact Support", "type": "PHONE_NUMBER", "phone_number": "+15551234567" }
          ]
        }
      ]
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://backend.conversales.in/api/v1/createTemplate",
    {
      method: "POST",
      headers: {
        "X-API-Key": "3kJ9mP2nQ8rT5vW7xY1zA4bC6dE8fG0hI",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        name: "order_confirmation",
        category: "UTILITY",
        language: "en",
        components: [
          {
            type: "HEADER",
            format: "TEXT",
            text: "Order #{{1}} confirmed",
            example: {
              header_text_named_params: [
                { param_name: "order_id", example: "#12345" },
              ],
            },
          },
          {
            type: "BODY",
            text: "Hi {{1}}, your order for {{2}} has been confirmed and will arrive by {{3}}.",
            example: {
              body_text_named_params: [
                { param_name: "customer_name", example: "Jane" },
                { param_name: "product_name", example: "Wireless earbuds" },
                { param_name: "delivery_date", example: "2025-11-05" },
              ],
            },
          },
          {
            type: "BUTTONS",
            buttons: [
              {
                text: "View Order",
                type: "URL",
                url: "https://shop.example.com/orders/12345",
              },
              {
                text: "Contact Support",
                type: "PHONE_NUMBER",
                phone_number: "+15551234567",
              },
            ],
          },
        ],
      }),
    }
  );
  ```

  ```python Python theme={null}
  import requests

  url = "https://backend.conversales.in/api/v1/createTemplate"
  headers = {"X-API-Key": "3kJ9mP2nQ8rT5vW7xY1zA4bC6dE8fG0hI", "Content-Type": "application/json"}
  payload = {
      "name": "order_confirmation",
      "category": "UTILITY",
      "language": "en",
      "components": [
          {
              "type": "HEADER",
              "format": "TEXT",
              "text": "Order #{{1}} confirmed",
              "example": {"header_text_named_params": [{"param_name": "order_id", "example": "#12345"}]}
          },
          {
              "type": "BODY",
              "text": "Hi {{1}}, your order for {{2}} has been confirmed and will arrive by {{3}}.",
              "example": {"body_text_named_params": [{"param_name": "customer_name", "example": "Jane"}, {"param_name": "product_name", "example": "Wireless earbuds"}, {"param_name": "delivery_date", "example": "2025-11-05"}]}
          },
          {
              "type": "BUTTONS",
              "buttons": [
                  {"text": "View Order", "type": "URL", "url": "https://shop.example.com/orders/12345"},
                  {"text": "Contact Support", "type": "PHONE_NUMBER", "phone_number": "+15551234567"}
              ]
          }
      ]
  }

  response = requests.post(url, json=payload, headers=headers)
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "statusCode": 200,
    "message": "Template created successfully",
    "data": {
      "templateId": "template_123456",
      "name": "welcome_message",
      "status": "PENDING",
      "category": "MARKETING"
    }
  }
  ```
</ResponseExample>

<Note>
  Templates must be approved by WhatsApp before use. Approval typically takes
  24-48 hours.
</Note>
