As part of Twilio's account security offerings, the Twilio Verify API makes it simple to add user verification to your web application. The API supports the following channels:
- Silent Network Auth
- Automatic Channel Selection
- TOTP (authenticator apps like Authy and Google Authenticator)
- Push and Silent Device Approval
For more information on Verify, see our product page.
All URLs referenced in the documentation have the following base:
The Twilio REST API is served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.
HTTP requests to the REST API are protected with HTTP Basic authentication. To learn more about how Twilio handles authentication, please refer to our security documentation. In short, you will use your Twilio account SID as the username and your auth token as the password for HTTP Basic authentication.
curl -XPOST https://verify.twilio.com/v2/Services \ -d FriendlyName=MyServiceName \ -u '[YOUR ACCOUNT SID]:[YOUR AUTH TOKEN]'
You can find your account SID and auth token in your console.
User Verification Workflow
This guide shows the 3 steps to completing a basic one-time passcode (OTP) verification. Follow the links for more documentation on advanced features such as service configuration, custom codes, rate limiting, PSD2 compliance, and more.
Create a Service in one of two ways:
- In the Twilio Verify Console
- Using the API (code sample on this page)
A Verification Service is the set of common configurations used to create and check verifications. This includes features like:
- Friendly Name (used in the Verification message templates)
- Code Length
- ...and more
One verification service can be used to send multiple verification tokens, it is not necessary to create a new service each time.
This will send a token to the end user through the specified channel. Newly created verifications will show a status of
pending. Supported channels are
Learn more about how to turn phone number input into E.164 format or how to customize the verification message.
This will check whether the user-provided token is correct.
|Token||Status in response|
You made it through the Verify API Overview. To protect your service against fraud, view our guidance on Preventing Toll Fraud when using Verify.
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.