Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Lookup v1 Tutorial: Carrier and Caller Name


(warning)

Warning

This is legacy Lookup v1 content. Use Lookup v2 for all new development.

Lookup v1 is in maintenance mode: it receives no new features and all ongoing development will happen in v2. If you're starting a new integration, you should use Lookup v2, not v1.

Lookup v2 has an improved developer experience and new features, such as Twilio Regions support and these 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. Includes 13 new line types for more accurate results compared to 3 line types in Lookup v1.
  • SIM Swap: Get information on the last SIM change for 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.

Check out the migration guide(link takes you to an external page) or the Lookup v2 API Reference to move over.

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 Marketplace Add-ons. See the How to Use Add-on Listings 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.

(warning)

Warning

This is Lookup v1 (legacy) code. Lookup v1 is in maintenance mode and receives no new features. For new development, use the Lookup v2 API instead — start with the Lookup v2 Quickstart.

Lookup with E.164 Formatted NumberLink to code sample: Lookup with E.164 Formatted Number
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchPhoneNumber() {
11
const phoneNumber = await client.lookups.v1
12
.phoneNumbers("+15108675310")
13
.fetch({ type: ["carrier"] });
14
15
console.log(phoneNumber.carrier);
16
}
17
18
fetchPhoneNumber();

Response

Note about this response
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
}

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. Pass a caller-name argument to your lookup request.

(warning)

Warning

This is Lookup v1 (legacy) code. Lookup v1 is in maintenance mode and receives no new features. For new development, use the Lookup v2 API instead — start with the Lookup v2 Quickstart.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchPhoneNumber() {
11
const phoneNumber = await client.lookups.v1
12
.phoneNumbers("+15108675310")
13
.fetch({ type: ["caller-name"] });
14
15
console.log(phoneNumber.callerName);
16
}
17
18
fetchPhoneNumber();

Response

Note about this response
1
{
2
"caller_name": {
3
"caller_name": "Delicious Cheese Cake",
4
"caller_type": "CONSUMER",
5
"error_code": null
6
},
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
}

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 Marketplace How to Use Add-on Listings guide to learn more and check out the available Lookup Add-ons in the Console(link takes you to an external page).