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.
From 10,211 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 285ms | 308ms | 381ms | 539ms | 953ms |
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
latrequiredLatitude coordinate.
lonrequiredLongitude coordinate.
Headers
X-Api-KeyrequiredAPI 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.
nameName of the location (city, town, or area).
country2-letter ISO 3166 alpha-2 country code.
stateState, province, or administrative region name.
Sample Request Live Demo!
https://api.api-ninjas.com/v1/reversegeocoding?lat=51.509865&lon=-0.118092Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
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
Can I use the Reverse Geocoding API for commercial purposes?
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.How do I get an API key and start using the Reverse Geocoding API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
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.What happens if a request to the Reverse Geocoding API fails?
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.What are some use cases for the Reverse Geocoding API?
It is ideal for translating raw GPS or devicelat/loncoordinates 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.How do I query a location by coordinates?
Send a GET request to the/v1/reversegeocodingendpoint with the requiredlatandlonquery parameters, for example?lat=40.7128&lon=-74.0060. See the pricing page for request limits per plan.What does the Reverse Geocoding API response include?
It returns a JSON array of location objects, each with aname(city, town, or area), acountryfield as a 2-letter ISO 3166 alpha-2 code, and astatefield for the province or administrative region. If you also need detailed city statistics like population, pair it with the City API.Can I get coordinates from an IP address or find the time zone for a location?
The Reverse Geocoding API only acceptslatandloncoordinates, 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.