Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

(Update: Commenter "homero" mentioned that Twilio's CNAM API response includes the carrier: https://support.twilio.com/hc/en-us/articles/360050891214-Ge... . Twilio's docs make it sound like this API does incorporate mobile number portability, which is what you need, but I haven't personally verified. Can anyone from Twitter confirm that the LNP info is at least near-realtime?)

You'll need either access to an SS7 routing system or, more likely, an HTTP API that exposes 10-digit number routing info. Google for '10 digit OCN lookup' or 'realtime CNAM lookup API' and you'll be on the right track. You need one that handles mobile number portability. Most APIs charge a small per-query fee because it's not static data. Any one number can be ported at any time and the only way to know is to see where (in SS7) it's actually routed.

And be aware that there's a fair number of gotchas. I have a lot of experience in the telco world[1]. The two big gotchas are:

1. Inbound and outbound carriers can be and often are different, and outbound caller ID can be spoofed. The source number on an SMS from a 10-digit number (a "10DLC" SMS) is much, much less likely to be spoofed than the caller ID on a robocall. You can fairly reliably report source numbers on SMSes.

To keep it simple, consider starting by reporting SMSes.

For robocalls, expect that many robocall CIDs are spoofed, and the most interesting robocalls are the ones that ask the recipient to contact them at the same number. Or, where both the CID and the callback/contact number are DIDs from the same carrier.

2. Number portability means that all the old static databases (LERG and NPA-NXX-Y Number Pooling[2] databases) aren't enough. One phone number might be routed to one carrier and the sequentially-next number might be routed to a completely different carrier, and either of them might change the next day.

This is just the start - there are other gotchas and a pretty significant learning curve. Stay polite and professional, assume good intentions, and assume you're wrong about something.

[1]: Back in 2010, I made the first free, public REST API for looking up phone data: https://www.slideshare.net/troyd/cloudvox-digits-phone-api-l..., https://www.prnewswire.com/news-releases/cloudvox-launches-f...

[2]: https://nationalnanpa.com/ and for thousands-block reports, https://www.nationalpooling.com/ -> Reports -> Block Report by Region



In general most APIs incorporate number portability for US. It's much more harder to do this for countries internationally.

We at Plivo also provide such an API which incorporates number portability for US: https://www.plivo.com/docs/lookup/

Plivo's API above is updated on a daily basis for portability information.

Caller ID as you mention for voice calls is quite easy to spoof, however with the STIR SHAKEN rollout, the intention is to make carriers accountable. SMS however with 10DLC is almost impossible to spoof the number.


What about number portability in other countries? Why don't you let your clients port out their non US numbers?


This discussion and the parent comment isn’t about whether they allow porting numbers. It’s about whether a number information API (CNAM) - where you’re querying for information about a number you don’t own - includes the carrier that a number has been ported to.


Update for anyone who finds this thread: Both Twilio and Plivo offer self-service APIs to find out which carrier a US number is routed to. Query for the source number of an SMS spam or the number that a robocall tells you to call back on, then email your abuse report to the carrier.

For Twilio: Per https://www.twilio.com/docs/lookup/v2-api/line-type-intellig..., include the query parameter "Fields=line_type_intelligence". That param will make the API response populate the key "CarrierName".

For Plivo: As noted in another reply, Plivo's Lookup API returns carrier info. Per https://www.plivo.com/docs/lookup/api/response#response-exam..., responses include the carrier name by default.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: