City Search
City Search
City Search (Autocomplete)
Search cities, localities, and suburbs so users can select the correct location before making astrology calculations.
Jingzhou, Hubei, a province-first query such as Hubei Jingzhou, optional suffixes as in Jingzhou City, Hubei Province, or include the country as in Jingzhou, Hubei, CN. The province is returned in the state field.country parameter is only for narrowing ambiguous global matches.Endpoint
https://api.freeastroapi.com/api/v2/geo/searchRequires an x-api-key header.
Live Geo V2 Test
Query Parameters
Code Examples
# Search for cities starting with "paris"
curl -H "x-api-key: YOUR_API_KEY" "https://api.freeastroapi.com/api/v2/geo/search?q=paris&limit=5"
# Select a same-name city by state or province
curl -G -H "x-api-key: YOUR_API_KEY" --data-urlencode "q=Jingzhou, Hubei" --data-urlencode "limit=5" "https://api.freeastroapi.com/api/v2/geo/search"
# The state or province can also come first
curl -G -H "x-api-key: YOUR_API_KEY" --data-urlencode "q=Hubei Jingzhou" --data-urlencode "limit=5" "https://api.freeastroapi.com/api/v2/geo/search"
# Optional English administrative suffixes are accepted
curl -G -H "x-api-key: YOUR_API_KEY" --data-urlencode "q=Jingzhou City, Hubei Province" --data-urlencode "limit=5" "https://api.freeastroapi.com/api/v2/geo/search"
# Search Indian localities and suburbs without a country filter
curl -H "x-api-key: YOUR_API_KEY" "https://api.freeastroapi.com/api/v2/geo/search?q=mulund&limit=5"India Districts
Indian places include an additional district field when district data is available. This helps distinguish places with the same city or locality name, such as Vangaon in Palghar versus Aurangabad.
For non-Indian results, district is returned as null. Existing fields remain unchanged, so clients can continue reading name, country, state, coordinates, timezone, and population.
Existing unqualified searches such as Mumbai, Vangaon, or Mulund, with or without country=IN, keep their current behavior. Qualified queries such as Mumbai, Maharashtra and Maharashtra Mumbai narrow matches by state; GeoCity checks the complete input as a place name first to preserve existing multiword locality searches.
Response Fields
Sample Response
{
"results": [
{
"name": "Vāngaon",
"country": "IN",
"state": "Maharashtra",
"district": "Palghar",
"lat": 19.87621,
"lng": 72.76267,
"timezone": "Asia/Kolkata",
"population": 0
},
{
"name": "Vangaon",
"country": "IN",
"state": "Maharashtra",
"district": "Aurangabad",
"lat": 20.56385,
"lng": 75.36115,
"timezone": "Asia/Kolkata",
"population": 0
}
],
"count": 2
}💡 Recommended Usage
Use this endpoint to build city autocomplete in your application:
- User starts typing a city name in your form
- After 2+ characters, call this endpoint with the input
- Display results as a dropdown for the user to select from
- When user selects a city, use the
lat,lng, andtimezonevalues in your astrology API calls
This ensures users always select a valid city that the API can resolve, avoiding coordinate lookup errors.