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

# Authentication Templates

> Send one-time passcodes with authentication templates.

Authentication templates deliver one-time passcodes. Meta writes the body text itself ("*123456* is your verification code."), so you only send the code.

Send the code twice:

* In the `body` component, as the single `text` parameter.
* In the OTP button component, with `sub_type: "url"` and `index: "0"`. This applies to every OTP button type — Copy Code, One-Tap, and Zero-Tap.

> [!NOTE]
>
> Create authentication templates with an OTP button. See [Create Template](https://docs.gateway.connexease.com/public-api-reference/template/create-template.md) (category `AUTHENTICATION`) or the panel's [Create Template](https://docs.gateway.connexease.com/dashboard/app/templates.md) guide.

## Send an OTP

```bash cURL theme={null}
curl -X POST https://api.gateway.connexease.com/v1/wa/message \
  -H "Authorization: Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "messaging_product": "whatsapp",
    "to": "905321234567",
    "type": "template",
    "template": {
      "name": "login_otp",
      "language": { "code": "en" },
      "components": [
        {
          "type": "body",
          "parameters": [{ "type": "text", "text": "847291" }]
        },
        {
          "type": "button",
          "sub_type": "url",
          "index": "0",
          "parameters": [{ "type": "text", "text": "847291" }]
        }
      ]
    }
  }'
```

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

code = "847291"

requests.post(
    "https://api.gateway.connexease.com/v1/wa/message",
    headers={"Authorization": "Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "Content-Type": "application/json"},
    json={
        "messaging_product": "whatsapp",
        "to": "905321234567",
        "type": "template",
        "template": {
            "name": "login_otp",
            "language": {"code": "en"},
            "components": [
                {"type": "body", "parameters": [{"type": "text", "text": code}]},
                {"type": "button", "sub_type": "url", "index": "0",
                 "parameters": [{"type": "text", "text": code}]}
            ]
        }
    }
)
```

```javascript Node.js theme={null}
const code = '847291';

await fetch('https://api.gateway.connexease.com/v1/wa/message', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    messaging_product: 'whatsapp',
    to: '905321234567',
    type: 'template',
    template: {
      name: 'login_otp',
      language: { code: 'en' },
      components: [
        { type: 'body', parameters: [{ type: 'text', text: code }] },
        { type: 'button', sub_type: 'url', index: '0', parameters: [{ type: 'text', text: code }] }
      ]
    }
  }),
});
```

***

## Notes

> [!WARNING]
>
> The code is limited to 15 characters. Use the same value in both components — a mismatch is not rejected, but the customer sees one code and copies another.

> [!TIP]
>
> Set a short message TTL on the template (`messageSendTtlSeconds`, 30–900 seconds) so expired codes are never delivered late.


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