The Challenge
resource is currently used by Verify Push and Verify TOTP features. It represents a single verification attempt of an Entity using a Factor
. When the factor_type
is push
, a Challenge
is created to verify the signature of the message sent from the registered device with the public key stored in the Factor
. When the factor_type
is totp, a Challenge
is created to verify that the TOTP code provided by the user matches the one generated by the seed stored in the Factor. Some Challenge
properties apply to all factor_types
and others do not. A single Entity
links to multiple Factors
and a single Factor
links to multiple Challenges
.
Verify Push
Consistent with overall Verify pricing, Verify Push is billed at a rate of $0.05 per verification. In technical terms, a Verify Push "verification" is defined as a Challenge
of factor_type:push
that is updated with a status
of approved
or denied
.
Verify TOTP
Consistent with overall Verify pricing, Verify TOTP will be billed at a rate of $0.05 per verification. In technical terms, a Verify TOTP "verification" is defined as a Challenge
of factor_type:totp
that is updated with a status
of approved
.
A 34 character string that uniquely identifies this Challenge.
^YC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique SID identifier of the Account.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique SID identifier of the Service.
^VA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique SID identifier of the Entity.
^YE[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
The unique SID identifier of the Factor.
^YF[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The date that this Challenge was created, given in ISO 8601 format.
The date that this Challenge was updated, given in ISO 8601 format.
The date that this Challenge was responded, given in ISO 8601 format.
The date-time when this Challenge expires, given in ISO 8601 format. The default value is five (5) minutes after Challenge creation. The max value is sixty (60) minutes after creation.
The Status of this Challenge. One of pending
, expired
, approved
or denied
.
pending
expired
approved
denied
Reason for the Challenge to be in certain status
. One of none
, not_needed
or not_requested
.
none
not_needed
not_requested
Details provided to give context about the Challenge. Intended to be shown to the end user.
Details provided to give context about the Challenge. Intended to be hidden from the end user. It must be a stringified JSON with only strings values eg. {"ip": "172.168.1.234"}
Custom metadata associated with the challenge. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. {"os": "Android"}
. Can be up to 1024 characters in length.
The Factor Type of this Challenge. Currently push
and totp
are supported.
push
totp
Contains a dictionary of URL links to nested resources of this Challenge.
POST https://verify.twilio.com/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges
The unique SID identifier of the Service.
^VA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
application/x-www-form-urlencoded
The unique SID identifier of the Factor.
^YF[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The date-time when this Challenge expires, given in ISO 8601 format. The default value is five (5) minutes after Challenge creation. The max value is sixty (60) minutes after creation.
Shown to the user when the push notification arrives. Required when factor_type
is push
. Can be up to 256 characters in length
A list of objects that describe the Fields included in the Challenge. Each object contains the label and value of the field, the label can be up to 36 characters in length and the value can be up to 128 characters in length. Used when factor_type
is push
. There can be up to 20 details fields.
Details provided to give context about the Challenge. Not shown to the end user. It must be a stringified JSON with only strings values eg. {"ip": "172.168.1.234"}
. Can be up to 1024 characters in length
Optional payload used to verify the Challenge upon creation. Only used with a Factor of type totp
to carry the TOTP code that needs to be verified. For TOTP
this value must be between 3 and 8 characters long.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createChallenge() {11const challenge = await client.verify.v212.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.entities("ff483d1ff591898a9942916050d2ca3f")14.challenges.create({15"details.fields": [16{17label: "Action",18value: "Sign up in portal",19},20{21label: "Location",22value: "California",23},24],25"details.message": "Hi! Mr. John Doe, would you like to sign up?",26factorSid: "YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",27hiddenDetails: {28ip: "127.0.0.1",29},30});3132console.log(challenge.sid);33}3435createChallenge();
1{2"sid": "YC03aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"entity_sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"identity": "ff483d1ff591898a9942916050d2ca3f",7"factor_sid": "YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"date_created": "2015-07-30T20:00:00Z",9"date_updated": "2015-07-30T20:00:00Z",10"date_responded": "2015-07-30T20:00:00Z",11"expiration_date": "2015-07-30T20:00:00Z",12"status": "pending",13"responded_reason": "none",14"details": {15"message": "Hi! Mr. John Doe, would you like to sign up?",16"date": "2020-07-01T12:13:14Z",17"fields": [18{19"label": "Action",20"value": "Sign up in portal"21}22]23},24"hidden_details": {25"ip": "172.168.1.234"26},27"metadata": null,28"factor_type": "push",29"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges/YC03aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",30"links": {31"notifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges/YC03aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications"32}33}
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createChallenge() {11const challenge = await client.verify.v212.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.entities("ff483d1ff591898a9942916050d2ca3f")14.challenges.create({15authPayload: "12345678",16"details.fields": [17{18label: "Action",19value: "Sign up in portal",20},21{22label: "Location",23value: "California",24},25],26"details.message": "Hi! Mr. John Doe, would you like to sign up?",27factorSid: "YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",28hiddenDetails: {29ip: "127.0.0.1",30},31});3233console.log(challenge.sid);34}3536createChallenge();
1{2"sid": "YC02aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"entity_sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"identity": "ff483d1ff591898a9942916050d2ca3f",7"factor_sid": "YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"date_created": "2015-07-30T20:00:00Z",9"date_updated": "2015-07-30T20:00:00Z",10"date_responded": "2015-07-30T20:00:00Z",11"expiration_date": "2015-07-30T20:00:00Z",12"status": "approved",13"responded_reason": "none",14"details": {15"message": "Hi! Mr. John Doe, would you like to sign up?",16"date": "2020-07-01T12:13:14Z",17"fields": [18{19"label": "Action",20"value": "Sign up in portal"21}22]23},24"hidden_details": {25"ip": "172.168.1.234"26},27"metadata": null,28"factor_type": "totp",29"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges/YC02aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",30"links": {31"notifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges/YC02aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications"32}33}
GET https://verify.twilio.com/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges/{Sid}
The unique SID identifier of the Service.
^VA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Customer unique identity for the Entity owner of the Challenges. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
A 34 character string that uniquely identifies this Challenge.
^YC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchChallenge() {11const challenge = await client.verify.v212.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.entities("Identity")14.challenges("YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")15.fetch();1617console.log(challenge.sid);18}1920fetchChallenge();
1{2"sid": "YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"entity_sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"identity": "Identity",7"factor_sid": "YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"date_created": "2015-07-30T20:00:00Z",9"date_updated": "2015-07-30T20:00:00Z",10"date_responded": "2015-07-30T20:00:00Z",11"expiration_date": "2015-07-30T20:00:00Z",12"status": "approved",13"responded_reason": "none",14"details": {15"message": "Hi! Mr. John Doe, would you like to sign up?",16"date": "2020-07-01T12:13:14Z",17"fields": [18{19"label": "Action",20"value": "Sign up in portal"21}22]23},24"hidden_details": {25"ip": "172.168.1.234"26},27"metadata": {28"os": "Android"29},30"factor_type": "push",31"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges/YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",32"links": {33"notifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges/YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications"34}35}
GET https://verify.twilio.com/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges
The unique SID identifier of the Service.
^VA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
The unique SID identifier of the Factor.
^YF[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The Status of the Challenges to fetch. One of pending
, expired
, approved
or denied
.
pending
expired
approved
denied
The desired sort order of the Challenges list. One of asc
or desc
for ascending and descending respectively. Defaults to asc
.
asc
desc
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listChallenge() {11const challenges = await client.verify.v212.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.entities("Identity")14.challenges.list({ limit: 20 });1516challenges.forEach((c) => console.log(c.sid));17}1819listChallenge();
1{2"challenges": [],3"meta": {4"page": 0,5"page_size": 50,6"first_page_url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges?PageSize=50&Page=0",7"previous_page_url": null,8"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges?PageSize=50&Page=0",9"next_page_url": null,10"key": "challenges"11}12}
POST https://verify.twilio.com/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges/{Sid}
The unique SID identifier of the Service.
^VA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
A 34 character string that uniquely identifies this Challenge.
^YC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
application/x-www-form-urlencoded
The optional payload needed to verify the Challenge. E.g., a TOTP would use the numeric code. For TOTP
this value must be between 3 and 8 characters long. For Push
this value can be up to 5456 characters in length
Custom metadata associated with the challenge. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. {"os": "Android"}
. Can be up to 1024 characters in length.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateChallenge() {11const challenge = await client.verify.v212.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.entities("Identity")14.challenges("YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")15.update({ authPayload: "AuthPayload" });1617console.log(challenge.sid);18}1920updateChallenge();
1{2"sid": "YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"entity_sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"identity": "Identity",7"factor_sid": "YF03aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"date_created": "2015-07-30T20:00:00Z",9"date_updated": "2015-07-30T20:00:00Z",10"date_responded": "2015-07-30T20:00:00Z",11"expiration_date": "2015-07-30T20:00:00Z",12"status": "approved",13"responded_reason": "none",14"details": {15"message": "Hi! Mr. John Doe, would you like to sign up?",16"date": "2020-07-01T12:13:14Z",17"fields": [18{19"label": "Action",20"value": "Sign up in portal"21}22]23},24"hidden_details": {25"ip": "172.168.1.234"26},27"metadata": {28"os": "Android"29},30"factor_type": "push",31"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges/YC03aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",32"links": {33"notifications": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Challenges/YC03aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications"34}35}