NAME

Twilio::Rest::Verify::V2::Service::Verification - The Verification resource

SYNOPSIS

my $client = Twilio::Rest::Client->new($account_sid, $auth_token);

my $verification = $client->verify->v2->services($service_sid)->verifications->create($to, $channel, \%options);
my $verification = $client->verify->v2->services($service_sid)->verifications($sid)->fetch;
$client->verify->v2->services($service_sid)->verifications($sid)->update($status);

DESCRIPTION

This file holds VerificationList, VerificationContext and VerificationInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

VerificationList

Returned by $client->verify->v2->services($service_sid)->verifications. See also Twilio::ListResource.

create

my $verification = $client->verify->v2->services($service_sid)->verifications->create($to, $channel, \%options);

Create a new Verification using a Service. Returns a VerificationInstance.

The required values are:

$to

The phone number or email to verify. Phone numbers must be in E.164 format.

$channel

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

The options are:

amount

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

app_hash

Your App Hash to be appended at the end of your verification SMS body. Applies only to SMS. Example SMS body: <#> Your AppName verification code is: 1234 He42w354ol9.

channel_configuration

email channel configuration in json format. The fields 'from' and 'from_name' are optional but if included the 'from' field must have a valid email address. A hash or array reference, or a string of JSON.

custom_code

A pre-generated code to use for verification. The code can be between 4 and 10 characters, inclusive.

custom_friendly_name

A custom user defined friendly name that overwrites the existing one in the verification message

custom_message

The text of a custom message to use for the verification [DEPRECATED].

device_ip

Strongly encouraged if using the auto channel. The IP address of the client's device. If provided, it has to be a valid IPv4 or IPv6 address.

enable_sna_client_token

An optional Boolean value to indicate the requirement of sna client token in the SNA URL invocation response for added security. This token must match in the Verification Check request to confirm phone number verification.

locale

Locale will automatically resolve based on phone number country code for SMS, WhatsApp, and call channel verifications. It will fallback to English or the template’s default translation if the selected translation is not available. This parameter will override the automatic locale resolution. See supported languages and more information here.

payee

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

rate_limits

The custom key-value pairs of Programmable Rate Limits. Keys correspond to unique_name fields defined when creating your Rate Limit. Associated value pairs represent values in the request that you are rate limiting on. You may include multiple Rate Limit values in each request. A hash or array reference, or a string of JSON.

risk_check

One of enable or disable.

send_digits

The digits to send after a phone call is answered, for example, to dial an extension. For more information, see the Programmable Voice documentation of sendDigits.

tags

A string containing a JSON map of key value pairs of tags to be recorded as metadata for the message. The tags will also be included as part of the verification and message status event type payloads. The object may contain up to 10 tags. Keys and values can each be up to 128 characters in length. This value should not contain PII.

template_custom_substitutions

A stringified JSON object in which the keys are the template's special variables and the values are the variables substitutions.

template_sid

The message template. If provided, will override the default template for the Service. SMS and Voice channels only. If the Templates parameter is also provided, Templates takes precedence over this parameter.

templates

A stringified JSON array of template entries, ordered by preference. Each entry is an object with the following fields: sid (string, required, matching ^HJ[0-9a-fA-F]{32}$) — the SID of the message template to apply; and substitutions (object, optional) — a key-value map in which the keys are the template's special variables and the values are their substitution values. The array may contain up to 10 entries. If provided, Templates takes precedence over TemplateSid and TemplateCustomSubstitutions.

get_context

my $context = $client->verify->v2->services($service_sid)->verifications->get_context($sid);

Returns a VerificationContext, and makes no request.

VerificationContext

Returned by $client->verify->v2->services($service_sid)->verifications($sid). It makes no request until one of these methods is called.

fetch

my $verification = $client->verify->v2->services($service_sid)->verifications($sid)->fetch;

Fetch a specific Verification. Returns a VerificationInstance.

update

my $verification = $client->verify->v2->services($service_sid)->verifications($sid)->update($status);

Update a Verification status. Returns a VerificationInstance.

The required values are:

$status

One of canceled or approved.

VerificationInstance

See also Twilio::InstanceResource.

It has fetch and update, which work as they do on the context.

Its fields are:

account_sid

The SID of the Account that created the Verification resource.

amount

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

channel

One of sms, call, email, whatsapp or sna.

date_created

The date and time in GMT when the resource was created specified in RFC 2822 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_updated

The date and time in GMT when the resource was last updated specified in RFC 2822 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

lookup

Information about the phone number being verified.

payee

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

send_code_attempts

An array of verification attempt objects containing the channel attempted and the channel-specific transaction SID.

service_sid

The SID of the Service the resource is associated with.

sid

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

sna

The set of fields used for a silent network auth (sna) verification. Contains a single field with the URL to be invoked to verify the phone number.

status

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

to

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

url

The absolute URL of the Verification resource.

valid

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

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.