Birth place and timezone lookup API
Every chart needs a latitude, a longitude and the right UTC offset for the moment of birth. These two calls get them for you, so your sign-up form can ask for a city instead of coordinates.
Search places
GET /v1/places/search (1 credit) takes what the person typed and returns matching places with their coordinates, state, country and IANA zone. Try a town name.
Try it
The offset at a moment
POST /v1/timezone (1 credit) takes coordinates and a moment and returns the zone and the offset in force then, including old offsets and daylight saving. ambiguous is true when a local time happened twice, as when clocks go back.
Try it
You rarely need this call for charts: the chart calls take the local time and the place and look up the offset themselves. Use it when you store times in UTC or show times to people in other zones.
The same calls in code
curl 'https://api.astrologics.in/v1/places/search?q=Noida' \
-H 'Authorization: Bearer al_test_YOUR_KEY'import json
import urllib.error
import urllib.request
body = {
"latitude": 28.6139,
"longitude": 77.209,
"datetime": "1990-08-13T01:00:00Z",
}
req = urllib.request.Request(
"https://api.astrologics.in/v1/timezone",
method="POST",
headers={"Authorization": "Bearer al_test_YOUR_KEY", "Content-Type": "application/json"},
data=json.dumps(body).encode(),
)
try:
with urllib.request.urlopen(req) as res:
print(json.dumps(json.load(res), indent=2, ensure_ascii=False))
except urllib.error.HTTPError as err:
print(err.code, err.read().decode())Questions
Why not use a general maps API?
You can. These calls return what charts need, coordinates and the historical zone, and need no second provider. Delhi in June 1943, for example, comes back as +06:30, the wartime offset, not today's +05:30.
Does search cost credits?
Yes, as shown above. Search as the person types only after a short pause, and cache repeated queries.
Can I reverse-geocode a point?
Yes: GET /v1/places/reverse (1 credit) returns the nearest place to a latitude and longitude.