Skip to main content

NANPA API Client

A Python client for interacting with the North American Numbering Plan Administration (NANPA) public API system.

Overview

The North American Numbering Plan (NANP) is the unified telephone numbering system used by the United States, Canada, and many Caribbean territories. Established in 1997, NANPA serves as the administrator for this system, managing the allocation and assignment of area codes, central office codes, and other numbering resources to ensure efficient telecommunications routing and prevent number exhaustion.

This client provides a simple interface to NANPA's public API endpoints, allowing developers to programmatically access critical numbering plan data and network information.

Installation

pip install nanpa

or...

git clone https://github.com/acidvegas/nanpa
cd nanpa
python setup.py install

API Documentation

State & Area Code Information

The foundation of the NANP system revolves around geographic numbering assignments. The get_states() method returns all participating regions in the NANP, including US states and territories, Canadian provinces, and Caribbean nations. For more granular information, get_area_codes_by_state(state) provides all area codes assigned to a specific region, while get_area_code_info(npa) delivers detailed information about individual area codes including their service boundaries, implementation dates, and relief planning status.

Rate Center Operations

Rate centers form the geographic backbone of telephone billing and routing. Using get_rate_centers(state), you can retrieve information about these fundamental units within any state, including their coordinates, associated area codes, and operating companies. The get_rate_center_changes(start_date, end_date) method tracks modifications to these configurations over time, such as consolidations, splits, and boundary adjustments.

Number Block Management

The NANP manages telephone numbers in blocks of 1,000 consecutive numbers. The get_thousands_blocks(state, npa, report_type) method provides information about these blocks, including carrier assignments and availability. For future planning, get_pooling_forecast(state, npa) projects number utilization and exhaust dates, while get_current_pool_tracking(state, npa) monitors active pool sizes and carrier participation.

Network Infrastructure

Location Routing Numbers (LRNs) are crucial for number portability in modern networks. The get_lrn_forecast(state, npa) method helps plan for routing efficiency and port capacity. Central office code assignments can be monitored through get_co_code_forecast(state, npa), while get_pstn_activation(state) provides status updates on Public Switched Telephone Network readiness.

Specialty Number Resources

Beyond geographic numbers, NANPA manages special purpose codes. The 5XX NPA code family, accessed through various methods like get_specialty_codes_available(), get_specialty_codes_assigned(), and get_specialty_codes_aging(), serves non-geographic services. The 9YY codes, retrieved via get_9yy_codes(), are reserved for premium services, emergency preparedness, and network testing.

Usage Example

from nanpa import NanpaAPI

client = NanpaAPI()

# Get rate centers in Florida
fl_centers = client.get_rate_centers('FL')

# Check thousands blocks for area code 239
blocks = client.get_thousands_blocks('FL', '239')

# Monitor rate center changes
changes = client.get_rate_center_changes(
    '2024-12-01T00:00:00.000-05:00',
    '2024-12-31T23:59:59.999-05:00'
)

Mirrors: acid.vegas • SuperNETs • GitHub • GitLab • Codeberg

Metadata

Release files for nanpa 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nanpa 1.0.1
File Size Uploaded Provenance Actions
nanpa-1.0.1.tar.gz 5.0 kB Without provenance Details for nanpa-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nanpa 1.0.1
File Interpreter ABI Platform Actions
nanpa-1.0.1-py3-none-any.whl Python 3 none any Details for nanpa-1.0.1-py3-none-any.whl

Total release size: 10.5 kB

Release files / nanpa-1.0.1.tar.gz

Download URL nanpa-1.0.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
19eb0f2789f98ab4f82c5d3bb63ce1a4d6f5ea9d5f81553fae1520e704799305
BLAKE2b-256 checksum
How to use checksums
3330dd8718a15bb4b3874b00679c90d826c6aa9600478aea707cd1753829d14b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / nanpa-1.0.1-py3-none-any.whl

Download URL nanpa-1.0.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
344ba0f8bb426e0c54503228d93cd5f7a0b68d5eafe08a3289456eb61343237c
BLAKE2b-256 checksum
How to use checksums
25cf178188c0c65ed01be39ca04f8895fd907aeade0dbafb167bdf5264e7c6a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Security for nanpa 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page