NAME
Twilio::Rest::Lookups::V2::PhoneNumber - The PhoneNumber resource
SYNOPSIS
my $client = Twilio::Rest::Client->new($account_sid, $auth_token);
my $phone_number = $client->lookups->v2->phone_numbers($phone_number)->fetch;
DESCRIPTION
Query information on a phone number so that you can make a trusted interaction with your user
This file holds PhoneNumberList, PhoneNumberContext and PhoneNumberInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.
PhoneNumberList
Returned by $client->lookups->v2->phone_numbers. See also Twilio::ListResource.
get_context
my $context = $client->lookups->v2->phone_numbers->get_context($phone_number);
Returns a PhoneNumberContext, and makes no request.
PhoneNumberContext
Returned by $client->lookups->v2->phone_numbers($phone_number). It makes no request until one of these methods is called.
fetch
my $phone_number = $client->lookups->v2->phone_numbers($phone_number)->fetch(\%options);
The Lookup API allows you to query information on a phone number so that you can make a trusted interaction with your user. Returns a PhoneNumberInstance.
The options are:
address_country_code-
User’s country, up to two characters. This query parameter is only used (optionally) for identity_match package requests.
address_line1-
User’s first address line. This query parameter is only used (optionally) for identity_match package requests.
address_line2-
User’s second address line. This query parameter is only used (optionally) for identity_match package requests.
city-
User’s city. This query parameter is only used (optionally) for identity_match package requests.
country_code-
The country code used if the phone number provided is in national format.
date_of_birth-
User’s date of birth, in YYYYMMDD format. This query parameter is only used (optionally) for identity_match package requests.
fields-
A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score, pre_fill.
first_name-
User’s first name. This query parameter is only used (optionally) for identity_match package requests.
last_name-
User’s last name. This query parameter is only used (optionally) for identity_match package requests.
last_verified_date-
The date you obtained consent to call or text the end-user of the phone number or a date on which you are reasonably certain that the end-user could still be reached at that number. This query parameter is only used (optionally) for reassigned_number package requests.
national_id-
User’s national ID, such as SSN or Passport ID. This query parameter is only used (optionally) for identity_match package requests.
partner_sub_id-
The optional partnerSubId parameter to provide context for your sub-accounts, tenantIDs, sender IDs or other segmentation, enhancing the accuracy of the risk analysis.
postal_code-
User’s postal zip code. This query parameter is only used (optionally) for identity_match package requests.
state-
User’s country subdivision, such as state, province, or locality. This query parameter is only used (optionally) for identity_match package requests.
verification_sid-
The unique identifier associated with a verification process through verify API. This query parameter is only used (optionally) for pre_fill package requests.
PhoneNumberInstance
See also Twilio::InstanceResource.
It has fetch, which work as they do on the context.
Its fields are:
- call_forwarding
-
An object that contains information on the unconditional call forwarding status of mobile phone number.
- caller_name
-
An object that contains caller name information based on CNAM.
- calling_country_code
-
International dialing prefix of the phone number defined in the E.164 standard.
- country_code
-
The phone number's ISO country code.
- identity_match
-
An object that contains identity match information. The result of comparing user-provided information including name, address, date of birth, national ID, against authoritative phone-based data sources
- line_status
-
An object that contains line status information for a mobile phone number.
- line_type_intelligence
-
An object that contains line type information including the carrier name, mobile country code, and mobile network code.
- national_format
-
The phone number in national format.
- phone_number
-
The phone number in E.164 format, which consists of a + followed by the country code and subscriber number.
- phone_number_quality_score
-
An object that contains information of a mobile phone number quality score. Quality score will return a risk score about the phone number.
- pre_fill
-
An object that contains pre fill information. pre_fill will return PII information associated with the phone number like first name, last name, address line, country code, state and postal code.
- reassigned_number
-
An object that contains reassigned number information. Reassigned Numbers will return a phone number's reassignment status given a phone number and date
- sim_swap
-
An object that contains information on the last date the subscriber identity module (SIM) was changed for a mobile phone number.
- sms_pumping_risk
-
An object that contains information on if a phone number has been currently or previously blocked by Verify Fraud Guard for receiving malicious SMS pumping traffic as well as other signals associated with risky carriers and low conversion rates.
- url
-
The absolute URL of the resource.
- valid
-
Boolean which indicates if the phone number is in a valid range that can be freely assigned by a carrier to a user.
- validation_errors
-
Contains reasons why a phone number is invalid. Possible values: TOO_SHORT, TOO_LONG, INVALID_BUT_POSSIBLE, INVALID_COUNTRY_CODE, INVALID_LENGTH, NOT_A_NUMBER.
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.