Skip to content

Telephony API

Country calling codes, per-country mobile and fixed-line number lengths, validation patterns, example numbers, NANP prefix-to-city geocoding and prefix-to-IANA-timezone mappings.

API key required OpenAPI API conventions

Phone-number metadata as a queryable API: what calling code a country uses, how long a valid mobile number is there, what regex matches one, what city a North American +1 prefix belongs to, and which IANA timezone a prefix sits in. It is the reference data behind number validation, SMS routing and "what time is it where this number is" — the kind of lookup normally only available by compiling a client library and shipping its metadata with your app.

Every fact here comes from Google's libphonenumber, which is published under the Apache License 2.0. Three of its resource files are used: PhoneNumberMetadata.xml for the per-territory numbering plans, resources/geocoding/en/*.txt for prefix-to-area names, and resources/timezones/map_data.txt for prefix-to-timezone. libphonenumber is Copyright The Libphonenumber Authors; this API redistributes its data under that licence and adds nothing to it. Where libphonenumber records no fact — a territory with no pager plan, a calling code with no country — the field is null rather than guessed.

The data is reshaped, not rewritten. Possible national number lengths are expanded from libphonenumber's own notation into a plain comma-joined list, so mobile_lengths on GB reads "10" and on DE reads "10,11" — split on the comma and compare against your digit count. Validation regexes are stripped of the line breaks the XML uses for readability, so fixed_line_pattern and mobile_pattern are single-line patterns you can hand straight to a regex engine. Repeated place names and timezone names are stored once in lookup tables and joined back onto each row, which is why 66,734 prefixes and 3,718 prefix/timezone pairs fit in a few megabytes. A prefix carries no separate country-code column because the calling code is its own leading digits: ?prefix__starts=44 is a primary-key range scan.

One request each: GET /v1/telephony/calling-codes/972 says calling code 972 is Israel (main_region "IL"), and /calling-codes/44 shows the four regions sharing +44 in its regions field. GET /v1/telephony/prefixes/1212 returns area "New York, NY"; /prefixes?prefix__starts=1718 lists every finer prefix under it. GET /v1/telephony/territories/GB returns mobile_lengths "10", mobile_example "7400123456", national_prefix "0", international_prefix "00" and the mobile regex in one record. GET /v1/telephony/prefix-timezones?prefix=1212 answers "America/New_York". Filter territories by country_code, main_region or mobile_portable; search areas and territories with ?q=.

Row counts: 245 territories (one per ISO 3166-1 alpha-2 region), 215 calling codes including the nine non-geographical ones such as 800 international freephone and 870 Inmarsat, 66,734 geocoded prefixes over 28,575 distinct area names, and 3,718 prefix/timezone pairs over 285 IANA zones. Geocoding coverage is deliberately partial and worth being clear about: the full NANP file plus the country files for +1, +55, +91, +49, +359, +64, +81, +43, +44, +7, +972. China (+86) and Australia (+61) are excluded because their files alone are 190,000 prefixes, which does not fit this dataset's storage budget. Territories, calling codes and timezones are complete. Refreshed from libphonenumber's master branch, which upstream tags roughly every two weeks.

Read-only JSON, filtering, sorting, free-text search and pagination on every collection, with an OpenAPI 3.1 description at /v1/telephony/openapi.json. Calls need a Bodek API key; create one at https://api.bodek.us/keys.

Every call needs a key. Sign in to create one. Bodek API is included with the plans that cover it.

Endpoints

GET /v1/telephony/territories Territories
GET /v1/telephony/territories/{id} A single record
GET /v1/telephony/calling-codes Calling codes
GET /v1/telephony/calling-codes/{id} A single record
GET /v1/telephony/prefixes Prefixes
GET /v1/telephony/prefixes/{id} A single record
GET /v1/telephony/areas Areas
GET /v1/telephony/areas/{id} A single record
GET /v1/telephony/prefix-timezones Prefix timezones
GET /v1/telephony/prefix-timezones/{id} A single record

