Wednesday, 10 April, 2019 UTC


Some bad actors use phone numbers from free online providers to create fake profiles to defraud or spam. Twilio's Carrier Lookup API helps you identify the carrier behind the phone number to learn which users are more likely to be fraudulent.

Lookup a carrier with Twilio

To lookup a phone number you will need:
  • A free Twilio Account
  • Your terminal or a tool like Postman
You can query the Twilio Lookup API for information about a phone number. There are two Types of requests the API can perform: carrier and caller-name. This example focuses on carrier.
The following request will return carrier information about a phone number. The phone number in the request URL must be in E.164 format like +18557477626. Replace the credentials with your Account SID and Auth Token found in the console.
In your terminal, run the following code:
If you want to add this functionality in an application, Twilio has helper libraries in languages including C#, Ruby, Python, Java, JavaScript, and PHP. This will return a JSON response:
{  "caller_name": null,  "country_code": "US",  "phone_number": "+18557477626",  "national_format": "(855) 747-7626",  "carrier": {  "mobile_country_code": null,  "mobile_network_code": null,  "name": "Twilio - Toll-Free - SMS-Sybase365/MMS-SVR",  "type": "voip",  "error_code": null  },  "fraud": null,  "add_ons": null,  "url": "" } 
You can see that the carrier name for our example number, 1 (855) 747-7626, is Twilio. Similar information is returned for mobile and landline carriers such as AT&T or Level 3 Communications.
Try running the request again with your own phone number and see what comes back! Bear in mind that carriers rebrand themselves constantly and that the names used for carriers likely will change over time.

Are the carriers returned accurate?

Have you ever gotten a call from a weirdly invalid number or even from your own phone number? I got a call from this 9-digit invalid number earlier today -- that can't be right! The way telephony systems are set up today, anyone can spoof a call or a text from any number. Even if they don’t own that number.
Twilio doesn't allow customers to use numbers that they don't own. This practice, unfortunately, doesn’t prevent others from spoofing Twilio serviced numbers. This isn't cool so we're working with other industry leaders to address spoofing. Although we’re optimistic these efforts will have a big impact, we don’t expect them to start paying off until 2020.

After looking up carrier information, what's next?

We know we're not the only ones who are curious who's calling, so we built a public Twilio bot that uses the Lookup API to let you know a number's carrier.

Text +1 (855) 747-7626* with a phone number to check if it is from Twilio. That’s +1 (855) 747-ROBO

*standard text messaging rates may apply
If you're getting spam calls or texts from a Twilio number, this text hotline will help you report it. Learn more about this and what we're doing to stop spam on our platform.
Here are some other things you can build with the Lookup API:
  • Validate Phone Numbers
  • Identify line type (mobile vs. landline vs. voip)
  • Identify robocalls and spam with the Nomorobo Add-on
  • Build your own caller ID with caller name Lookup
For more information, check out the Lookup API documentation. Have you built something that takes advantage of Twilio Lookup? Let me know in the comments or on Twitter @kelleyrobinson.