96Astro API

Documentation

From your own ephemeris code to the API

Replace self-hosted Swiss Ephemeris code with API calls: what maps to what, how to compare results, and when not to move.

If you already call the Swiss Ephemeris yourself, you have solved the hardest part of positions. What you may not want to keep solving is everything around them: time zones, licensing, nakshatra and dasha logic, doshas, translations and updates.

When not to move

If you only need raw positions at high volume, and your licence is in order, your own code is cheaper and faster. Move when the calculations around the positions become the larger cost.

A licence question to check: the Swiss Ephemeris is free under the AGPL, which has conditions for software offered over a network, or under a paid professional licence. Calling an API means that you do not need your own.

What maps to what

You callUse
swe_calc_ut with SEFLG_SIDEREALplanet-positions
swe_houses_exbhav-chalit, western-house-cusps
swe_set_sid_modeThe ayanamsha field
swe_get_ayanamsa_utayanamsha-list, or ayanamsha in any chart
swe_rise_transsun-moon-timings
swe_sol_eclipse_when_globeclipses
Your own dasha codevimshottari-dasha, dasha-at-date

Compare before you switch

Run both side by side on a sample of real births, and compare by longitude:

curl https://api.96astroapi.com/v1/vedic-charts/planet-positions \
  -H "Authorization: Bearer $ASTRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "datetime": "1990-10-18T14:30:00", "timezone": "Asia/Kolkata", "latitude": 28.6139, "longitude": 77.209 }'

Small differences usually have one of these causes:

  • The node: we default to the true node. Send "node": "mean" if you used SE_MEAN_NODE.
  • Apparent or true: we use apparent positions, without SEFLG_TRUEPOS or SEFLG_NOABERR.
  • The ayanamsha: the default is Lahiri. Check that yours is the same.
  • Your offset: we resolve the zone's offset for that date. A fixed offset in your code may differ for old dates.
  • Data files: without the .se1 files, the library falls back to a less precise model.

See How charts are computed for the full list.

Moving in stages

Move the logic you least want to own first, such as doshas, matching or translations, and keep your own positions for now. Then move the rest once the numbers agree.

On this page