Location API
Introducing the Location API, a simple and reliable way to fetch geographical location details using a place name, city name, or location search query. This API is designed for websites, mobile apps, chatbots, CRM dashboards, astrology platforms, or any application that requires location-based information.
The API allows you to search for a location by passing a place name through the request body and returns the corresponding location information.
API Endpoint
POST https://geolocation.divineapi.com/locationGuide: Use this endpoint to retrieve geographical information for a given place.
Headers
| Name | Type | Description |
|---|---|---|
| Authorization* | String | Your API Access Token. Example: Bearer {token} |
Fields marked with * are mandatory.
Request Body
| Name | Type | Description |
|---|---|---|
| api_key* | String | Your API key from the DivineAPI dashboard. |
| place* | String | Text to search for a location. Must contain at least 3 characters. Leading and trailing spaces are ignored. Example: Patna, New Delhi, New York. |
200: OK
{
"status": "success",
"code": 200,
"message": "Request successful",
"data": {
"count": 10,
"query": "patna",
"results": [
{
"place_id": 1260091,
"name": "Patna",
"full_name": "Patna, Bihar, India",
"country": "IN",
"admin1": "Bihar",
"latitude": 25.41667,
"longitude": 85.16667,
"timezone": "Asia/Kolkata",
"timezone_value": 5.5,
"population": 5838465
},
{
"place_id": 12685607,
"name": "Patna Rural",
"full_name": "Patna Rural, Bihar, India",
"country": "IN",
"admin1": "Bihar",
"latitude": 25.58486,
"longitude": 85.16871,
"timezone": "Asia/Kolkata",
"timezone_value": 5.5,
"population": 1771140
},
{
"place_id": 1260086,
"name": "Patna",
"full_name": "Patna, Bihar, India",
"country": "IN",
"admin1": "Bihar",
"latitude": 25.59408,
"longitude": 85.13563,
"timezone": "Asia/Kolkata",
"timezone_value": 5.5,
"population": 1684297
},
{
"place_id": 12683334,
"name": "Patnagarh",
"full_name": "Patnagarh, Odisha, India",
"country": "IN",
"admin1": "Odisha",
"latitude": 20.76025,
"longitude": 83.11076,
"timezone": "Asia/Kolkata",
"timezone_value": 5.5,
"population": 168325
},
{
"place_id": 1260082,
"name": "Patnāgarh",
"full_name": "Patnāgarh, Odisha, India",
"country": "IN",
"admin1": "Odisha",
"latitude": 20.70833,
"longitude": 83.13263,
"timezone": "Asia/Kolkata",
"timezone_value": 5.5,
"population": 21024
},
{
"place_id": 1694370,
"name": "Patnanungan",
"full_name": "Patnanungan, Calabarzon, Philippines",
"country": "PH",
"admin1": "Calabarzon",
"latitude": 14.81667,
"longitude": 122.15,
"timezone": "Asia/Manila",
"timezone_value": 8,
"population": 15554
},
{
"place_id": 1694369,
"name": "Patnanungan",
"full_name": "Patnanungan, Calabarzon, Philippines",
"country": "PH",
"admin1": "Calabarzon",
"latitude": 14.78333,
"longitude": 122.18333,
"timezone": "Asia/Manila",
"timezone_value": 8,
"population": 6901
},
{
"place_id": 2640574,
"name": "Patna",
"full_name": "Patna, Scotland, United Kingdom",
"country": "GB",
"admin1": "Scotland",
"latitude": 55.36406,
"longitude": -4.50594,
"timezone": "Europe/London",
"timezone_value": 0,
"population": 2190
},
{
"place_id": 10532578,
"name": "Patna",
"full_name": "Patna, Madhya Pradesh, India",
"country": "IN",
"admin1": "Madhya Pradesh",
"latitude": 24.52205,
"longitude": 81.52903,
"timezone": "Asia/Kolkata",
"timezone_value": 5.5,
"population": 0
},
{
"place_id": 10457447,
"name": "Patna",
"full_name": "Patna, Madhya Pradesh, India",
"country": "IN",
"admin1": "Madhya Pradesh",
"latitude": 23.56601,
"longitude": 79.85514,
"timezone": "Asia/Kolkata",
"timezone_value": 5.5,
"population": 0
}
]
},
"attribution": "Place data © GeoNames (geonames.org), CC BY 4.0"
}Example Code Implementations
Below are example implementations in various programming environments.
cURL
curl --location 'https://geolocation.divineapi.com/location' \
--header 'Authorization: Bearer {YOUR_AUTH_TOKEN}' \
--form 'api_key="{YOUR_API_KEY}"' \
--form 'place="beg"'