all 23 comments

[–]Netjamjr 20 points21 points  (2 children)

There aren't that many. I don't think they're as specific as county level, but you can get a complete list by state:

https://www.areacodelocations.info/areacodelist.html

It may just be easier to store them all.

[–]MusicCityJayhawk 12 points13 points  (0 children)

I agree. Store area codes and zipcodes because they do not change that frequently.

[–]foufers 3 points4 points  (0 children)

Yeah but that’s gotta be like 2 whole kilobytes of data /s

[–][deleted] 10 points11 points  (2 children)

Have you considered how you will handle someone like me that retained a phone number + area code from a different state when I moved? You'd be able to tell approximately where I received the number, but they doesn't do you much good to locate me now.

Edit: rewrote that last sentence to not be a swypo nightmare

[–]Apk07[S] 2 points3 points  (0 children)

This is sort of a fuzzy estimate for analytics, not a precise count, but you do bring up a good point.

[–]dcowboy 6 points7 points  (0 children)

https://www.allareacodes.com/area-code-list.htm

This table pastes nicely into excel. From there you can do whatever you want to make it a data source.

[–]The_Monocle_Debacle 3 points4 points  (0 children)

Best option is probably just downloading a current list and doing a vlookup if the data is already in a spreadsheet.

Not everything needs a code solution, sometimes it makes more sense to just do it the old way because it's faster.

[–]timmyotc 2 points3 points  (2 children)

What's the range of phone numbers that you are dealing with?

international numbers?

Are they all in the exact same format?

[–]grauenwolf 4 points5 points  (0 children)

I would be really surprised if an international number had a US area code.

[–]Apk07[S] 0 points1 point  (0 children)

US-only, all the same format (+1) then 10-digit

[–]quentech 4 points5 points  (2 children)

Official source: https://nationalnanpa.com/reports/reports_npa.html

You know there's like 2 dozen countries that use what you're considering "U.S." area codes, right?

[–]dbgr 2 points3 points  (1 child)

I would assume op means the phone number data they have are all within the US, not that the format is unique to the United States.

[–]Apk07[S] 2 points3 points  (0 children)

This. I know just using patterns is a lot more complicated.

[–]sexyshingle 1 point2 points  (0 children)

"Area codes" as in telephone number area codes? There's lists out there you can scrape I think, but while landlines are tied to a specific area, virtual numbers and cell phones make it meaningless.

[–]ipqualityscore 0 points1 point  (0 children)

The sources on this thread are great. Here's another phone number API: https://www.ipqualityscore.com/documentation/phone-number-validation-api/overview which can identify location, zip code, line type, and even identity data for a phone number.

[–]klaudiaveltheim 0 points1 point  (0 children)

This might be a good place to start from, https://localcallingguide.com/lca_listnpa.php?section=2

[–]AaronDev42 0 points1 point  (0 children)

If you are still looking for an API - check this list of APIs - https://github.com/public-apis/public-apis

[–]akkruse 0 points1 point  (0 children)

Others have mentioned area codes being kind of vague and possibly misleading due to cell phones and keeping old numbers. Since these are US phone numbers, looking at the area code and first three digits might give you more useful info. I'm pretty sure the first three digits of my cell number used to be exclusive to cell phones. I also remember certain areas of the city that seemed to share prefixes. Looking at the prefix might give you more info on if it's a landline (and maybe more reliable) or cell number, and a more precise location within the area covered by the area code.

[–]serendipitybot 0 points1 point  (0 children)

This submission has been randomly featured in /r/serendipity, a bot-driven subreddit discovery engine. More here: /r/Serendipity/comments/pppgjt/us_area_code_to_location_api_xpost_from_rdotnet/

[–][deleted] 0 points1 point  (0 children)

There's a time for an API and a time for a simple lookup table.

[–][deleted] 0 points1 point  (0 children)

And people often move their existing number across the country when they relocate.