TL;DR
What it does: Free geocoding from OpenStreetMap. Forward geocode (address → GPS coordinates) and reverse geocode (coordinates → address). No API key needed.
Quick start: https://nominatim.openstreetmap.org/search?q=London&format=json&limit=1
No API key needed - just call the URL
Overview
Nominatim is the official geocoding API for OpenStreetMap data. It allows you to search for places by name or address (forward geocoding) and convert GPS coordinates into readable addresses (reverse geocoding). The data is contributed by a worldwide community of mappers and is available under the ODbL license. No API key is required, but you must provide a User-Agent header identifying your application.
Live Example
Here's the exact URL to call and the real response you'll get:
The URL to call (search for London):
https://nominatim.openstreetmap.org/search?q=London&format=json&limit=1
Try This URL Now →
The actual response you get:
[
{
"place_id": 281075796,
"licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright",
"osm_type": "relation",
"osm_id": 175342,
"lat": "51.5074456",
"lon": "-0.1277653",
"class": "boundary",
"type": "administrative",
"place_rank": 10,
"importance": 0.8920997258748663,
"addresstype": "city",
"name": "Greater London",
"display_name": "Greater London, England, United Kingdom",
"boundingbox": [
"51.2867601",
"51.6918741",
"-0.5103751",
"0.3340155"
]
}
]
What does this data mean?
Searching for "London" returns the Greater London area with its precise GPS coordinates and metadata.
- place_id
- Unique identifier for this place in the OpenStreetMap database
- licence
- License information: OpenStreetMap data under ODbL 1.0
- lat, lon
- GPS coordinates of the place: 51.507°N, 0.128°W (decimal degrees)
- display_name
- Full formatted address: Greater London, England, United Kingdom
- class
- Category of the OSM element (e.g., boundary, place, highway, building)
- type
- Specific type within the class (e.g., administrative, city, road, house)
- importance
- Search relevance score (0 to 1, higher = more prominent landmark)
- boundingbox
- Bounding box coordinates in order: south, north, west, east
How to use this API
JavaScript Example
// Search for London (forward geocoding)
const url = 'https://nominatim.openstreetmap.org/search?q=London&format=json&limit=1';
fetch(url, {
headers: { 'User-Agent': 'MyApp/1.0 (myemail@example.com)' }
})
.then(res => res.json())
.then(data => {
console.log(`Lat: ${data[0].lat}, Lon: ${data[0].lon}`);
console.log(`Address: ${data[0].display_name}`);
});
Python Example
import requests
# Search for London (forward geocoding)
url = "https://nominatim.openstreetmap.org/search"
params = {"q": "London", "format": "json", "limit": 1}
headers = {"User-Agent": "MyApp/1.0 (myemail@example.com)"}
response = requests.get(url, params=params, headers=headers)
data = response.json()
print(f"Lat: {data[0]['lat']}, Lon: {data[0]['lon']}")
print(f"Address: {data[0]['display_name']}")
Frequently Asked Questions
- Do I need an API key?
- No, but you must set a
User-Agentheader identifying your application (e.g.,MyApp/1.0 (myemail@example.com)). Requests without a User-Agent may be blocked. - Is there a rate limit?
- Yes, max 1 request per second. For high-volume usage, consider running your own Nominatim instance or using the commercial OSM API services.
- Can I use this commercially?
- Yes, the data is available under the ODbL license. You must attribute OpenStreetMap contributors.
- How do I reverse geocode?
- Use the
/reverseendpoint:https://nominatim.openstreetmap.org/reverse?lat=51.5074&lon=-0.1278&format=json. This returns the address for a given GPS coordinate. - How do I parse the JSON response?
- The response is a JSON array of objects. In JavaScript:
data[0].lat,data[0].display_name. In Python:data[0]['lat'],data[0]['display_name'].
API Details
- Base URL
https://nominatim.openstreetmap.org/search- Documentation
- https://nominatim.org/release-docs/develop/api/Overview/
- Category
- Geocoding
- Authentication
- None required (User-Agent header recommended)
- Rate Limit
- Max 1 request per second
- Geographic Coverage
- Global - any location worldwide