Astro Timing
Astro Timing API: moon, panchang and planet data
A free JSON API for moon phases, planet positions, Mercury retrograde, lunations, eclipses, the daily panchang for any city and best-day scores. Sky endpoints use GET; chart, yogas and dasha accept JSON POST requests. CORS is open. No key is needed during the preview. The one condition is a visible link to Astro Timing wherever the data appears.
Quick start
No key, no sign-up. Sky endpoints use GET; chart, yogas and dasha use POST with JSON birth inputs. All return JSON with open CORS. These API calls are server-side; the website calculator runs locally instead.
curl
curl "https://whenstar.com/api/v1/today?city=Mumbai"
JavaScript, with our tiny client
One ES module, no dependencies, about 2 KB: /sdk/astro-timing.js.
import { AstroTiming } from "https://whenstar.com/sdk/astro-timing.js";
const at = new AstroTiming();
const today = await at.today({ city: "Mumbai" });
console.log(today.panchang.tithi, today.moon.phase);
const days = await at.bestDays({ goal: "launch", from: "2026-11-01", to: "2026-11-30" });
console.log(days.days[0]);Or plain fetch
const r = await fetch("https://whenstar.com/api/v1/lunations?year=2027");
const { lunations } = await r.json();Endpoints
The full machine-readable description is the OpenAPI 3.1 document at /openapi.json.
| Request | What you get | Cached for |
|---|---|---|
POST /api/v1/yogas | JSON birth input, same as chart, plus optional unknownTime boolean. Returns rule formation, cancellation, qualification and confirmed as true, false or null, with notes and article links. Unknown time hides lagna-dependent rules. | not cached |
POST /api/v1/dasha | Same JSON input. Returns ten Vimshottari mahadashas, each with nine antardashas, UTC start/end, current flag and links. unknownTime marks the supplied instant as approximate; clients should send local noon with its UTC offset. | not cached |
GET /api/v1/today?city=Mumbai | A compact summary of today for one city: Moon phase and signs, the panchang at sunrise, Rahu kaal, whether Mercury is retrograde, and the next new and full moon. | 5 minutes |
GET /api/v1/panchang?date=2026-10-12&city=Mumbai | The full panchang for a date and place: tithi, nakshatra, yoga and karana with their end times, sunrise and sunset, Rahu kaal, Yamaganda, Gulika, Abhijit, choghadiya and hora. Use lat, lon and tz instead of city if you prefer. | 1 day with a date, 5 minutes without |
GET /api/v1/moon | Moon phase now (or at date=… with a UTC offset): elongation, illumination, lunar day (tithi), tropical sign, next new and full moon. | 5 minutes; 1 day with a date |
GET /api/v1/positions?date=2027-01-01T00:00:00Z | Positions of the Sun through Pluto, the lunar nodes and Lilith, in both zodiacs, with speed and a retrograde flag. | 5 minutes; 1 day with a date |
GET /api/v1/retrograde?year=2027 | Every Mercury retrograde in a year with the station times and the shadow dates on either side. | 1 day |
GET /api/v1/lunations?year=2027 | Every new and full moon in a year with the exact UTC time and the Moon’s sign in both zodiacs. | 1 day |
GET /api/v1/eclipses?year=2027 | Solar and lunar eclipses in a year: type, kind (total, annular, partial, penumbral) and time of greatest eclipse. | 1 day |
GET /api/v1/best-days?goal=launch&from=2026-11-01&to=2026-11-30 | Days in a range ranked by our published pin-a-date factors for one goal (reflection, creativity, contracts, launch, love, money or travel), each with its points. | 1 day |
POST /api/v1/chart | A full birth chart for an instant and place, sent as JSON: { "date": "1990-06-15T16:00:00Z", "latitude": 40.71, "longitude": -74.01 }. Nothing is stored. | not cached |
What the fields mean
illumination- Fraction of the Moon’s disc that is lit, from 0 (new) to 1 (full).
phase / angle- How far the Moon is ahead of the Sun, in degrees. 0 is new moon, 90 first quarter, 180 full.
tithi- The lunar day, 1 to 30. Each one is 12 degrees of that angle. 1–15 are the waxing half (Shukla), 16–30 the waning half (Krishna).
nakshatra- Which of the 27 lunar mansions the Moon is in, measured in the sidereal (Vedic) zodiac. pada is the quarter, 1–4.
tropical / sidereal- The two zodiacs. Tropical (Western) is tied to the seasons; sidereal (Vedic) to the stars, about 24 degrees behind. We use the Lahiri offset.
rahuKaal- One eighth of the daylight hours, a different eighth for each weekday, traditionally avoided for new starts. Start and end are UTC instants; convert with place.tz.
retrograde- True when the planet appears to move backwards against the stars as seen from Earth.
score (best-days)- The sum of the listed factor points. It is an editorial weighting we publish, not a personal muhurta or a forecast.
attribution- Every response includes the credit to show next to the data, with its link.
All times are UTC ISO 8601 strings. Dates without a time (YYYY-MM-DD) are civil dates in the place's time zone for panchang, and UTC for best-days. Supported years run 1900 to 2100. Errors come back as HTTP 400 with {"error": "…"} saying which parameter to fix.
Attribution and fair use
The API is free. The one condition: wherever you show our data, show a visible link to Astro Timing (the text and URL are in every response under attribution). Data is licensed CC BY 4.0.
Rate limits are fair use for now: cache what you can, and don't poll faster than the cache times above. Responses are cached at the edge, so repeated identical requests are cheap for both of us. API keys come with the public launch; nothing you build now will need rewriting beyond adding a key header.
These endpoints calculate where things are in the sky and what the traditional calendars say. They don't predict events, and no score here is a promise.
Want a widget instead of raw data? See the embeddable widgets. How the numbers are made: methodology.
How we calculate
Is astrology a guarantee of what will happen?
No. These calculations locate celestial bodies; astrology is a reflection and timing tradition, not evidence of guaranteed health, financial or relationship outcomes.
How are these results calculated?
Positions come from Astronomy Engine, an open-source astronomy library, and are checked against Swiss Ephemeris in our methodology tests. Western readings use the tropical zodiac; Vedic readings subtract the Lahiri ayanamsa. Terms are defined in the glossary.
Next: compare your birth chart, see today's sky, or make a private vision board.