NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server

Reverse Geocoding API

The Reverse Geocoding API enables you convert latitude/longitude coordinates to cities that fall within those coordinates. For regular geocoding, check out our Geocoding API.

(4.6)

From 10,211 users

500+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
285ms308ms381ms539ms953ms

Didn't find what you were looking for? Suggest an improvement


/v1/reversegeocoding GET

https://api.api-ninjas.com/v1/reversegeocoding

Returns a list of cities that contain a given latitude and longitude.

Parameters

  • lat  required

    Latitude coordinate.

  • lon  required

    Longitude coordinate.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON array of location objects, each containing the following fields, or an error if the request is unsuccessful.

  • name

    Name of the location (city, town, or area).

  • country

    2-letter ISO 3166 alpha-2 country code.

  • state

    State, province, or administrative region name.

Sample Request Live Demo!

lat
lon

Try this endpoint live with a free API key

Instant access — no credit card required.

https://api.api-ninjas.com/v1/reversegeocoding?lat=51.509865&lon=-0.118092

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
[
    {
      name:"City of Westminster",
      country:"GB",
      state:"England"
    }
]

Code Examples

1 2 curl -X GET "https://api.api-ninjas.com/v1/reversegeocoding?lat=40.7128&lon=-74.0060" \ -H "X-Api-Key: YOUR_API_KEY"

If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.

Frequently Asked Questions

  • Yes, but you must have a premium subscription. Commercial use of the Reverse Geocoding API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.
  • The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.
  • It is ideal for translating raw GPS or device lat/lon coordinates into human-readable place names for ride-sharing apps, delivery tracking, store locators, and analytics dashboards. For the opposite direction (turning a place name into coordinates), use the Geocoding API.
  • Send a GET request to the /v1/reversegeocoding endpoint with the required lat and lon query parameters, for example ?lat=40.7128&lon=-74.0060. See the pricing page for request limits per plan.
  • It returns a JSON array of location objects, each with a name (city, town, or area), a country field as a 2-letter ISO 3166 alpha-2 code, and a state field for the province or administrative region. If you also need detailed city statistics like population, pair it with the City API.
  • The Reverse Geocoding API only accepts lat and lon coordinates, so to derive a location from a visitor's IP first use the IP Lookup API, and to find the time zone for a set of coordinates use the Timezone API.