# WhatsApp OTP: authentication templates with copy code and one-tap

> Send WhatsApp one-time passwords with authentication templates: copy code, one-tap and zero-tap buttons, the Android handshake, expiry, TTL and fees.

Published 2026-11-02. Z-API Omni team.

WhatsApp sends one-time passwords through authentication templates. The body text is fixed by Meta, and the template carries one OTP button of three types. A copy code button puts the code on the clipboard and works on Android and iOS. One-tap and zero-tap fill the code into your Android app, and both need a handshake from that app before you send. When a check fails, the user gets a copy code button instead. Authentication templates belong to the WhatsApp Cloud API, Meta's official API, and Meta charges them as their own category.

## Three button types

| Button | Platforms | Handshake | What the user does | If a check fails |
| --- | --- | --- | --- | --- |
| Copy code | Android and iOS | No | Taps, then pastes the code | Not applicable |
| One-tap | Android only | Yes | Taps once; your app receives the code | Copy code button |
| Zero-tap | Android only | Yes, plus terms accepted | Nothing; the code is broadcast to your app | One-tap, then copy code |

The body is "Fixed, non-customizable preset text": `<VERIFICATION_CODE> is your verification code.` ([authentication templates, accessed 2026-11-02](https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/authentication-templates/authentication-templates)). Two optional fields change it. `add_security_recommendation` on the body, set to true, adds Meta's security recommendation line. `code_expiration_minutes` on the footer adds an expiry notice, with a minimum of 1 and a maximum of 90.

On iOS 26 and later, the code can be filled with no integration on your side. Meta states that "On iOS 26 and later, Keyboard suggestions provide autofill with no integration required" ([one-tap autofill, accessed 2026-11-02](https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/authentication-templates/autofill-button-authentication-templates)).

## Create a copy code template

With copy code, "the WhatsApp client copies the password or code to the device's clipboard." The button text allows 25 characters and the code itself 15. "URLs, media, and emojis are not supported" ([copy code templates, accessed 2026-11-02](https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/authentication-templates/copy-code-button-authentication-templates)).

Meta's sample request contains `// Optional` comments that break the JSON. This version removes them, fills in example values, sets the API version to v26.0 and wraps the body in curl.

```bash
curl -X POST 'https://graph.facebook.com/v26.0/WHATSAPP_BUSINESS_ACCOUNT_ID/message_templates' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '
{
  "name": "login_code",
  "language": "en_US",
  "category": "authentication",
  "message_send_ttl_seconds": 600,
  "components": [
    { "type": "body", "add_security_recommendation": true },
    { "type": "footer", "code_expiration_minutes": 10 },
    {
      "type": "buttons",
      "buttons": [
        { "type": "otp", "otp_type": "copy_code", "text": "Copy code" }
      ]
    }
  ]
}'
```

You create the button with type `OTP`, and WhatsApp changes it to a URL button. That is why the send request addresses it as `sub_type: "url"`.

## Send the code

This is Meta's send sample with the placeholders renamed to upper case and the API version set to v26.0. The code goes in twice: once for the body, once for the button.

```bash
curl -X POST "https://graph.facebook.com/v26.0/WHATSAPP_BUSINESS_PHONE_NUMBER_ID/messages" \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '
{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "CUSTOMER_PHONE_NUMBER",
    "type": "template",
    "template": {
      "name": "TEMPLATE_NAME",
      "language": {
        "code": "TEMPLATE_LANGUAGE_CODE"
      },
      "components": [
        {
          "type": "body",
          "parameters": [
            {
              "type": "text",
              "text": "ONE_TIME_PASSWORD"
            }
          ]
        },
        {
          "type": "button",
          "sub_type": "url",
          "index": "0",
          "parameters": [
            {
              "type": "text",
              "text": "ONE_TIME_PASSWORD"
            }
          ]
        }
      ]
    }
}'
```

The `to` field must be a phone number. Meta's BSUID page says business-scoped user IDs work for every message type except one-tap, zero-tap and copy code authentication templates, "which require user phone numbers" ([business-scoped user IDs, accessed 2026-11-02](https://developers.facebook.com/documentation/business-messaging/whatsapp/business-scoped-user-ids)). Sending one to a BSUID returns error 131062, "Business-scoped User ID (BSUID) recipients are not supported for this message." Keep the [E.164](/academy/articles/whatsapp-phone-number-format-e164-normalization/) number on every account that logs in with WhatsApp.

Delivery goes to one device. By default, "authentication messages are only delivered to a user's primary WhatsApp device" on the Cloud API.