Try it

https://api.bodek.us/v1/telephony/territories?limit=5

        
      

This panel sends no key, so it answers 401 — it is here to show you the shape of a request and the error envelope. Use curl with your own key to see data.

Territories

One record per ISO 3166-1 region: calling code, dialling prefixes, valid number lengths per number type, example numbers and validation patterns.

FieldTypeDescriptionFilterSearchSort
region_code string ISO 3166-1 alpha-2 region code, and the identifier for this record — e.g. "GB". Fetch /territories/GB directly.
country_name string CLDR short English country name as libphonenumber records it, e.g. "United Kingdom". Null where the source names no country.
country_code integer Country calling code dialled after the international prefix, e.g. 44 for GB, 1 for US and CA.
main_region integer 1 when this region is the main one for its calling code — US for +1, GB for +44. 0 for the others sharing it.
national_prefix string Digits dialled before a national number inside the country, e.g. "0" in GB, "1" in the US. Null where the numbering plan has no national prefix, as in ES and IT.
national_prefix_optional integer 1 when at least one of this region's formatting rules marks the national prefix optional, e.g. 1 for MX.
international_prefix string Digits dialled to reach another country, e.g. "00" for GB. A few plans list alternatives, in which case this is the source's regex, e.g. "00[1-9]".
preferred_international_prefix string The one international prefix to display when the plan allows several, e.g. "0011" for AU. Null when international_prefix is already a single value.
mobile_portable integer 1 when mobile numbers are portable between carriers in this region, so the prefix does not identify the carrier. 1 for GB and US.
national_number_pattern string Regex matching any valid national number in this region, e.g. "[1-9]\d{9}" for US. Single-line, anchored by your own engine.
fixed_line_lengths string Valid national digit counts for fixed-line numbers, comma-joined ascending, e.g. "10" for GB or "6,9" for AD. Null where the region has no fixed-line plan.
mobile_lengths string Valid national digit counts for mobile numbers, e.g. "10" for GB, "10,11" for DE. Split on the comma and compare against your number's digit count.
toll_free_lengths string Valid national digit counts for toll-free numbers, e.g. "10" for GB. Null where the region publishes no toll-free plan.
premium_rate_lengths string Valid national digit counts for premium-rate numbers, e.g. "10" for GB.
voip_lengths string Valid national digit counts for VoIP numbers, e.g. "10" for GB (the 056 range).
pager_lengths string Valid national digit counts for pager numbers, e.g. "10" for GB. Null in most regions.
uan_lengths string Valid national digit counts for UAN (universal access, non-geographic) numbers, e.g. "10" for GB.
voicemail_lengths string Valid national digit counts for voicemail access numbers, e.g. "10,11" for GB. Null in most regions.
fixed_line_example string A valid example fixed-line national number from the source, e.g. "1212345678" for GB. For tests, not a real subscriber.
mobile_example string A valid example mobile national number from the source, e.g. "7400123456" for GB.
toll_free_example string A valid example toll-free national number, e.g. "8001234567" for GB.
fixed_line_pattern string Regex matching a valid fixed-line national number, single-line, e.g. "2\d{9}|...". Use with mobile_pattern to tell number types apart.
mobile_pattern string Regex matching a valid mobile national number, single-line, e.g. "7(?:457[0-57-9]|700[01]...)\d{5}" for GB.
curl "https://api.bodek.us/v1/telephony/territories?limit=5&country_name=example&q=search+text" \
  -H "Authorization: Bearer $BODEK_API_KEY"

Calling codes

One record per country calling code, with every region sharing it and which region is the main one.

