Verify a phone number
Two calls. We generate the code, deliver it over WhatsApp, and check it. You never store it.
You start a verification
msg.verify.start({ phone })We generate the code and deliver it over WhatsApp. You get a
verificationIdback.The user reads the code and types it in
Into your own form. We are not involved until you check it.
You check it
msg.verify.check({ verificationId, code })approvedmeans verified. You never stored the code.
Starting a verification
You get back a verificationId, a status of pending, and expiresAt.
On a test key the response also carries code — see
Test keys and the sandbox.
Verifying a code
The five statuses
| Status | Meaning |
|---|---|
pending | Code sent, not yet checked. |
approved | Correct. The user is verified. |
invalid | Wrong code. remainingAttempts tells you how many tries are left. |
expired | Past expiresAt. Start a new verification. |
max_attempts | Too many wrong guesses. Start a new verification. |
A wrong code is not an error. It comes back as 200 with status: "invalid", because the
request itself was perfectly valid. Only branch on status.
approved means the phone number is verified, not that anyone is logged in. Creating a session
is yours — see Add WhatsApp OTP to your login.
Before you go live
Verify needs two things on your account that a test key does not check:
- An authentication template approved by Meta.
- An active sending number.
Missing either, a live key returns verify_not_configured. Both are set up in the console — see
Connect your WhatsApp account.