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

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

Property nameTypePIIDescription
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

service_sidSID<VA>

The SID of the Service the resource is associated with.

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

account_sidSID<AC>

The SID of the Account 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 being verified. Phone numbers must be in E.164 format.


channelenum<string>

The verification method to use. One of: email, sms, whatsapp, call, or sna.

Possible values:
smscallemailwhatsappsna

statusstring

The status of the verification. Can be: pending, approved, canceled, max_attempts_reached, deleted, failed or expired.


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>

date_updatedstring<date-time>

The ISO 8601 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.


Check a Verification

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.

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

Property nameTypeRequiredPIIDescription
ServiceSidSID<VA>required

The SID of the verification Service to create the resource under.

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

Request body parameters

Property nameTypeRequiredPIIDescription
CodestringOptional

The 4-10 character string being verified.


TostringOptional

The phone number or email to verify. Either this parameter or the verification_sid must be specified. Phone numbers must be in E.164 format.


VerificationSidSID<VE>Optional

A SID that uniquely identifies the Verification Check. Either this parameter or the to phone number/email must be specified.

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

AmountstringOptional

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


PayeestringOptional

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

Check a Verification with a Phone Number

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

_21
// Download the helper library from https://www.twilio.com/docs/node/install
_21
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_21
_21
// Find your Account SID and Auth Token at twilio.com/console
_21
// and set the environment variables. See http://twil.io/secure
_21
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_21
const authToken = process.env.TWILIO_AUTH_TOKEN;
_21
const client = twilio(accountSid, authToken);
_21
_21
async function createVerificationCheck() {
_21
const verificationCheck = await client.verify.v2
_21
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_21
.verificationChecks.create({
_21
code: "1234",
_21
to: "+15017122661",
_21
});
_21
_21
console.log(verificationCheck.status);
_21
}
_21
_21
createVerificationCheck();

Output

_14
{
_14
"sid": "VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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

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

_21
// Download the helper library from https://www.twilio.com/docs/node/install
_21
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_21
_21
// Find your Account SID and Auth Token at twilio.com/console
_21
// and set the environment variables. See http://twil.io/secure
_21
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_21
const authToken = process.env.TWILIO_AUTH_TOKEN;
_21
const client = twilio(accountSid, authToken);
_21
_21
async function createVerificationCheck() {
_21
const verificationCheck = await client.verify.v2
_21
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_21
.verificationChecks.create({
_21
code: "123456",
_21
to: "recipient@foo.com",
_21
});
_21
_21
console.log(verificationCheck.status);
_21
}
_21
_21
createVerificationCheck();

Output

_14
{
_14
"sid": "VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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

Alternative to checking with a Phone Number

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

_21
// Download the helper library from https://www.twilio.com/docs/node/install
_21
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_21
_21
// Find your Account SID and Auth Token at twilio.com/console
_21
// and set the environment variables. See http://twil.io/secure
_21
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_21
const authToken = process.env.TWILIO_AUTH_TOKEN;
_21
const client = twilio(accountSid, authToken);
_21
_21
async function createVerificationCheck() {
_21
const verificationCheck = await client.verify.v2
_21
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_21
.verificationChecks.create({
_21
code: "1234",
_21
verificationSid: "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
});
_21
_21
console.log(verificationCheck.status);
_21
}
_21
_21
createVerificationCheck();

Output

_14
{
_14
"sid": "VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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

Note the sna_attempts_error_codes property in the response

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

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function createVerificationCheck() {
_18
const verificationCheck = await client.verify.v2
_18
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.verificationChecks.create({ to: "+15017122661" });
_18
_18
console.log(verificationCheck.sid);
_18
}
_18
_18
createVerificationCheck();

Output

_19
{
_19
"sid": "VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_19
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_19
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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": "VLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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: