Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Verification Check


The Verification Check Resource represents a verification validation. This will check whether the user-provided token is correct.

Prerequisites:

  1. Create a Verification Service
  2. Start a Verification

VerificationCheck Response Properties

verificationcheck-response-properties page anchor

These fields are returned in the output JSON response. The type SID<VE> is a unique ID starting with the letters VE.

sidSID<VE>
Not PII

The unique string that we created to identify the VerificationCheck resource.

Pattern: ^VE[0-9a-fA-F]{32}$Min length: 34Max length: 34

account_sidSID<AC>

The SID of the Account(link takes you to an external page) that created the VerificationCheck resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

tostring
PII MTL: 30 days

The phone number or email(link takes you to an external page) being verified. Phone numbers must be in E.164 format(link takes you to an external page).


channelenum<string>

The verification method to use. One of: email(link takes you to an external page), sms, whatsapp, call, or sna.

Possible values:
smscallemailwhatsappsna

statusstring

The status of the verification. Can be: pending, approved, or canceled.


validboolean

Use "status" instead. Legacy property indicating whether the verification was successful.


amountstring

The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.


payeestring

The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.


date_createdstring<date-time>

The ISO 8601(link takes you to an external page) date and time in GMT when the Verification Check resource was created.


date_updatedstring<date-time>

The ISO 8601(link takes you to an external page) date and time in GMT when the Verification Check resource was last updated.


sna_attempts_error_codesarray

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)

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.

Path parameters

path-parameters page anchor
ServiceSidSID<VA>required

The SID of the verification Service(link takes you to an external page) to create the resource under.

Pattern: ^VA[0-9a-fA-F]{32}$Min length: 34Max length: 34
Codestring

The 4-10 character string being verified.


The phone number or email(link takes you to an external page) to verify. Either this parameter or the verification_sid must be specified. Phone numbers must be in E.164 format(link takes you to an external page).


VerificationSidSID<VE>

A SID that uniquely identifies the Verification Check. Either this parameter or the to phone number/email(link takes you to an external page) must be specified.

Pattern: ^VE[0-9a-fA-F]{32}$Min length: 34Max length: 34

Amountstring

The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.


Payeestring

The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.

Check a Verification with a Phone Number

check-a-verification-with-a-phone-number page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_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
_11
client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.verificationChecks
_11
.create({to: '+15017122661', code: '1234'})
_11
.then(verification_check => console.log(verification_check.status));

Output

_14
{
_14
"sid": "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"to": "+15017122661",
_14
"channel": "sms",
_14
"status": "approved",
_14
"valid": true,
_14
"amount": null,
_14
"payee": null,
_14
"sna_attempts_error_codes": [],
_14
"date_created": "2015-07-30T20:00:00Z",
_14
"date_updated": "2015-07-30T20:00:00Z"
_14
}

Check a Verification with an Email

check-a-verification-with-an-email page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_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
_11
client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.verificationChecks
_11
.create({to: 'recipient@foo.com', code: '123456'})
_11
.then(verification_check => console.log(verification_check.status));

Output

_14
{
_14
"sid": "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"to": "recipient@foo.com",
_14
"channel": "sms",
_14
"status": "approved",
_14
"valid": true,
_14
"amount": null,
_14
"payee": null,
_14
"sna_attempts_error_codes": [],
_14
"date_created": "2015-07-30T20:00:00Z",
_14
"date_updated": "2015-07-30T20:00:00Z"
_14
}

Check a Verification with a SID

check-a-verification-with-a-sid page anchor

Alternative to checking with a Phone Number

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_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
_14
client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_14
.verificationChecks
_14
.create({
_14
verificationSid: 'VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
_14
code: '1234'
_14
})
_14
.then(verification_check => console.log(verification_check.status));

Output

_14
{
_14
"sid": "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"to": "+15017122661",
_14
"channel": "sms",
_14
"status": "approved",
_14
"valid": true,
_14
"amount": null,
_14
"payee": null,
_14
"sna_attempts_error_codes": [],
_14
"date_created": "2015-07-30T20:00:00Z",
_14
"date_updated": "2015-07-30T20:00:00Z"
_14
}

Check a Silent Network Auth Verification with Error Codes

check-a-silent-network-auth-verification-with-error-codes page anchor

Note the sna_attempts_error_codes property in the response

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_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
_11
client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.verificationChecks
_11
.create({to: '+15017122661'})
_11
.then(verification_check => console.log(verification_check.sid));

Output

_19
{
_19
"sid": "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"service_sid": "VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"to": "+15017122661",
_19
"channel": "sna",
_19
"status": "approved",
_19
"valid": true,
_19
"amount": null,
_19
"payee": null,
_19
"sna_attempts_error_codes": [
_19
{
_19
"attempt_sid": "VLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"code": 60001
_19
}
_19
],
_19
"date_created": "2015-07-30T20:00:00Z",
_19
"date_updated": "2015-07-30T20:00:00Z"
_19
}

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.


Rate this page: