Verify API
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:
For more information on Verify, see our product page(link takes you to an external page) .
All URLs referenced in the documentation have the following base:
_10 https://verify.twilio.com/v2/
The Twilio REST API is served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.
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.
_10 // Download the helper library from https://www.twilio.com/docs/node/install
_10 // Find your Account SID and Auth Token at twilio.com/console
_10 // and set the environment variables. See http://twil.io/secure
_10 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10 const authToken = process.env.TWILIO_AUTH_TOKEN;
_10 const client = require('twilio')(accountSid, authToken);
_10 client.verify.v2.services
_10 .create({friendlyName: 'My First Verify Service'})
_10 .then(service => console.log(service.sid));
_42 "sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42 "friendly_name": "My First Verify Service",
_42 "lookup_enabled": false,
_42 "psd2_enabled": false,
_42 "skip_sms_to_landlines": false,
_42 "dtmf_input_required": false,
_42 "do_not_share_warning_enabled": false,
_42 "custom_code_enabled": true,
_42 "include_date": false,
_42 "apn_credential_sid": "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42 "fcm_credential_sid": null
_42 "issuer": "test-issuer",
_42 "msg_service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42 "from": "whatsapp:+1234567890"
_42 "default_template_sid": "HJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42 "verify_event_subscription_enabled": false,
_42 "date_created": "2015-07-30T20:00:00Z",
_42 "date_updated": "2015-07-30T20:00:00Z",
_42 "url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_42 "verification_checks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/VerificationCheck",
_42 "verifications": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications",
_42 "rate_limits": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/RateLimits",
_42 "messaging_configurations": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/MessagingConfigurations",
_42 "entities": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Entities",
_42 "webhooks": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks",
_42 "access_tokens": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AccessTokens"
Create a Service in one of two ways:
In the Twilio Verify Console(link takes you to an external page)
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:
One verification service can be used to send multiple verification tokens, it is not necessary to create a new service each time.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .create({to: '+15017122661', channel: 'sms'})
_11 .then(verification => console.log(verification.status));
_23 "sid": "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23 "service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23 "to": "+15017122661",
_23 "date_created": "2015-07-30T20:00:00Z",
_23 "date_updated": "2015-07-30T20:00:00Z",
_23 "send_code_attempts": [
_23 "time": "2015-07-30T20:00:00Z",
_23 "attempt_sid": "VLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_23 "url": "https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications/VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
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(link takes you to an external page) or how to customize the verification message .
Verification documentation.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .create({to: '+15017122661', code: '123456'})
_11 .then(verification_check => console.log(verification_check.status));
_14 "sid": "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14 "service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14 "to": "+15017122661",
_14 "status": "approved",
_14 "sna_attempts_error_codes": [],
_14 "date_created": "2015-07-30T20:00:00Z",
_14 "date_updated": "2015-07-30T20:00:00Z"
This will check whether the user-provided token is correct.
Token Status in response Correct approved
Incorrect pending
VerificationCheck documentation.
Info You made it through the Verify API Overview. To protect your service against fraud, view our guidance on Preventing Toll Fraud when using Verify.