Quickstart
Create a key, turn an address into coordinates with your first search, look up the address for a coordinate, and find both requests and their credits in your dashboard.
This guide sends two requests with one key. The first searches for a place, the CN Tower in Toronto, and returns its coordinates. The second goes the other way: it sends a coordinate near the tower, 43.6426, -79.3871, and gets back the nearest address. You then find both requests in the dashboard. Allow a few minutes and two credits.
Send your first requests
Create a workspace and a key
Sign up, name your workspace, then create a key under API keys. Use a label that says where the key will run, for example "Production API" or "Local development".
The secret is shown only once, right after you create the key, so copy it then. After that, the dashboard shows only a masked form such as bg_live_7f3a…c91d.
Search for an address or place
Put the text in q and the key in the X-API-Key header. URL-encode the query: CN Tower, Toronto becomes CN%20Tower%2C%20Toronto.
curl "https://api.buddygeo.com/v1/search?q=CN%20Tower%2C%20Toronto" \
-H "X-API-Key: YOUR_API_KEY"If you'd rather not use a terminal, open the same search in the forward playground or send it from the API reference.
Read the search response
Every request returns the same envelope. outcome and credits_charged say what happened and what it cost. The request_id is also sent in the X-Request-Id response header. For a search, result is an array of candidates, best match first:
{
"request_id": "req_cj89vnhvmyzl",
"endpoint": "/v1/search",
"status": 200,
"outcome": "success",
"latency_ms": 83,
"credits_charged": 1,
"credits_remaining": 38160,
"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": "Matched the place name for “CN Tower, Toronto”.",
"distance_m": 0,
"osm_type": "way",
"osm_id": 461829037,
"category": "tourism",
"type": "attraction"
},
"language": "en",
"available_languages": ["en", "fr"]
}
],
"error": null,
"attribution": "© OpenStreetMap contributors (ODbL)",
"query": { "q": "CN Tower, Toronto", "limit": 5 }
}Check these fields from the start:
result[0].locationis the coordinate you came for.result[0].formattedis the full address of the match as one line, andcomponentsgives each part separately.match.levelsays how precise the match is, fromaddressdown tolocality. A bare city name such asq=Torontoreturns the city itself (Toronto, Ontario, Canadaat43.6532, -79.3832, levellocality).- Every candidate costs the same: one credit per successful search, whatever the number of candidates.
q=Springfieldreturns four cities in Illinois, Missouri, Massachusetts and Oregon, andcredits_chargedis still1. Each candidate'smatch.detailsays "4 places match this query; add a city, region or country to narrow it." You can cap the list withlimit(1 to 10, default 5). resultisnull(not an empty array) when nothing matches, for example a query that is only a country, a region or a short number. That is a normal200response withoutcome: "no_match"andcredits_charged: 0.
Look up the address for a coordinate
The second request is a reverse lookup. Pass latitude and longitude as lat and lon, with the same key:
curl "https://api.buddygeo.com/v1/reverse?lat=43.6426&lon=-79.3871" \
-H "X-API-Key: YOUR_API_KEY"You can also open it in the reverse playground.
Read the reverse response
The envelope is the same, but result is a single address, not an array:
{
"request_id": "req_443tx7tuyeps",
"endpoint": "/v1/reverse",
"status": 200,
"outcome": "success",
"latency_ms": 63,
"credits_charged": 1,
"credits_remaining": 38159,
"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)",
"query": { "lat": 43.6426, "lon": -79.3871 }
}result.locationis the coordinate of the returned address, not the point you submitted.result.match.distance_mis the distance between the two, here 59 m.resultisnullwhen nothing is mapped near the point. That is also a200response withoutcome: "no_match"andcredits_charged: 0.- When something goes wrong, for either endpoint,
error.next_steptells you in one sentence what to do. See Rate limits and errors.
Find both requests and their credits in your dashboard
Requests sent with a workspace key appear under Request logs, and you can search them by request_id. Each successful request takes one credit, which shows under Usage by endpoint and key. After these two requests you will see one /v1/search and one /v1/reverse, two credits in total.
You can also run signed-in lookups directly from the forward playground and reverse playground: pick one of your workspace keys under API key to bill and log the lookup, or use the unauthenticated public preview without spending workspace credits.
Next steps
Handle ambiguous searches
Narrow a query with country, let users pick a candidate, or take the best match.
Geocode a spreadsheet instead
Open the wizard with the customer address sample, or upload your own file of addresses or coordinates. No code required.
Rotate and revoke keys
Use one key per environment and replace keys without downtime.
See every endpoint
Parameters, schemas and a Try it console for each operation.
Related guides
Authentication
Send your key in the X-API-Key header. Create one key per environment, rotate with an overlap and revoke what you no longer use.
Forward geocoding
GET /v1/search turns an address or place name into coordinates and returns every plausible candidate when a query is ambiguous.
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.
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.
Overview
Turn addresses and place names into coordinates with the BuddyGeo API, find the address for a coordinate, or geocode a whole spreadsheet of addresses or coordinates without writing code.
Authentication
Send your key in the X-API-Key header. Create one key per environment, rotate with an overlap and revoke what you no longer use.