NAME
Twilio::Rest::Verify::V2::Service::Entity::Challenge - The Challenge resource
SYNOPSIS
my $client = Twilio::Rest::Client->new($account_sid, $auth_token);
my $challenge = $client->verify->v2->services($service_sid)->entities($identity)->challenges->create($factor_sid, \%options);
for my $challenge ($client->verify->v2->services($service_sid)->entities($identity)->challenges->read({}, 20)) {
...
}
my $challenge = $client->verify->v2->services($service_sid)->entities($identity)->challenges($sid)->fetch;
$client->verify->v2->services($service_sid)->entities($identity)->challenges($sid)->update(\%options);
DESCRIPTION
This file holds ChallengeList, ChallengePage, ChallengeContext and ChallengeInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.
ChallengeList
Returned by $client->verify->v2->services($service_sid)->entities($identity)->challenges. See also Twilio::ListResource.
create
my $challenge = $client->verify->v2->services($service_sid)->entities($identity)->challenges->create($factor_sid, \%options);
Create a new Challenge for the Factor. Returns a ChallengeInstance.
The required values are:
The options are:
auth_payload-
Optional payload used to verify the Challenge upon creation. Only used with a Factor of type
totpto carry the TOTP code that needs to be verified. ForTOTPthis value must be between 3 and 8 characters long. details_fields-
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_typeispush. There can be up to 20 details fields. An array reference. A hash or array reference, or a string of JSON. details_message-
Shown to the user when the push notification arrives. Required when
factor_typeispush. Can be up to 256 characters in length expiration_date-
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. A string, or an object with an
epochmethod. See "iso8601_date_time" in Twilio::Serialize. -
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 A hash or array reference, or a string of JSON.
read
my @records = $client->verify->v2->services($service_sid)->entities($identity)->challenges->read(\%options, $limit, $page_size);
Retrieve a list of all Challenges for a Factor. Returns the records as a list, fetching as many pages as it needs.
The options are:
factor_sid-
The unique SID identifier of the Factor.
order-
The desired sort order of the Challenges list. One of
ascordescfor ascending and descending respectively. Defaults toasc. One ofascordesc. status-
The Status of the Challenges to fetch. One of
pending,expired,approvedordenied. One ofpending,expired,approvedordenied.
stream
my $stream = $client->verify->v2->services($service_sid)->entities($identity)->challenges->stream(\%options, $limit, $page_size);
Takes the same arguments as "read", and returns a Twilio::Stream.
page
my $page = $client->verify->v2->services($service_sid)->entities($identity)->challenges->page(\%options, $page_size, $page_token, $page_number);
Fetches one page, and returns a Twilio::Page.
get_page
my $page = $client->verify->v2->services($service_sid)->entities($identity)->challenges->get_page($url);
Fetches the page at a URL given by Twilio.
get_context
my $context = $client->verify->v2->services($service_sid)->entities($identity)->challenges->get_context($sid);
Returns a ChallengeContext, and makes no request.
ChallengePage
A Twilio::Page of ChallengeInstance objects.
records_key
build_instance
Used by Twilio::Page.
ChallengeContext
Returned by $client->verify->v2->services($service_sid)->entities($identity)->challenges($sid). It makes no request until one of these methods is called.
fetch
my $challenge = $client->verify->v2->services($service_sid)->entities($identity)->challenges($sid)->fetch;
Fetch a specific Challenge. Returns a ChallengeInstance.
update
my $challenge = $client->verify->v2->services($service_sid)->entities($identity)->challenges($sid)->update(\%options);
Verify a specific Challenge. Returns a ChallengeInstance.
The options are:
auth_payload-
The optional payload needed to verify the Challenge. E.g., a TOTP would use the numeric code. For
TOTPthis value must be between 3 and 8 characters long. ForPushthis value can be up to 5456 characters in length metadata-
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. A hash or array reference, or a string of JSON.
notifications
my $list = $object->notifications;
See Twilio::Rest::Verify::V2::Service::Entity::Challenge::Notification.
ChallengeInstance
See also Twilio::InstanceResource.
It has fetch, update and notifications, which work as they do on the context.
Its fields are:
- account_sid
-
The unique SID identifier of the Account.
- date_created
-
The date that this Challenge was created, given in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
- date_responded
-
The date that this Challenge was responded, given in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
- date_updated
-
The date that this Challenge was updated, given in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
- details
-
Details provided to give context about the Challenge. Intended to be shown to the end user.
- entity_sid
-
The unique SID identifier of the Entity.
- expiration_date
-
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. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
- factor_sid
-
The unique SID identifier of the Factor.
- factor_type
-
One of
push,totporpasskeys. -
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"} - identity
-
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.
- links
-
Contains a dictionary of URL links to nested resources of this Challenge.
- metadata
-
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. - responded_reason
-
One of
none,not_neededornot_requested. - service_sid
-
The unique SID identifier of the Service.
- sid
-
A 34 character string that uniquely identifies this Challenge.
- status
-
One of
pending,expired,approvedordenied. - url
-
The URL of this resource.
CONSTRUCTORS
new
Objects here come from the methods above, so there is no need to call new directly.
LICENSE
Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.