WhatsApp authentication template for OTP codes
How to create an authentication template for one-time codes: fixed components, copy code and one-tap buttons, upsert and Meta's rules.
When the authentication template is required
If your application sends verification codes or one-time passwords (OTP) over WhatsApp, Meta requires an authentication template. The documentation is direct: authentication is the only category allowed for one-time passcodes, and templates in other categories that look like it are re-categorized.
This covers login, sign-up, account recovery and confirming a sensitive operation. If your text delivers a code for the user to type or paste elsewhere, it is authentication. The article on automatic recategorization shows what happens to anyone who tries to use utility for this: the template is marked for rejection on the first day of the following month.
A practical point for integrators: the authentication template is not free text. So your team does not need to spend time on copywriting, but on the security options and on the code on the server. For the overview of categories, see template categories.
The components and their restrictions
The template has a preset, non-customizable text, for example a line informing the verification code. There are three optional or fixed elements: the security disclaimer, the code expiration warning, and a button, or no button in the zero-tap case.
The category restrictions, according to the categorization page, are: use a Template Library template, have a one-time password button (copy code or one-tap), no URLs, media or emojis, and parameters limited to 15 characters. The duplicate body and footer check does not apply to authentication.
One security feature is on by default in the Cloud API, with no code change: linked device security. Messages go only to the primary device, and linked devices show a masked message asking the user to check the primary device. This is not configurable.
Copy code, one-tap and zero-tap
Meta describes three ways to deliver the code. The table summarizes:
| Mode | Platform | How it works |
|---|---|---|
| Copy code | All | The WhatsApp client copies the code to the clipboard and the user pastes it into your app |
| One-tap autofill | Android | A button in the template opens your app and delivers the code |
| Zero-tap | Android | No button; WhatsApp broadcasts the code and your app captures it with a broadcast receiver |
On iOS 26 and later, keyboard suggestions handle autofill, with no integration. Earlier iOS versions have no autofill, so use copy code. For one-tap and zero-tap, the payload carries `supported_apps` with `package_name` and `signature_hash`.
If you serve Android and iOS, start with copy code, which works on both, and add one-tap as an Android improvement. Remember that zero-tap requires your app to capture the broadcast, and that the user must know the app captured the code.
The creation payload (upsert)
Authentication templates use the `upsert_message_templates` endpoint, which updates the template matching name and language, or creates one if none exists. The difference from other templates is that the field is `languages` (a list), not `language`, and neither `text` nor `autofill_text` is used.
POST /<WHATSAPP_BUSINESS_ACCOUNT_ID>/upsert_message_templates
{
"name": "access_code",
"languages": ["pt_BR", "en_US"],
"category": "AUTHENTICATION",
"components": [
{ "type": "BODY", "add_security_recommendation": true },
{ "type": "FOOTER", "code_expiration_minutes": 10 },
{ "type": "BUTTONS", "buttons": [
{ "type": "OTP", "otp_type": "COPY_CODE" }
] }
]
}`add_security_recommendation` includes the security recommendation in the body. `code_expiration_minutes`, in the footer, sets the expiration warning, and the range stated in the preview API is 1 to 90 minutes. The `otp_type` values shown in the documentation are `COPY_CODE` and `ONE_TAP`.
A template can be previewed with `GET /<WHATSAPP_BUSINESS_ACCOUNT_ID>/message_template_previews`, with `category=AUTHENTICATION` and `button_types=OTP`, and optionally `language`, `add_security_recommendation` and `code_expiration_minutes`. This shows the final text before submitting for review.
Creating through the Hub and what to check
The Hub templates `POST` accepts `category` equal to `AUTHENTICATION` and buttons of type `OTP`, with the `otp_type` field, as the templates reference (Portuguese) describes. The Hub requires `language` and `components`, and the endpoint description does not mention `upsert` or the `languages` field. Do not assume the Hub supports Meta's whole upsert flow with several languages at once.
Before depending on it, confirm whether your channel creates the authentication template with the body you want, and query the list to see the resulting category and status. The task of creating the approved template is independent of the task of sending the code, which is the next step.
As for sending, the Meta authentication documentation consulted has no send payload, only creation and preview, and points to a sample Android app. Sending a template through the Hub follows the format in the send a template guide (Portuguese). Validate the exact format with the real template you created before going to production.
Meta's best practices and yours
Meta recommends three things: confirm the user's WhatsApp number before sending, tell the user the code goes to WhatsApp, especially when there is more than one delivery option, and make clear when your app has captured the code.
On your server side, the code itself is your responsibility. Generate the code with a secure generator, store only the hash, set an expiration consistent with the footer warning and limit attempts. WhatsApp delivers the message; validity and attempt lockout belong to your application.
Finally, plan for failure. If the send fails because of a limit, an unapproved template or a disconnected number, the user experience is a code that never arrives. Offer another delivery method and handle template errors, such as 132001 for a template that does not exist in the language, described in the Meta error catalog (Portuguese). See the article on approval to avoid sending before the status is APPROVED.
Frequently asked questions
Can I send a verification code with a utility template?
No. Authentication is the only category allowed for one-time passcodes, and Meta re-categorizes templates in other categories that look like it.
What is the difference between copy code, one-tap and zero-tap?
Copy code puts the value on the clipboard. One-tap is an Android button that opens your app with the code. Zero-tap has no button: the app captures the code through a broadcast receiver.
What is the range of the code expiration warning?
Meta's preview API states 1 to 90 minutes for code_expiration_minutes.
Can authentication templates have URLs or emojis?
No. According to Meta, authentication does not allow URLs, media or emojis, and limits parameters to 15 characters.
Fontes
Documentação oficial da Meta, conferida em 31 de outubro de 2026.