Quick start
- Make a request. No signup is needed for the free window (1950 – 2050). Open this in a browser or paste it in a terminal:
- Read the JSON. Every successful reply has
"success": true. Tithi, nakṣatra, yoga and karaṇa come back as{ "index": …, "name": … }; times are strings in the local time of thetzyou sent, and Julian days (*_jd) are in UT. - Use it from your language. Pick a tab (Python, Java, JavaScript) under any endpoint and copy it — the code already contains the place, date and key you set in the box below.
Everything you type here is used in every example, snippet and Run button on this page.
Basics you need to know
Base URL & format
GET and return UTF-8 JSON. CORS is open, so you can call them straight from a browser. Place names are optional labels — always send lat and lon (degrees, east and north positive).Dates & time zones
date=YYYY-MM-DD (proleptic Gregorian) and time=HH:MM or HH:MM:SS, 24-hour, in the local zone given by tz (hours east of UTC, e.g. 5.5 for India). Where an endpoint takes year, month, day separately, it means the same date.Reading the answers
Access, free window & API keys
Free: 100 years — 1950 … 2050 CE. Any endpoint that takes a date or year (date, year, from_year, to_year, as_of, dob, also inside a JSON body) answers freely inside this window. Outside it the server replies 403 Enterprise plan required (the catalogue endpoints instead clamp to the window and say so with "clamped": true).
The full TKS span −13,200 … +17,191 is served to an enterprise API key, sent as a header:
X-API-Key: your-key-here
Paste your key in the box above and every example on this page will send it. Keep keys on your server — don't ship them inside a public web page or mobile app.
Errors
| HTTP | Meaning | What to do |
|---|---|---|
| 200 | Success. "success": true | Read the fields documented below. |
| 400 | A parameter is missing or invalid. The body names the field: {"success":false,"field":"date","error":"Invalid date …"} | Fix the named parameter. |
| 401 | API key required — the endpoint is not part of the free set. | Send X-API-Key. |
| 403 | Enterprise plan required — the date or year is outside 1950 – 2050. The body has free_range and offending_parameter. | Use a date inside the window, or an enterprise key. |
| 410 | The route or engine value has been retired. | Use engine=tks (or mool where an endpoint lists it). |
Always check success before reading other fields — error replies are JSON too.
Recipes — small complete programs
The engine behind the API
Engine A
reference/v1/tks/* and engine=tks endpoints use.Engine B
dynamicsŚuddha Sūryasiddhānta
classicalengine=mool) for those who want the traditional ahargaṇa-based result next to the TKS one. Rules for festivals can be run on either.