TL;DR
Nominatim is OpenStreetMap's free geocoding engine. Forward geocode an address or place name to get GPS coordinates (lat/lon), or reverse geocode coordinates to get a structured address. Covers the entire world using community-maintained OpenStreetMap data. Returns JSON, XML, or GeoJSON. Requires a User-Agent header identifying your application. Max 1 request per second.
Quick start: https://nominatim.openstreetmap.org/search?q=London&format=json&limit=1
No API key needed — free global geocoding!
How to Use This API
1. Forward Geocode — Address to Coordinates
Convert a place name to GPS coordinates (always include a User-Agent header):
https://nominatim.openstreetmap.org/search?q=London&format=json&limit=1
2. Reverse Geocode — Coordinates to Address
https://nominatim.openstreetmap.org/reverse?lat=51.5074&lon=-0.1278&format=json
3. Search with Country Filter
https://nominatim.openstreetmap.org/search?q=Springfield&countrycodes=US&format=json
4. JavaScript — Geocode with Headers
fetch('https://nominatim.openstreetmap.org/search?q=Paris&format=json&limit=3', {
headers: {'User-Agent': 'MyApp/1.0 (contact@example.com)'}
})
.then(r => r.json())
.then(data => {
data.forEach(place => {
console.log(place.display_name);
console.log(` Lat: ${place.lat}, Lon: ${place.lon}`);
console.log(` Type: ${place.type}`);
});
});
5. Python — Structured Address Search
import requests
headers = {'User-Agent': 'MyGeocodingApp/1.0'}
params = {
'city': 'Berlin',
'street': 'Unter den Linden',
'countrycodes': 'DE',
'format': 'json',
'limit': 1
}
resp = requests.get(
'https://nominatim.openstreetmap.org/search',
params=params, headers=headers
).json()
if resp:
p = resp[0]
print(f"{p['display_name']}")
print(f"GPS: {p['lat']}, {p['lon']}")
print(f"Importance: {p['importance']}")
https://nominatim.openstreetmap.org/search?q=London&format=json&limit=1
Frequently Asked Questions
- Why do I need a User-Agent header?
- Nominatim requires a User-Agent header so they can contact you if your app causes problems. Include your app name and a contact email or URL. Requests without a User-Agent may be blocked.
- What is the rate limit?
- Max 1 request per second. This is strictly enforced. For higher volumes, you can self-host Nominatim or use a commercial geocoding provider. Use caching to reduce duplicate requests.
- What output formats are supported?
format=json(JSON v2),format=xml,format=jsonv2(extended JSON),format=geojson, orformat=html(debug view). JSON is recommended for most applications.- Can I search by specific address components?
- Yes — use structured parameters:
street,city,county,state,country,postalcode. Combine withcountrycodesto narrow results. - What data is returned for each result?
display_name(full formatted address),lat/lon,type(administrative, building, amenity, etc.),importance(relevance score),osm_type/osm_id, and address breakdown in JSON v2.- Does the reverse geocoding include POI data?
- Yes —
/reversereturns the nearest OSM element, which could be a building, street, address point, or point of interest. Addzoom=18for building-level precision.
API Details
- API URL
https://nominatim.openstreetmap.org/- Documentation
- nominatim.org
- Category
- Geocoding
- Authentication
- Not Required (User-Agent header required)
- Rate Limit
- 1 request per second
What You Can Build
- Location search for any mapping or navigation application
- Delivery address autocomplete and validation for e-commerce
- Reverse geocoding to convert GPS coordinates to human addresses
- Travel planner with geocoded points of interest
- Address normalization for CRM or logistics systems