Version 2 of the Lookup API is now available! Lookup v2 has an improved developer experience and exciting features, such as Twilio Regions support and these new data packages:
You are currently viewing Version 1 content. Lookup v1 will be maintained for the time being, but any new features and development will be on v2. We strongly encourage you to do any new development with Lookup v2. Check out the migration guide or the API v2 Reference for more information.
The Lookup API provides a way to retrieve additional information about a phone number. Lookup currently supports the following types of data.
You can specify one or more types of information you would like to purchase in the request, check the Lookup Product Page for pricing information.
All URLs referenced in the documentation use the following URL.
https://lookups.twilio.com/v1/PhoneNumbers/{PhoneNumber}
The Twilio REST API is served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.
{PhoneNumber}
is the phone number you are requesting information about. Phone numbers can be specified either in national formatting or in standard E.164 format. If providing a number in local national format, please also specify the country as an optional parameter. If no country is provided, this will default to US.
In some cases, non-US phone numbers in national format with no +
sign or CountryCode
query parameter are being processed as valid. This is not changing in V1 in the future but it is an unintended behavior and could lead to ambiguous validation responses.
HTTP requests to the REST API are protected with HTTP Basic authentication. To learn more about how Twilio handles authentication, please refer to our security documentation. In short, you will use your Twilio account SID as the username and your auth token as the password for HTTP Basic authentication.
1curl -G https://lookups.twilio.com/v1/PhoneNumbers/{PhoneNumber} \2-u '[YOUR ACCOUNT SID]:[YOUR AUTH TOKEN]'
You can find your account SID and auth token in your console.
To learn more about authentication and interaction with the Twilio REST API, check out our documentation for requests to the API and Twilio's response .
Returns phone number information matching the specified request. Formatting information is standard. Carrier, Caller Name, and phone number type information can be requested, in addition to using Twilio Marketplace Add-ons to access 3rd party data sources.
The following basic GET
query string parameters allow you to specify the phone number you want information about and the types of information you'd like:
The phone number to lookup in E.164 format, which consists of a + followed by the country code and subscriber number.
The ISO country code of the phone number to fetch. This is used to specify the country when the phone number is provided in a national format.
The type of information to return. Can be: carrier
or caller-name
. The default is null. Carrier information costs $0.005 per phone number looked up. Caller Name information is currently available only in the US and costs $0.01 per phone number looked up. To retrieve both types on information, specify this parameter twice; once with carrier
and once with caller-name
as the value.
The unique_name
of an Add-on you would like to invoke. Can be the unique_name
of an Add-on that is installed on your account. You can specify multiple instances of this parameter to invoke multiple Add-ons. For more information about Add-ons, see the Add-ons documentation.
Data specific to the add-on you would like to invoke. The content and format of this value depends on the add-on.
The following properties are always returned:
The name of the phone number's owner. If null
, that information was not available.
The phone number in E.164 format, which consists of a + followed by the country code and subscriber number.
A JSON string with the results of the Add-ons you specified in the add_ons
parameters. For the format of the object, see Using Add-ons.
The absolute URL of the resource.
The following additional properties are returned if you requested carrier information in your GET
request:
Name | Description |
---|---|
MobileCountryCode | The three digit mobile country code of the carrier, used with the mobile network code to identify a mobile network operator. |
MobileNetworkCode | The two-three digit mobile network code of the carrier, used with the mobile country code to identify a mobile network operator (only returned for mobile numbers). |
Name | The name of the carrier; often subject to change. |
Type | The phone number type. Possible values are landline , mobile , or voip . See 'Phone Number Types' below for more information. |
ErrorCode | The error code, if any, associated with your request. |
The following are the possible values for the 'Type' property.
Type | Description |
---|---|
landline | The phone number is a landline number; generally not capable of receiving SMS messages. |
mobile | The phone number is a mobile number; generally capable of receiving SMS messages. |
voip | An internet based phone number that may or may not be capable of receiving SMS messages. For example, Google Voice. Returned for U.S. numbers only. |
null | The phone number is valid but no information was returned from our data providers (see limitation for Canada numbers). |
Caller name information is sourced through CNAM and only available for phone numbers owned by carriers in the US. We recommend testing the coverage rate of this lookup with your specific dataset of phone numbers.
The following additional properties are returned if you requested caller name in your GET
request:
Name | Description |
---|---|
CallerName | String indicating the name of the owner of the phone number. If not available, this will return null . |
CallerType | String indicating whether this caller is a business or consumer. Possible values are BUSINESS , CONSUMER . If not available, this will return null . |
ErrorCode | The error code, if any, associated with your request. |
Caller name lookups for US numbers are billed per lookup, even if data is not be available. Requesting Caller name lookups for non-US will return null
values and will not be billed.
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 fetchPhoneNumber() {11const phoneNumber = await client.lookups.v112.phoneNumbers("+15108675310")13.fetch({ type: ["carrier"] });1415console.log(phoneNumber.carrier);16}1718fetchPhoneNumber();
1{2"caller_name": null,3"carrier": {4"error_code": null,5"mobile_country_code": "310",6"mobile_network_code": "456",7"name": "verizon",8"type": "mobile"9},10"country_code": "US",11"national_format": "(510) 867-5310",12"phone_number": "+15108675310",13"add_ons": null,14"url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675310"15}
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 fetchPhoneNumber() {11const phoneNumber = await client.lookups.v112.phoneNumbers("(510)867-5310")13.fetch({14countryCode: "US",15type: ["carrier"],16});1718console.log(phoneNumber.carrier);19}2021fetchPhoneNumber();
1{2"caller_name": null,3"carrier": {4"error_code": null,5"mobile_country_code": "310",6"mobile_network_code": "456",7"name": "verizon",8"type": "mobile"9},10"country_code": "US",11"national_format": "(510) 867-5310",12"phone_number": "(510)867-5310",13"add_ons": null,14"url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675310"15}
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 fetchPhoneNumber() {11const phoneNumber = await client.lookups.v112.phoneNumbers("+15108675310")13.fetch({ type: ["caller-name"] });1415console.log(phoneNumber.callerName);16}1718fetchPhoneNumber();
1{2"caller_name": {3"caller_name": "Delicious Cheese Cake",4"caller_type": "CONSUMER",5"error_code": null6},7"carrier": null,8"country_code": "US",9"national_format": "(510) 867-5310",10"phone_number": "+15108675310",11"add_ons": null,12"url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675310"13}
Lookup also supports Twilio Marketplace Add-ons, enabling you to retrieve information from a multitude of 3rd party data sources, available via the Twilio Marketplace.
You can add Lookup supported Add-ons by visiting the Twilio Console to enable the Add-on. Once it has been enabled, make sure you have 'Lookups' selected in its configuration:
When you use AddOns
, you can pass additional parameters to the Add-on(s):
Name | Description |
---|---|
AddOns.addon_name.param_name | Optional. Passes additional data to the Add-on at request time. See Add-on documentation in Console to identify if the Add-on requires additional parameters. |
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 fetchPhoneNumber() {11const phoneNumber = await client.lookups.v112.phoneNumbers("+16502530000")13.fetch({14addOns: ["payfone_tcpa_compliance"],15addOnsData: {16"payfone_tcpa_compliance.RightPartyContactedDate": "20160101",17},18type: ["carrier"],19});2021console.log(phoneNumber.addOns);22}2324fetchPhoneNumber();
1{2"caller_name": null,3"country_code": "US",4"phone_number": "+16502530000",5"national_format": "(650) 253-0000",6"carrier": {7"mobile_country_code": null,8"mobile_network_code": null,9"name": "Level 3 Communications, LLC",10"type": "landline",11"error_code": null12},13"add_ons": {14"status": "successful",15"message": null,16"code": null,17"results": {18"payfone_tcpa_compliance": {19"status": "successful",20"request_sid": "XRd3a2991c9108bde3ca9589ed84d31463",21"message": null,22"code": null,23"result": {24"Status": 0,25"Response": {26"MSISDNType": "NonFixedVoIP",27"NumberMatch": "I",28"VerifyNumberTransactionId": "2019459819"29},30"RequestId": "XRd3a2991c9108bde3ca9589ed84d31463",31"Description": "Success."32}33}34}35},36"url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000"37}
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 fetchPhoneNumber() {11const phoneNumber = await client.lookups.v112.phoneNumbers("+19892008374")13.fetch({ addOns: ["nomorobo_spamscore"] });1415console.log(phoneNumber.addOns);16}1718fetchPhoneNumber();
1{2"caller_name": null,3"country_code": "US",4"phone_number": "+19892008374",5"national_format": "(989) 200-8374",6"carrier": {7"mobile_country_code": "310",8"mobile_network_code": null,9"name": "Ytel/Blitz",10"type": "mobile",11"error_code": null12},13"add_ons": {14"status": "successful",15"message": null,16"code": null,17"results": {18"nomorobo_spamscore": {19"status": "successful",20"request_sid": "XR763c8acc4c56d5e3e18d2f0f12345bc1",21"message": null,22"code": null,23"result": {24"status": "success",25"message": "success",26"score": 127}28}29}30},31"url": "https://lookups.twilio.com/v1/PhoneNumbers/+19892008374"32}