Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Lookup v1 Tutorial: Carrier and Caller Name


(warning)

Warning

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:

  • Line Type Intelligence : Get the line type of a phone number including mobile, landline, fixed VoIP, non-fixed VoIP, toll-free, and more.
  • SIM Swap : Get information on the last SIM change for a mobile phone number.
  • Call Forwarding : Get the unconditional call forwarding status of a mobile phone number.
  • Identity Match : Get confirmation of ownership for a mobile phone number by comparing user-provided information against authoritative phone-based data sources.

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(link takes you to an external page) or the API v2 Reference for more information.

Given a phone number, Twilio Lookup can identify the number's carrier and what type of phone it is (landline, mobile, or VoIP). In the U.S., Lookup can also retrieve the name of the person or business associated with a phone number (if available).

Lookup can show you even more information about a phone number using Twilio Add-ons. See the Add-ons guide to learn more.


Identify a phone number's carrier and type

identify-a-phone-numbers-carrier-and-type page anchor

To discover a phone number's carrier and what type of phone it is, pass an extra argument to your lookup requesting carrier information.

Lookup with E.164 Formatted Number

lookup-with-e164-formatted-number page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.lookups.v1.phoneNumbers('+15108675310')
_10
.fetch({type: ['carrier']})
_10
.then(phone_number => console.log(phone_number.carrier));

Output

_15
{
_15
"caller_name": null,
_15
"carrier": {
_15
"error_code": null,
_15
"mobile_country_code": "310",
_15
"mobile_network_code": "456",
_15
"name": "verizon",
_15
"type": "mobile"
_15
},
_15
"country_code": "US",
_15
"national_format": "(510) 867-5310",
_15
"phone_number": "+15108675310",
_15
"add_ons": null,
_15
"url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675310"
_15
}

The response will contain two additional fields:

  • Type specifies whether the phone is a landline , mobile , or voip phone
  • Carrier is the name of the phone's carrier, like Verizon Wireless . Note that carriers rebrand frequently
(information)

Info

Note: Type voip is only returned for eligible U.S. numbers. VoIP detection is not available outside of the U.S and only landline or mobile will be returned for non-U.S. phone numbers.

If your phone number is invalid or incorrectly formatted, Twilio will return a 404 error.


Get a name associated with a phone number

cnam page anchor

Note: Caller name lookup is available for U.S. numbers only.

Lookup can also retrieve the name of the individual or business associated with a phone number. Simply pass a caller-name argument to your lookup request.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.lookups.v1.phoneNumbers('+15108675310')
_10
.fetch({type: ['caller-name']})
_10
.then(phone_number => console.log(phone_number.callerName));

Output

_13
{
_13
"caller_name": {
_13
"caller_name": "Delicious Cheese Cake",
_13
"caller_type": "CONSUMER",
_13
"error_code": null
_13
},
_13
"carrier": null,
_13
"country_code": "US",
_13
"national_format": "(510) 867-5310",
_13
"phone_number": "+15108675310",
_13
"add_ons": null,
_13
"url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675310"
_13
}

If available, the response will include a name for the phone number and whether the name is for a business or consumer.

Keep in mind that not all numbers will have names available.

Want even more information about a phone number? See the Twilio Add-ons guide to learn more and check out the available Lookup add-ons in the console(link takes you to an external page).


Rate this page: