TL;DR
The Overpass API is a specialized read-only API for querying raw OpenStreetMap data using its own query language (Overpass QL). Unlike Nominatim (which is for geocoding), Overpass lets you ask complex geographic questions: "Find all Italian restaurants within 1km of this point" or "Get all bus stops along this road." It supports bounding box, polygon, radius, and recursive queries. The API returns data in JSON, XML, or OSM formats.
Quick start: https://overpass-api.de/api/interpreter?data=[out:json];node(51.50,-0.1,51.52,-0.09);out;
No API key needed — just make a request!
How to Use This API
1. Simple Bounding Box Query
Get all nodes in a small area near central London (bbox: lat_min,lon_min,lat_max,lon_max):
https://overpass-api.de/api/interpreter?data=[out:json];node(51.50,-0.1,51.52,-0.09);out;
2. Find Cafes by Tag
https://overpass-api.de/api/interpreter?data=[out:json];node["amenity"="cafe"](51.50,-0.1,51.52,-0.09);out;
3. JavaScript — Find Nearby Hospitals
const query = `[out:json];
node["amenity"="hospital"](40.71,-74.01,40.73,-73.99);
out;`;
fetch('https://overpass-api.de/api/interpreter?data=' + encodeURIComponent(query))
.then(r => r.json())
.then(d => {
d.elements.forEach(e => {
console.log(e.tags.name, '—', e.lat, e.lon);
});
});
4. Python — Parks in a City
import requests, urllib.parse
query = """
[out:json];
area["name"="Berlin"]->.a;
node(area.a)["leisure"="park"];
out center;
"""
resp = requests.get('https://overpass-api.de/api/interpreter',
params={'data': query})
parks = resp.json()
for p in parks['elements'][:5]:
print(p['tags'].get('name', 'Unnamed park'))
https://overpass-api.de/api/interpreter?data=[out:json];node(51.50,-0.1,51.52,-0.09);out;
API Details
- API URL
https://overpass-api.de/api/interpreter- Documentation
- wiki.openstreetmap.org/wiki/Overpass_API
- Category
- Utility
- Authentication
- Not Required
- Geographic Coverage
- Global — full OSM dataset
Frequently Asked Questions
- What is Overpass QL?
- Overpass Query Language is OSM's domain-specific query language. It uses statements like
node,way,relationwith filter conditions in brackets and geographic constraints in parentheses. - How is it different from Nominatim?
- Nominatim is for address-to-coordinate geocoding. Overpass is for raw OSM data queries — finding features by tags, type, and location within specified geographic boundaries.
- What format is the response?
- Responses default to OSM XML. Add
[out:json]at the start of your query for JSON output. GeoJSON is available with[out:geojson]. - How do I avoid overly large queries?
- Always use geographic constraints (bounding boxes or radius) and limit output with
out 50;(limits to 50 elements). Large unbounded queries may be rejected. - What are the rate limits?
- The public Overpass API instance at overpass-api.de has per-IP rate limits and a maximum query runtime of about 180 seconds. Heavy users should run their own instance.
- Can I query by tag value?
- Yes, OSM's tagging system is central to Overpass. Examples:
["amenity"="restaurant"],["highway"="primary"],["building"](any building).
What You Can Build
- Custom map with filtered points of interest (cafes, ATMs, pharmacies)
- Accessibility mapper showing wheelchair-friendly locations
- Traffic analysis with road type and speed limit data
- Hiking trail network extractor for outdoor apps
- Public transport stop and route data aggregator