Overview
Lookup runs against our own stored data, never a third party. First the point given by `lat` and `lon` is placed in a country using country boundary polygons. In the US, Canada and Australia the nearest entry in a postal location dataset is found for that country, and its `city`, `state`, `state_abbr` and `zipcode` are returned.
Everywhere else the point is matched to the settlement it sits in from the GeoNames cities500 gazetteer: among places whose built-up area, estimated from population, reaches the point, the most local administrative seat wins (Minato for a point by Tokyo Tower, Paris for the Eiffel Tower); failing that, the nearest place within 150 km. `zipcode` is then the nearest GeoNames postal code centroid in the same country within 25 km, `state` the first-level region and `county` the second-level division. Open ocean returns a 404.
Results are only as fine-grained as the data: the answer is the closest postal-code location or settlement, not the containing boundary, so points near a town or postal code line can resolve to the neighbouring one. `latitudeClosest` and `longitudeClosest` are the matched location's coordinates, returned as strings, and `distance` is how far it lies from your point in kilometers. `latitude` and `longitude` echo the input and `countryCode` is the two-letter code.
`nearestCities` holds up to 20 unique city names from a worldwide city list, ordered by distance from your point, closest first. `distance`, the closest coordinates, `estimatedCity` and `nearestCities` are null on the Free plan.
Data outside the US, Canada and Australia: [GeoNames](https://www.geonames.org/), CC BY 4.0. UK postcodes contain Royal Mail data © Royal Mail copyright and database right.
Live Test Reverse Geocode API →
Endpoint
One host, one path per API. The block below shows this call in four languages; every one of them is the same HTTP request. Making requests covers the timeouts, retries and parameter rules that apply to all of them. The SDKs wrap the same call in a typed client.
curl "https://api.apiverve.com/v1/reversegeocode?lat=40.714224&lon=-73.961452&geocodes=true" \
-H "x-api-key: your_api_key_here"const res = await fetch('https://api.apiverve.com/v1/reversegeocode?lat=40.714224&lon=-73.961452&geocodes=true', {
headers: { 'x-api-key': 'your_api_key_here' },
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const { data } = await res.json();
console.log(data);import requests
res = requests.get(
"https://api.apiverve.com/v1/reversegeocode?lat=40.714224&lon=-73.961452&geocodes=true",
headers={"x-api-key": "your_api_key_here"},
timeout=15,
)
res.raise_for_status()
print(res.json()["data"])package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.apiverve.com/v1/reversegeocode?lat=40.714224&lon=-73.961452&geocodes=true", nil)
req.Header.Set("x-api-key", "your_api_key_here")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}Replace your_api_key_here with the key from your dashboard. When the inputs arrive as a list rather than one at a time, batch requests run up to 200 of them through this same API in a single call.
Authentication
Send your key in the x-api-key header. That is the only auth step — there is no token exchange and no per-endpoint scope to configure. Authentication covers creating, rotating and revoking keys.
A 401 means the key is missing, invalid or expired. A 403 means the key is valid but not permitted here — blocked by a key restriction or an IP allow-list. Running out of credits is a 429.
Parameters
Sent in the query string. Premium parameters are accepted on every plan but only take effect on plans that include them.
| Parameter | Type | Description |
|---|---|---|
latRequired | number | The latitude of the coordinates range -90–90 |
lonRequired | number | The longitude of the coordinates range -180–180 |
geocodesOptionalPremium | boolean | Add a geocodes object with the point's geohash, plus code (Open Location Code) and degrees-minutes-seconds notation |
Response
Every API returns the same three top-level keys, so one response handler covers your whole integration: status, error and data. Only data changes shape. Response format covers the envelope, the other output formats and how premium fields are withheld.
{
"status": "ok",
"error": null,
"data": {
"zipcode": "11211",
"state_abbr": "NY",
"city": "Brooklyn",
"state": "New York",
"distance": 0.6501757300758664,
"latitudeClosest": "40.712090",
"longitudeClosest": "-73.95427",
"countryCode": "US",
"latitude": 40.714224,
"longitude": -73.961452,
"estimatedCity": true,
"nearestCities": [
"Brooklyn",
"Brooklyn Park",
"East Brooklyn",
"Brooklyn Center",
"Brooklyn Heights"
],
"timezone": "America/New_York",
"county": "Kings County",
"countyFips": "36047",
"geocodes": {
"geohash": "dr5rsgyct",
"plusCode": "87G8P27Q+MC",
"dms": {
"latitude": "40°42'51.2\"N",
"longitude": "73°57'41.2\"W"
}
}
}
}
Response fields
Paths are relative to data. Premium fields are absent rather than zeroed on plans that do not include them, so check for presence instead of comparing to 0.
| Field | Type | Example | Description |
|---|---|---|---|
zipcode | string | "11211" | ZIP or postal code for the location. Australian postcodes are returned as numbers, so ones starting with 0 (Darwin, 0800) lose the leading zero. Outside the US, Canada and Australia it is the nearest postal code centroid within 25 km, or null where GeoNames has no postal codes for the country |
state_abbr | string | "NY" | Two-letter state abbreviation code. Outside the US, Canada and Australia, the region's letter code where one exists (ENG, ZH); null where the country's region codes are numeric |
city | string | "Brooklyn" | Primary city name at coordinates. Outside the US, Canada and Australia, the city, town or village the point sits in |
state | string | "New York" | Full state name, or the first-level region (prefecture, region, province) outside the US, Canada and Australia |
distancePremium | number | 0.6501757300758664 | Distance from your point to the closest mapped coordinates, in kilometers |
latitudeClosestPremium | string | "40.712090" | Latitude of closest mapped coordinate |
longitudeClosestPremium | string | "-73.95427" | Longitude of closest mapped coordinate |
countryCode | string | "US" | ISO country code for location |
latitude | number | 40.714224 | Input latitude coordinate |
longitude | number | -73.961452 | Input longitude coordinate |
estimatedCityPremium | boolean | true | Whether city is estimated or exact match |
nearestCitiesPremium | array | [Brooklyn, ...] | List of nearby cities ordered by proximity |
timezone | string | "America/New_York" | IANA time zone at the requested coordinates (e.g., America/New_York) |
county | string | "Kings County" | Primary county of the matched ZIP code in the US; outside the US, Canada and Australia, the second-level division of the matched place (a French department, a Tokyo ward); null in Canada and Australia US: the county holding most of the matched ZIP code's land, from the Census 2020 ZCTA-to-county file; a point in a ZIP that crosses a county line can sit in a neighbouring county. Elsewhere: the GeoNames admin2 name of the matched place. |
countyFipsPremium | string | "36047" | Five-digit FIPS code of that county (US only) |
geocodesPremium | object | {...} | Encodings of the requested point (only when geocodes=true) |
geohashPremium | string | "dr5rsgyct" | 9-character geohash (about 5 m precision) |
plusCodePremium | string | "87G8P27Q+MC" | 10-digit global plus code (Open Location Code, about 14 m precision), e.g., 87G8P27Q+MC |
dmsPremium | object | {...} | Latitude and longitude in degrees, minutes and seconds |
latitudePremium | string | "40°42'51.2"N" | Latitude in DMS notation, e.g., 40°42'51.2"N |
longitudePremium | string | "73°57'41.2"W" | Longitude in DMS notation, e.g., 73°57'41.2"W |
Errors
Read the HTTP status first, then error for the specific reason. The body names the parameter that has to change. Error handling covers the full status list and which of them are worth retrying.
| Status | Meaning | What to do |
|---|---|---|
400 | Input was rejected | Read error; it names the parameter. |
401 | Key missing or invalid | Check the header name and the key value. |
403 | Key valid, but not permitted | A key restriction or IP allow-list; see key scoping. |
429 | Rate limited, or out of credits | Read error to tell them apart; see rate limits. |
Use cases
- Fleet Telematics Tracking
- Logistics systems match vehicle GPS pings against city and state boundaries to generate human-readable trip summaries for dispatchers.
- Mobile Photo Geotagging
- Camera apps read coordinate metadata from uploaded photos to display the city and state where each picture was taken.
- Delivery Address Autofill
- When a customer shares device coordinates at checkout, ecommerce apps automatically populate the city, state, and ZIP code fields.
- Field Service Dispatch
- To assign incoming repair tickets, maintenance platforms convert technician coordinates into local municipality names and postal codes.
- International Address Forms
- Courier and travel apps turn a customer's shared location in Paris, Tokyo or Berlin into the city, region and postal code fields of a local address form.
Other ways to use Reverse Geocode
Set up Reverse Geocode on APIVerve, or reach the same source a different way. Your APIVerve account and credits work on all of them — one key, one balance.
Related
More in Geography: