Overview
Lookup runs in two steps, both against bundled offline data. First the point given by `lat` and `lon` is placed in a country using country boundary polygons. Then the nearest entry in a US, Canada and Australia postal location dataset is found for that country, and its `city`, `state`, `state_abbr` and `zipcode` are returned. Coordinates in any other country are outside the dataset and are not supported.
Results are only as fine-grained as the dataset: the answer is the closest postal-code location, not the containing boundary, so points near a town or ZIP 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. `latitude` and `longitude` echo the input and `countryCode` is the two-letter code from the first step.
`nearestCities` holds up to 20 unique city names from a worldwide city list, ordered by distance from your point, closest first, so it usually starts with the city you are in and continues with its neighbours. `distance`, the closest coordinates, `estimatedCity` and `nearestCities` are null on the Free plan.
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 |
state_abbr | string | "NY" | Two-letter state abbreviation code |
city | string | "Brooklyn" | Primary city name at coordinates |
state | string | "New York" | Full state name |
distancePremium | number | 0.6501757300758664 | Distance to closest coordinates in miles |
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 (US only, null elsewhere) 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. |
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.
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: