Reverse geocoding
GET /v1/reverse turns a latitude and longitude into the nearest mapped address, with its components, its own coordinate and an explanation of the match.
Reverse geocoding answers the question "what is at this coordinate?". You send a point; BuddyGeo returns the nearest mapped feature, as a formatted address and as separate fields.
Request
curl "https://api.buddygeo.com/v1/reverse?lat=43.6426&lon=-79.3871" \
-H "X-API-Key: YOUR_API_KEY"| Parameter | Required | Description |
|---|---|---|
lat | Yes | Latitude in decimal degrees, -90 to 90 |
lon | Yes | Longitude in decimal degrees, -180 to 180 |
lang | No | Language of the result as a BCP 47 tag. Default en. See Languages |
detail | No | full (default), street or locality: how precise the returned address should be |
Latitude comes first wherever a pair is written out. See Coordinate order.
Response
{
"request_id": "req_5d0c3f9a1b7e",
"endpoint": "/v1/reverse",
"status": 200,
"outcome": "success",
"latency_ms": 62,
"credits_charged": 1,
"credits_remaining": 38160,
"query": { "lat": 43.6426, "lon": -79.3871 },
"result": {
"place_id": "toronto-cn-tower",
"formatted": "290 Bremner Boulevard, Toronto, ON M5V 3L9, Canada",
"components": {
"name": "CN Tower",
"house_number": "290",
"street": "Bremner Boulevard",
"neighbourhood": "Entertainment District",
"locality": "Toronto",
"region": "Ontario",
"region_code": "ON",
"postcode": "M5V 3L9",
"country": "Canada",
"country_code": "ca"
},
"location": { "lat": 43.642196, "lon": -79.386628 },
"bounding_box": [43.641657, 43.642735, -79.387373, -79.385883],
"match": {
"level": "address",
"detail": "Nearest mapped address to the submitted point, 59 m away.",
"distance_m": 59,
"osm_type": "way",
"osm_id": 461829037,
"category": "tourism",
"type": "attraction"
},
"language": "en",
"available_languages": ["en", "fr"]
},
"error": null,
"attribution": "© OpenStreetMap contributors (ODbL)"
}The envelope
| Field | Description |
|---|---|
request_id | Identifier of this request, also sent as the X-Request-Id header. Search for it in Request logs or quote it to support |
endpoint | The endpoint that answered, here /v1/reverse |
status | The HTTP status of the response, repeated in the body |
outcome | success, no_match, invalid, unauthorized, rate_limited, quota_exhausted or upstream_error |
latency_ms | Time the service spent on the request |
credits_charged | 1 for a successful lookup, 0 for everything else |
credits_remaining | Available credits of the workspace after this request, or null for unauthenticated public playground previews |
query | The parameters the service understood |
result | The matched feature, or null |
error | null, or an object with code, message and next_step |
attribution | The credit line to show with the result. See Attribution |
The result
| Field | Description |
|---|---|
result.formatted | The address on one line, formatted the way it is written locally |
result.components | The same address as fields: name, house_number, street, neighbourhood, locality, county, region, region_code, postcode, country, country_code. Only country and country_code are always present |
result.location | Coordinate of the returned feature, which is usually not the point you submitted |
result.bounding_box | Extent of the feature as [south, north, west, east] |
result.match.level | How precise the match is: address, street, poi, neighbourhood, locality, region or country |
result.match.detail | One sentence explaining what was matched and why |
result.match.distance_m | Metres between the submitted point and the returned feature |
result.match.osm_type, osm_id, category, type | The OpenStreetMap object behind the result |
result.language, result.available_languages | Language of this result and the languages it could be returned in |
Submitted point and returned point
A reverse lookup snaps to the nearest mapped feature. For the CN Tower example the submitted point is 43.6426, -79.3871 and the returned address sits at 43.642196, -79.386628, 59 metres away. Show both when it matters to your users, as the reverse playground does with two markers and a connector, and use match.distance_m to decide whether a result is close enough for your purpose.
Not every place has a house number
How much detail comes back depends on what is mapped near the point.
| Example | What comes back |
|---|---|
| CN Tower, Toronto | A full street address with house number and postcode (match.level: "address") |
| IFC, Hong Kong | A complete address without a postcode, because Hong Kong does not use them. components.postcode is absent |
| Big Ben, London | A named place without a house number (match.level: "poi") |
| Khumbu region, Nepal | No street is mapped nearby, so the answer stops at the locality (match.level: "locality") |
| Open ocean, North Atlantic | Nothing is mapped near the point: result is null, outcome is no_match, zero credits |
Treat every field of components except country and country_code as optional.
Ask for less detail
detail trims the answer when you do not want a house number:
curl "https://api.buddygeo.com/v1/reverse?lat=43.6426&lon=-79.3871&detail=locality" \
-H "X-API-Key: YOUR_API_KEY"detail | formatted for the CN Tower point | match.level |
|---|---|---|
full | 290 Bremner Boulevard, Toronto, ON M5V 3L9, Canada | address |
street | Bremner Boulevard, Toronto, ON M5V 3L9, Canada | street |
locality | Toronto, Ontario, Canada | locality |
detail never adds precision: a point that only matches a locality returns that locality at every level. Any other value is rejected with 400 invalid_query.
No match is not an error
A point in open water or far from anything mapped returns HTTP 200 with result: null:
curl "https://api.buddygeo.com/v1/reverse?lat=30&lon=-40" \
-H "X-API-Key: YOUR_API_KEY"outcome is no_match and credits_charged is 0. Check result for null before reading result.formatted.
Example locations
Try any of these example points directly in the reverse playground:
| Place | Latitude | Longitude | Answer |
|---|---|---|---|
| CN Tower, Toronto | 43.6426 | -79.3871 | Address |
| Tokyo Tower, Tokyo | 35.6586 | 139.7454 | Address |
| MASP, São Paulo | -23.5614 | -46.6559 | Address |
| Big Ben, London | 51.5007 | -0.1246 | Address |
| Eiffel Tower, Paris | 48.8584 | 2.2945 | Address |
| Empire State Building, New York | 40.7484 | -73.9857 | Address |
| Sydney Opera House | -33.8568 | 151.2153 | Address |
| Brandenburg Gate, Berlin | 52.5163 | 13.3777 | Address |
| IFC, Hong Kong | 22.2855 | 114.1588 | Address |
| Khumbu region, Nepal | 27.9881 | 86.925 | Address |
| Grand-Place, Brussels | 50.8467 | 4.3525 | Address |
| Ferry Building, San Francisco | 37.7955 | -122.3937 | Address |
| Zócalo, Mexico City | 19.4326 | -99.1332 | Address |
| Gateway of India, Mumbai | 18.922 | 72.8347 | Address |
| V&A Waterfront, Cape Town | -33.9036 | 18.4209 | Address |
| Burj Khalifa, Dubai | 25.1972 | 55.2744 | Address |
| KICC, Nairobi | -1.2884 | 36.8233 | Address |
| Merlion Park, Singapore | 1.2868 | 103.8545 | Address |
| Open ocean, North Atlantic | 30 | -40 | No match (0 credits) |
| Point Nemo, South Pacific | -48.8767 | -123.3933 | No match (0 credits) |
Open in the app
Reverse playground
Paste a pair, click the map or load a preset. Overview, address fields, JSON, GeoJSON and code views.
GET /v1/reverse in the API reference
Schema, examples and a Try it console.
Request logs
Every signed-in lookup, with its outcome and credit treatment.
Related guides
Coordinate order
Latitude comes first in request parameters, spreadsheets and every human-facing field. GeoJSON puts longitude first.
Languages
Ask for results in a language with the lang parameter, and read result.language to see which language you received.
Rate limits and errors
Every error code the API returns, its HTTP status, whether it was charged and what to do next. Includes the throughput limit and how to retry.
Bulk processing
Add coordinates to a spreadsheet of addresses, or addresses to a spreadsheet of coordinates, in the upload wizard or through the /v1/batch endpoints. Preview is free; only matched rows cost a credit.
Forward geocoding
GET /v1/search turns an address or place name into coordinates and returns every plausible candidate when a query is ambiguous.
Bulk processing
Add coordinates to a spreadsheet of addresses, or addresses to a spreadsheet of coordinates, in the upload wizard or through the /v1/batch endpoints. Preview is free; only matched rows cost a credit.