TL;DR
Zippopotam.us is a lightweight, hyper-fast API that maps postal codes to their geographic locations. Feed it a country code and postal code, and it returns the city, state/region, and GPS coordinates (latitude/longitude). It supports dozens of countries including the US, UK, Canada, Germany, France, and Australia. Response times are typically under 100ms.
Quick start: https://api.zippopotam.us/us/90210
No API key needed — just make a request!
How to Use This API
1. US Zip Code Lookup — Beverly Hills
https://api.zippopotam.us/us/90210
Returns: {"post code":"90210","country":"United States","places":[{"place name":"Beverly Hills","state":"California","latitude":"34.0901","longitude":"-118.4065"}]}
2. UK Postcode Lookup — London
https://api.zippopotam.us/gb/sw1a1aa
UK postcodes work too. Use country code "gb" and the postcode without spaces.
3. Canadian Postal Code — Toronto
https://api.zippopotam.us/ca/m5v2t6
4. JavaScript — Auto-Fill City & State
async function lookupZip(postalCode, country = 'us') {
const resp = await fetch(
`https://api.zippopotam.us/${country}/${postalCode}`
);
if (!resp.ok) throw new Error('Postal code not found');
const data = await resp.json();
const place = data.places[0];
return {
city: place['place name'],
state: place['state'],
lat: place['latitude'],
lng: place['longitude']
};
}
lookupZip('90210', 'us').then(loc => {
console.log(`${loc.city}, ${loc.state}`);
console.log(`GPS: ${loc.lat}, ${loc.lng}`);
});
lookupZip('m5v2t6', 'ca').then(loc => {
console.log(`Toronto: ${loc.city}, ${loc.state}`);
});
5. Python — Batch Zip Validation
import requests
def validate_zip(postal_code, country='us'):
resp = requests.get(
f'https://api.zippopotam.us/{country}/{postal_code}'
)
if resp.status_code == 200:
data = resp.json()
p = data['places'][0]
return {
'valid': True,
'city': p['place name'],
'state': p['state'],
'lat': float(p['latitude']),
'lng': float(p['longitude'])
}
return {'valid': False}
zips = ['10001', '99999', '20500']
for z in zips:
result = validate_zip(z)
status = f"{result['city']}, {result['state']}" if result['valid'] else 'Invalid'
print(f"{z}: {status}")
https://api.zippopotam.us/us/90210
Frequently Asked Questions
- What countries does Zippopotam.us support?
- Dozens: us, gb, ca, de, fr, it, es, au, jp, br, nl, se, no, dk, fi, ch, at, be, pl, cz, and more. Use the 2-letter ISO country code (lowercase) as the first path segment.
- How fast is this API?
- Extremely fast — typically 50-150ms response times. Zippopotam.us is designed as a simple key-value lookup service with no complex database queries.
- Is the data accurate?
- Yes, the data is sourced from official national postal services. Accuracy is highest for US, UK, Canada, and major European countries. Some smaller countries may have less comprehensive coverage.
- Are there rate limits?
- No documented rate limits. The service is free and lightweight. For production applications, consider caching results by postal code to reduce requests.
- Does it support partial/nearby zip lookups?
- No, Zippopotam.us only does exact postal code lookups. For nearby locations or radius searches, you'd need a different service.
- What happens if a zip code doesn't exist?
- Returns HTTP 404 with no body. Always check the response status code before parsing data.
API Details
- API URL
https://api.zippopotam.us- Documentation
- www.zippopotam.us
- Category
- Data
- Authentication
- Not Required
- Geographic Coverage
- Global — dozens of countries with postal code coverage
What You Can Build
- Checkout form with auto-fill city/state based on postal code
- Delivery route planner that validates addresses by zip code
- Store locator with zip code input to find nearby branches
- Shipping cost calculator that uses origin/destination zip codes
- International address validation for multi-country e-commerce