FieldTypeDescriptionFilterSearchSort
country_code integer The calling code itself, and the identifier for this record — e.g. 972. Fetch /calling-codes/972 directly.
main_region string ISO 3166-1 alpha-2 code of the main region for this calling code, e.g. "IL" for 972, "US" for 1. Null for the non-geographical codes.
main_country string English name of that main region, e.g. "Israel" for 972. Null for the non-geographical codes.
regions string Every ISO region sharing this calling code, comma-joined and alphabetical, e.g. "GB,GG,IM,JE" for 44.
region_count integer How many regions share this calling code — 1 for 972, 4 for 44, 25 for the NANP code 1.
geographic integer 1 for an ordinary country code; 0 for the nine non-geographical codes libphonenumber marks "001", e.g. 800 international freephone or 870 Inmarsat.
curl "https://api.bodek.us/v1/telephony/calling-codes?limit=5&main_region=example&q=search+text" \
  -H "Authorization: Bearer $BODEK_API_KEY"

Prefixes

Number prefix to geographic area name: 1212 is New York, NY. Full NANP coverage plus ten more country files.

FieldTypeDescriptionFilterSearchSort
prefix string Number prefix in international form, calling code first and no plus sign — e.g. "1212" or "442035". This is the identifier, so /prefixes/1212 is a key lookup and ?prefix__starts=44 lists every UK prefix.
area_id integer Identifier of the area this prefix serves, e.g. 1 — matches id on /areas. Filter by it to list every prefix in one area.
area string The area this prefix serves, as libphonenumber names it in English, e.g. "New York, NY" for 1212 or "Düsseldorf" for 49211.
curl "https://api.bodek.us/v1/telephony/prefixes?limit=5&prefix=example&q=search+text" \
  -H "Authorization: Bearer $BODEK_API_KEY"

Areas

The distinct geographic area names prefixes resolve to, deduplicated — search here, then filter /prefixes by area_id.

FieldTypeDescriptionFilterSearchSort
id integer Identifier for this area, e.g. 1. Use it as area_id on /prefixes to list every prefix serving it.
name string Area name in English as libphonenumber publishes it, e.g. "New York, NY", "Jersey City, NJ" or "São Paulo". NANP names carry a two-letter state or province suffix; other countries carry the place name alone.
curl "https://api.bodek.us/v1/telephony/areas?limit=5&name=example&q=search+text" \
  -H "Authorization: Bearer $BODEK_API_KEY"

Prefix timezones

Number prefix to IANA timezone, one record per pair — 1212 is America/New_York.

FieldTypeDescriptionFilterSearchSort
id integer Identifier for this prefix/timezone pair, e.g. 1. Pairs exist because one prefix can span several zones.
prefix string Number prefix in international form, calling code first and no plus sign, e.g. "1212". Query ?prefix=1212 for its zones, or ?prefix__starts=972 for a whole country.
timezone string IANA timezone identifier, e.g. "America/New_York" for 1212 or "Asia/Jerusalem" for 972. Pass it straight to a date library. A prefix spanning zones has one record per zone.
curl "https://api.bodek.us/v1/telephony/prefix-timezones?limit=5&prefix=example&q=search+text" \
  -H "Authorization: Bearer $BODEK_API_KEY"

Common questions

How do I get access to the Telephony API?

Bodek API is included with the Bodek plans that cover it. Sign in, create a key on the keys page, and send it as an Authorization: Bearer header. A key is scoped to the APIs you pick, carries its own rate limits and expiry, and can be revoked at any time.

What format does it return?

JSON over HTTPS, one GET per collection, with the same filtering, search, sort and paging conventions on every endpoint. An OpenAPI 3.1 description is published at https://api.bodek.us/v1/telephony/openapi.json.

How often does the data change?

It is maintained as production reference data, and responses carry an ETag so an unchanged request comes back as an empty 304. This API was last updated on 26 October 2026.

Limits

  • Up to 200 records per request (limit), 50 by default.
  • Rate limits are set per key, up to 600 requests a minute.
  • Responses are cached for up to 3600 seconds and carry an ETag.