TKS Ephemeris · developer documentation

TKS engine & API — live examples with output

A plain HTTP + JSON API for planetary positions, Pañcāṅga (tithi · nakṣatra · yoga · karaṇa), eclipses, festival dates and Jyotiṣa charts — computed from the TKS ephemeris. Every endpoint below has a Run button that calls the real server and shows the real answer, plus ready-to-paste code for cURL, Python, Java and JavaScript.

Quick start

  1. Make a request. No signup is needed for the free window (1950 – 2050). Open this in a browser or paste it in a terminal:
  2. 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 the tz you sent, and Julian days (*_jd) are in UT.
  3. 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

All endpoints are 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

Longitudes are in degrees, 0 – 360. Nirayaṇa = sidereal (Chitrāpakṣa ayanāṃśa), sāyana = tropical. Indexes are 0-based (Aśvinī = 0, Meṣa = 0). Rāśi, nakṣatra and tithi names are in IAST transliteration.

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

HTTPMeaningWhat to do
200Success. "success": trueRead the fields documented below.
400A parameter is missing or invalid. The body names the field: {"success":false,"field":"date","error":"Invalid date …"}Fix the named parameter.
401API key required — the endpoint is not part of the free set.Send X-API-Key.
403Enterprise 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.
410The 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
The TKS reference kernels are read through an independent SPK evaluator (Chebyshev type-2), then apparent-place reduction (light-time, aberration, deflection), ecliptic-of-date and the TKS ayanāṃśa. This is what the /v1/tks/* and engine=tks endpoints use.

Engine B

dynamics
An independent N-body integration (DOPRI5; Newtonian + 1PN EIH + J2–J6 + C22/S22) started from the published initial states, used for cross-checking Engine A over deep time.

Śuddha Sūryasiddhānta

classical
The textual Sūrya-siddhānta computation (engine=mool) for those who want the traditional ahargaṇa-based result next to the TKS one. Rules for festivals can be run on either.
संस्करणः bin-1795527110