โ† Guides

Determinism: same input, same output

If you cache results, store them, or test against them, you need to know when the API can give a different answer to the same question. The short version: only when you let it pick the time, or the randomness.

Updated

The guarantee

The calculation engine has no randomness: the same input produces the same data, byte for byte. The engine's own test suite pins this, and you can check it yourself - two identical /v1/charts/birth calls return identical data. That makes responses safe to cache by request body.

Two things in a response do change between calls and should be left out of any cache key or comparison: the envelope's request_id, and meta.computed_at (the wall-clock time of the call).

Endpoints that default to "now"

Some endpoints answer a question about a moment, and use the current time if you do not give one. Those return different results tomorrow - by design. Pass the moment explicitly whenever you cache, store or test:

Time-dependent defaults
EndpointDefaults to now
/v1/western/lunar-metricsthe moment (at)
/v1/western/transit/*the transit moment
/v1/kp/horary, /v1/kp/transitthe question / transit moment
/v1/dosha/sade-satithe as-of date for the current phase
/v1/nadi/timingthe reference moment for the running period (as_of)
/v1/horoscope/daily/:signtoday (UTC)

Engine versions

Responses carry an engine_version in meta, and it is bumped whenever a change alters output. Store it next to anything you persist: if you ever see a difference between a stored result and a fresh one, the version tells you whether the engine changed or the input did. Additions to the API contract are listed on the changelog.

Reproducible tarot draws

Tarot is the one place randomness is the point. POST /v1/tarot/draw shuffles with a fresh random seed by default. Pass your own seed (any string, 1-120 characters) and the draw becomes reproducible: the seed is hashed (SHA-256) into a xoshiro256** generator that drives a Fisher-Yates shuffle, so the same seed always gives the same cards. Two calls with "seed": "guide-demo" and a three-card spread both drew Eight of Wands, The Sun, Queen of Swords.

  • Shareable readings: store the seed, not the cards - the link can re-draw the identical spread.
  • Tests: fix the seed and assert on the cards.
  • One reading per user per day: derive the seed from the user id and the date.

Questions

Is it safe to cache AstroNode API responses?
Yes for calculations: the same input produces the same data, byte for byte, so responses can be cached by request body. Endpoints that default to the current time need the moment passed explicitly.
How do I make a tarot draw reproducible?
Pass your own seed (a string of 1 to 120 characters) to POST /v1/tarot/draw. Without one, the draw is shuffled with a fresh random seed each time.