ZIP and postal codes geocoding API client — zipfyi.com
Project description
zipfyi
Python API client for zipfyi.com -- the comprehensive postal code and geocoding database covering ZIP codes, cities, states, and countries worldwide. Look up postal code boundaries, geographic coordinates, and area demographics through a free REST API, CLI, or MCP server for AI assistants.
ZipFYI maps postal codes to geographic locations with city, state, and country associations -- built for developers, logistics engineers, and data analysts who need structured address and geocoding data.
Explore postal codes at zipfyi.com -- look up ZIP codes, browse cities, and explore postal systems by country.
Table of Contents
- Install
- Quick Start
- What You Can Do
- Command-Line Interface
- MCP Server (Claude, Cursor, Windsurf)
- REST API Client
- API Reference
- Learn More About Postal Codes
- Geo FYI Family
- FYIPedia Developer Tools
- License
Install
pip install zipfyi # Core (zero deps)
pip install "zipfyi[cli]" # + Command-line interface
pip install "zipfyi[mcp]" # + MCP server for AI assistants
pip install "zipfyi[api]" # + HTTP client for zipfyi.com API
pip install "zipfyi[all]" # Everything
Quick Start
from zipfyi.api import ZipFYI
with ZipFYI() as api:
# Look up a postal code
postal_codes = api.list_postal_codes()
# Get details for a specific postal code
zipcode = api.get_postal_code("10001")
# Browse cities and states
cities = api.list_cities()
nyc = api.get_city("new-york")
# Search across all postal code content
results = api.search("Manhattan")
What You Can Do
Look Up Postal Codes
A postal code (ZIP code in the United States) is a series of letters, digits, or both that is appended to a mailing address to assist mail sorting. The term "ZIP" stands for Zone Improvement Plan, introduced by the United States Postal Service in 1963. ZIP+4 codes add four additional digits for more precise delivery routing.
| US ZIP Code Format | Structure | Example | Coverage |
|---|---|---|---|
| ZIP (5-digit) | NNNNN | 10001 | General delivery area |
| ZIP+4 | NNNNN-NNNN | 10001-1234 | Specific block or building |
| ZIP Code Prefix | NNN | 100 | Regional processing center |
from zipfyi.api import ZipFYI
# Look up postal code with geographic coordinates and area info
with ZipFYI() as api:
zipcode = api.get_postal_code("10001")
print(zipcode["name"]) # Postal code details
# Browse by state
states = api.list_states()
ny = api.get_state("new-york")
Learn more: Browse Postal Codes · Glossary · Guides
Postal Code Systems Worldwide
Different countries use different postal code formats. Some use purely numeric codes (US, Germany), others use alphanumeric (UK, Canada), and a few countries have no postal code system at all. The format length varies from 3 digits (Iceland) to 10 characters (Iran).
| Country | Format | Example | Name |
|---|---|---|---|
| United States | NNNNN | 10001 | ZIP Code |
| United Kingdom | A9 9AA | SW1A 1AA | Postcode |
| Canada | A9A 9A9 | K1A 0B1 | Postal Code |
| Germany | NNNNN | 10115 | Postleitzahl (PLZ) |
| Japan | NNN-NNNN | 100-0001 | Yubin Bango |
| Australia | NNNN | 2000 | Postcode |
| India | NNNNNN | 110001 | PIN Code |
| Brazil | NNNNN-NNN | 01001-000 | CEP |
from zipfyi.api import ZipFYI
# Browse postal systems by country
with ZipFYI() as api:
countries = api.list_countries()
japan = api.get_country("japan")
# Read blog posts about postal code systems
posts = api.list_blog_posts()
series = api.list_blog_series()
Learn more: Browse Countries · Blog · API Docs
Geocoding and Area Lookup
Geocoding is the process of converting an address or postal code into geographic coordinates (latitude and longitude). Reverse geocoding does the opposite -- converting coordinates into a human-readable address. Postal code geocoding provides the centroid coordinates of the delivery area.
| Geocoding Type | Input | Output | Use Case |
|---|---|---|---|
| Forward | Address or postal code | Lat/Lon coordinates | Map plotting, routing |
| Reverse | Lat/Lon coordinates | Address or postal code | Location-based services |
| Batch | Multiple addresses | Multiple coordinates | Data enrichment, ETL |
from zipfyi.api import ZipFYI
# Explore cities and their associated postal codes
with ZipFYI() as api:
cities = api.list_cities()
city = api.get_city("san-francisco")
# Access glossary terms for postal terminology
glossary = api.list_glossary()
term = api.get_term("geocoding")
Learn more: Browse Cities · States · Glossary
Command-Line Interface
pip install "zipfyi[cli]"
# Search for postal codes
zipfyi search "90210"
# Output is JSON for easy piping
zipfyi search "Beverly Hills" | jq '.results[0]'
MCP Server (Claude, Cursor, Windsurf)
Add postal code data tools to any AI assistant that supports Model Context Protocol.
pip install "zipfyi[mcp]"
Add to your claude_desktop_config.json:
{
"mcpServers": {
"zipfyi": {
"command": "python",
"args": ["-m", "zipfyi.mcp_server"]
}
}
}
Available tools: search_zipfyi
REST API Client
from zipfyi.api import ZipFYI
with ZipFYI() as api:
# List endpoints
postal_codes = api.list_postal_codes()
cities = api.list_cities()
states = api.list_states()
countries = api.list_countries()
glossary = api.list_glossary()
# Detail endpoints
zipcode = api.get_postal_code("10001")
city = api.get_city("chicago")
# Search
results = api.search("downtown")
API Reference
| Method | Description |
|---|---|
list_postal_codes(**params) |
List all postal codes |
get_postal_code(slug) |
Get postal code detail |
list_cities(**params) |
List all cities |
get_city(slug) |
Get city detail |
list_states(**params) |
List all states/provinces |
get_state(slug) |
Get state detail |
list_countries(**params) |
List all countries |
get_country(slug) |
Get country detail |
list_glossary(**params) |
List glossary terms |
get_term(slug) |
Get glossary term detail |
list_blog_posts(**params) |
List all blog posts |
get_blog_post(slug) |
Get blog post detail |
list_blog_series(**params) |
List all blog series |
get_blog_sery(slug) |
Get blog series detail |
list_faqs(**params) |
List all FAQs |
get_faq(slug) |
Get FAQ detail |
search(query) |
Search across all content |
Full API documentation at zipfyi.com/developers/.
Learn More About Postal Codes
- Browse: Postal Codes · Cities · Countries
- Guides: Glossary · Blog
- API: REST API Docs · OpenAPI Spec
Geo FYI Family
Part of the FYIPedia open-source developer tools ecosystem -- geography, distance, elevation, and natural events.
| Package | PyPI | Description |
|---|---|---|
| distancefyi | PyPI | Haversine distance & travel times -- distancefyi.com |
| mountainfyi | PyPI | Mountains, peaks, elevation, climbing routes -- mountainfyi.com |
| quakefyi | PyPI | Earthquakes, seismic data, tectonic plates -- quakefyi.com |
| zipfyi | PyPI | ZIP/postal codes, geocoding, area lookup -- zipfyi.com |
FYIPedia Developer Tools
| Package | PyPI | npm | Description |
|---|---|---|---|
| colorfyi | PyPI | npm | Color conversion, WCAG contrast, harmonies -- colorfyi.com |
| emojifyi | PyPI | npm | Emoji encoding & metadata -- emojifyi.com |
| symbolfyi | PyPI | npm | Symbol encoding in 11 formats -- symbolfyi.com |
| unicodefyi | PyPI | npm | Unicode lookup with 17 encodings -- unicodefyi.com |
| fontfyi | PyPI | npm | Google Fonts metadata & CSS -- fontfyi.com |
| distancefyi | PyPI | npm | Haversine distance & travel times -- distancefyi.com |
| timefyi | PyPI | npm | Timezone ops & business hours -- timefyi.com |
| namefyi | PyPI | npm | Korean romanization & Five Elements -- namefyi.com |
| unitfyi | PyPI | npm | Unit conversion, 220 units -- unitfyi.com |
| holidayfyi | PyPI | npm | Holiday dates & Easter calculation -- holidayfyi.com |
| zipfyi | PyPI | -- | ZIP/postal codes, geocoding, area lookup -- zipfyi.com |
| cocktailfyi | PyPI | -- | Cocktail ABV, calories, flavor -- cocktailfyi.com |
| fyipedia | PyPI | -- | Unified CLI for all FYI tools -- fyipedia.com |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zipfyi-0.1.1.tar.gz.
File metadata
- Download URL: zipfyi-0.1.1.tar.gz
- Upload date:
- Size: 181.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c422e5fccf74faa62cfa6751f93b8364c7dc9f8ec980bfcfeb3c30695abe386
|
|
| MD5 |
7e6510c4d22af0f653b1642dd109b17f
|
|
| BLAKE2b-256 |
749e3ce7d34749e42e5326792931e5ce8cecf058fbd96df86c47c1d7d40b0ba8
|
File details
Details for the file zipfyi-0.1.1-py3-none-any.whl.
File metadata
- Download URL: zipfyi-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83ddf2d24b2ed3610a0e0f1fcdb71872216e88e4cb998bf985410b05a4d8703c
|
|
| MD5 |
2bc9b0f7aa833cc8ee359b107ccd0707
|
|
| BLAKE2b-256 |
4ff2c3ae41b90ae8fca0a44944acbd1548e9e18197e27de960c61cc26edfcfdd
|