Endpoint
Authentication
| Header | Required | Value |
|---|---|---|
X-API-Key | Yes | Your API key (bun_...) |
Content-Type | Yes | application/json |
Overview
Perform forward geocoding (address to coordinates) by passing aquery, or reverse geocoding (coordinates to address) by passing lat and lon. Returns structured location data including formatted address, country, city, and precise latitude/longitude.
Use cases
- Geocode user-entered addresses for map display
- Reverse-geocode GPS coordinates to human-readable addresses
- Validate and normalize delivery addresses
- Enrich location data in analytics pipelines
Details
Forward geocoding accepts free-text queries in any language and returns up to 5 results in aresults array. Reverse geocoding requires decimal degree coordinates and returns a single flat object with the nearest address. Provide either query or both lat and lon — not both.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
query | string | No | Free-text address or place name (forward geocoding) |
lat | number | No | Latitude in decimal degrees (reverse geocoding) |
lon | number | No | Longitude in decimal degrees (reverse geocoding) |
query for forward geocoding, or both lat and lon for reverse geocoding.
Example — forward geocoding
Example — reverse geocoding
Response
200 OK — forward geocoding
Returns aresults array of up to 5 matches.
| Field | Type | Description |
|---|---|---|
results | array | List of matching locations (up to 5) |
results[].lat | number | Latitude of the result |
results[].lon | number | Longitude of the result |
results[].display_name | string | Full human-readable address string |
results[].type | string | OSM feature type (e.g. building, highway, city) |
results[].address | object | Structured address components (e.g. road, city, state, country, postcode, country_code) |
200 OK — reverse geocoding
Returns a single flat object for the nearest address.| Field | Type | Description |
|---|---|---|
lat | number | Latitude that was looked up |
lon | number | Longitude that was looked up |
display_name | string | Full human-readable address string |
address | object | Structured address components (e.g. road, city, state, country, postcode, country_code) |

