Skip to contentSkip to navigationSkip to topbar
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.

Property nameTypeRequiredDescriptionChild properties
sidSID<VE>

Optional

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>

Optional

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>

Optional

The SID of the Account that created the VerificationCheck resource.

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

tostring

Optional

PII MTL: 30 days

The phone number or email being verified. Phone numbers must be in E.164 format.


channelenum<string>

Optional

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

Possible values:
smscallemailwhatsappsna

statusstring

Optional

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


validboolean

Optional

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


amountstring

Optional

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


payeestring

Optional

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


date_updatedstring<date-time>

Optional

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

Optional

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:

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
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
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
Codestring

Optional

The 4-10 character string being verified.


Tostring

Optional

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

Amountstring

Optional

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


Payeestring

Optional

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


SnaClientTokenstring

Optional

A sna client token received in sna url invocation response needs to be passed in Verification Check request and should match to get successful response.

Check a Verification with a Phone NumberLink to code sample: Check a Verification with a Phone Number
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createVerificationCheck() {
11
const verificationCheck = await client.verify.v2
12
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.verificationChecks.create({
14
code: "1234",
15
to: "+15017122661",
16
});
17
18
console.log(verificationCheck.status);
19
}
20
21
createVerificationCheck();

Output

1
{
2
"sid": "VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"to": "+15017122661",
6
"channel": "sms",
7
"status": "approved",
8
"valid": true,
9
"amount": null,
10
"payee": null,
11
"sna_attempts_error_codes": [],
12
"date_created": "2015-07-30T20:00:00Z",
13
"date_updated": "2015-07-30T20:00:00Z"
14
}
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createVerificationCheck() {
11
const verificationCheck = await client.verify.v2
12
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.verificationChecks.create({
14
code: "123456",
15
to: "recipient@foo.com",
16
});
17
18
console.log(verificationCheck.status);
19
}
20
21
createVerificationCheck();

Output

1
{
2
"sid": "VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"to": "recipient@foo.com",
6
"channel": "sms",
7
"status": "approved",
8
"valid": true,
9
"amount": null,
10
"payee": null,
11
"sna_attempts_error_codes": [],
12
"date_created": "2015-07-30T20:00:00Z",
13
"date_updated": "2015-07-30T20:00:00Z"
14
}
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createVerificationCheck() {
11
const verificationCheck = await client.verify.v2
12
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.verificationChecks.create({
14
code: "1234",
15
verificationSid: "VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
16
});
17
18
console.log(verificationCheck.status);
19
}
20
21
createVerificationCheck();

Output

1
{
2
"sid": "VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"to": "+15017122661",
6
"channel": "sms",
7
"status": "approved",
8
"valid": true,
9
"amount": null,
10
"payee": null,
11
"sna_attempts_error_codes": [],
12
"date_created": "2015-07-30T20:00:00Z",
13
"date_updated": "2015-07-30T20:00:00Z"
14
}
Check a Silent Network Auth Verification with Error CodesLink to code sample: Check a Silent Network Auth Verification with Error Codes
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createVerificationCheck() {
11
const verificationCheck = await client.verify.v2
12
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.verificationChecks.create({ to: "+15017122661" });
14
15
console.log(verificationCheck.sid);
16
}
17
18
createVerificationCheck();

Output

1
{
2
"sid": "VEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"to": "+15017122661",
6
"channel": "sna",
7
"status": "approved",
8
"valid": true,
9
"amount": null,
10
"payee": null,
11
"sna_attempts_error_codes": [
12
{
13
"attempt_sid": "VLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
14
"code": 60001
15
}
16
],
17
"date_created": "2015-07-30T20:00:00Z",
18
"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.

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.