## One-tap and zero-tap need an Android handshake

"One-tap autofill buttons are only supported on Android", and "You must signal to the WhatsApp client to expect imminent delivery of a password or code." The order is fixed: "first perform the handshake, then call our API to send the authentication template message." Without the handshake, or when any check fails, "the delivered message will display a copy code button instead of a one-tap button."

Meta lists six eligibility checks, and all must pass. The handshake was "initiated no more than 10 minutes ago", or within `code_expiration_minutes` if you set it. The package name matches the intent, and no other app in `supported_apps` started a handshake. The signature hash matches the installed app. The template includes the one-tap button text, and your app defines an activity that receives the code.

The one-tap template adds three fields to the button: `"otp_type": "one_tap"`, an `autofill_text` of up to 25 characters, and `supported_apps`. That array takes up to 5 apps, each with a `package_name` and a `signature_hash` of exactly 11 characters.

Check how your app does the handshake. Meta's page sets October 15, 2026 as the date "the PendingIntent-based handshake method for authentication templates will be deprecated", after extending the migration deadline to that day. That date has passed. Meta names the OTP Android SDK (`WhatsAppOtpHandler`, with `isWhatsAppInstalled`) as the preferred method.

Zero-tap goes one step further. "Zero-tap is only supported on Android", and the client "simply broadcasts the included password or code" to your app with no tap ([zero-tap templates, accessed 2026-11-02](https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/authentication-templates/zero-tap-authentication-templates)). Without a handshake, "the broadcast will not be started", and the message falls back to one-tap, and to copy code when one-tap also fails. `zero_tap_terms_accepted` must be true, or Meta does not create the template. This is Meta's example template:

```json
{
  "name": "zero_tap_auth_template",
  "language": "en_US",
  "category": "authentication",
  "message_send_ttl_seconds": 60,
  "components": [
    { "type": "body", "add_security_recommendation": true },
    { "type": "footer", "code_expiration_minutes": 5 },
    {
      "type": "buttons",
      "buttons": [
        {
          "type": "otp",
          "otp_type": "zero_tap",
          "text": "Copy Code",
          "autofill_text": "Autofill",
          "zero_tap_terms_accepted": true,
          "supported_apps": [
            { "package_name": "com.example.luckyshrub", "signature_hash": "K8a/AINcGX7" }
          ]
        }
      ]
    }
  ]
}
```

## Expiry and time-to-live

`code_expiration_minutes` sets the footer notice and, for one-tap, the handshake window. The message's time-to-live decides whether a late code is delivered at all. For authentication templates the default TTL is "10 minutes", and you can set it from "30 seconds to 15 minutes" with `message_send_ttl_seconds` ([time-to-live, accessed 2026-11-02](https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/time-to-live)). Templates created before 2024-10-23 default to 30 days instead. "The system drops messages that cannot be delivered within the default or customized TTL."

Set the TTL no longer than the code's real validity on your server. A code that arrives after it expired produces a failed login. If your template predates October 2024, set the TTL explicitly.

## Fees for authentication messages

Authentication is its own pricing category. Meta charges it per delivered message at the rate for the user's market, and the charge applies inside the customer service window as well ([pricing, accessed 2026-11-02](https://developers.facebook.com/documentation/business-messaging/whatsapp/pricing)). "Businesses are only charged when a message is delivered." Meta also notes that "Specific markets have an authentication-international rate." The page read for this post does not list those markets, so check the rate card for your recipients' countries. [WhatsApp template categories](/academy/articles/whatsapp-template-categories-marketing-utility-authentication/) explains how the category is assigned.

## Do not make WhatsApp the only OTP channel

Meta's authentication best-practices page recommends giving users "a choice of authentication channels (such as WhatsApp, email, and SMS)" ([authentication best practices, accessed 2026-11-02](https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/authentication-templates/authentication-best-practices)). The zero-tap page is blunter: "Do not make WhatsApp your default password/code delivery method." A user without WhatsApp gets nothing, and the code reaches only the primary device of a user who has it.

The same best-practices page asks you to verify that the user owns the WhatsApp account and to add a second challenge. Put SMS or email one tap away on the login screen, and treat a WhatsApp code as one factor.

If the template is rejected at creation, [common template rejection reasons](/academy/articles/whatsapp-template-rejected-common-reasons/) lists the usual causes. The token behind every send is covered in [WhatsApp Cloud API access tokens](/academy/articles/whatsapp-cloud-api-access-tokens-system-user/).

*Z-API Omni team*
