Verification Check
The Verification Check Resource represents a verification validation. This will check whether the user-provided token is correct.
Prerequisites:
Create a Verification Service
Start a Verification
These fields are returned in the output JSON response. The type SID<VE>
is a unique ID starting with the letters VE.
Resource properties sid
type: SID<VE>
The unique string that we created to identify the VerificationCheck resource.
channel
type: enum<string>
Possible values:
sms
call
email
whatsapp
sna
status
type: string
The status of the verification. Can be: pending
, approved
, or canceled
.
valid
type: boolean
Use "status" instead. Legacy property indicating whether the verification was successful.
amount
type: string
The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.
payee
type: string
The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.
date_created
type: string<date-time>
date_updated
type: string<date-time>
sna_attempts_error_codes
type: array
List of error codes as a result of attempting a verification using the sna
channel. The error codes are chronologically ordered, from the first attempt to the latest attempt. This will be an empty list if no errors occured or null
if the last channel used wasn't sna
.
POST https://verify.twilio.com/v2/Services/{ServiceSid}/VerificationCheck
Warning Twilio deletes the verification SID once it's:
expired (10 minutes)
approved
when the max attempts to check a code have been reached
If any of these occur, verification checks will return a 404 not found error like this:
_10 Unable to create record: The requested resource /Services/VAXXXXXXXXXXXXX/VerificationCheck was not found
If you'd like to double check what happened with a given verification - please use the Twilio Console Verify Logs(link takes you to an external page) .
These are the available input parameters for checking a verification. The type SID<VE>
is a unique ID starting with the letters VE.
URI parameters Request body parameters Code
type: string
The 4-10 character string being verified.
VerificationSid
type: SID<VE>
Amount
type: string
The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.
Payee
type: string
The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.
_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: '1234'})
_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"
_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: 'recipient@foo.com', code: '123456'})
_11 .then(verification_check => console.log(verification_check.status));
_14 "sid": "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14 "service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14 "to": "recipient@foo.com",
_14 "status": "approved",
_14 "sna_attempts_error_codes": [],
_14 "date_created": "2015-07-30T20:00:00Z",
_14 "date_updated": "2015-07-30T20:00:00Z"
Alternative to checking with a Phone Number
_14 // Download the helper library from https://www.twilio.com/docs/node/install
_14 // Find your Account SID and Auth Token at twilio.com/console
_14 // and set the environment variables. See http://twil.io/secure
_14 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14 const authToken = process.env.TWILIO_AUTH_TOKEN;
_14 const client = require('twilio')(accountSid, authToken);
_14 client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_14 verificationSid: 'VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
_14 .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"
Note the sna_attempts_error_codes property in the response
_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'})
_11 .then(verification_check => console.log(verification_check.sid));
_19 "sid": "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19 "service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19 "to": "+15017122661",
_19 "status": "approved",
_19 "sna_attempts_error_codes": [
_19 "attempt_sid": "VLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19 "date_created": "2015-07-30T20:00:00Z",
_19 "date_updated": "2015-07-30T20:00:00Z"
It is possible for a Silent Network Auth (SNA) Verification Check to show a status
of approved
with error codes listed under sna_attempts_error_codes
. This can happen when a Verification Attempt for the SNA Verification failed and resulted in an error, and then a subsequent Verification Attempt was successful and resulted in the approval.