Keys
- Call the API from your server. A key in a mobile app or browser bundle can be extracted, and once you revoke it every installed copy of the app fails with
401. Security. - Use a live key in production and a test key everywhere else. Keys start
aie_live_oraie_test_; the Free plan issues test keys only. - Read the key from the environment, unquoted. Surrounding whitespace is ignored but quotes are not: a
.envvalue pasted with quotes sends the quotes as part of the key. UNAUTHORIZED. - Have a rotation plan. The full key is shown once. If one leaks, revoke it in the dashboard and deploy a new one.
Reading responses
- Parse the envelope once, centrally. Success is
request_id,data,interpretationandmeta; an error isrequest_idanderror. There is nosuccessboolean on the calculation API. Response envelope. - Read `data`, not the root. Chart endpoints also carry a
metainsidedata(the ayanamsa and house system), which is a different object from the envelope'smeta. - Branch on `error.code`, never on the status alone. Two different problems return
429, and they need opposite handling. Error codes. - Log `request_id` on every call. It is on errors too, and it is the first thing support will ask for. You can send your own
x-request-idto trace a call across your services.
Limits and retries
- Throttle before you are throttled. Responses carry
x-ratelimit-limit,x-ratelimit-remainingandx-ratelimit-reset; slow down onremaining, not on the first429. Rate limits and quotas. - Retry `RATE_LIMITED` after `Retry-After`. Do not retry `QUOTA_EXCEEDED`. Its
Retry-Afteris the time until the next UTC month - often weeks. Alert on it instead. - Retry `INTERNAL_ERROR` and `SERVICE_UNAVAILABLE` with backoff. Do not retry
VALIDATION_ERROR,UNAUTHORIZEDorPLAN_REQUIRED: the same request will fail the same way. - Send an `Idempotency-Key` on anything you might retry, and derive it from the thing you are doing (
order-8812-chart), not from the attempt. A replayed response is markedidempotent-replayed: true. Choosing keys. - Know what counts toward quota. Only responses below 400 are billed, so a bug that sends invalid requests does not burn the month's allowance. Replays of a stored response are billed.
- Size the plan for peak, not average. The per-minute limit is per key; the monthly quota is shared by every key on the account. The rate-limit planner does the arithmetic.
Birth data
- Store the offset that applied at birth, not today's. The API takes
tz_offset_minutesand does not look up time-zone names or daylight-saving rules. An offset that is wrong by an hour moves the ascendant by about half a sign. Birth time and time zones. - Send exactly the documented fields. Unknown fields are rejected with
400, so atimezoneornamefield left in the body fails the call rather than being ignored. - Decide what you keep. The calculation endpoints do not store birth inputs; whatever you persist is your data to protect. Storing birth data.
Caching, versions and time
- Cache by request body and engine version. The same input returns the same
data, byte for byte, so caching is safe - if the key includesmeta.engine_versionand a normalised body. Caching recipe. - Store `engine_version` beside anything you persist. It is bumped whenever a change alters output, and it tells you later whether the engine changed or the input did.
- Pass the moment explicitly. Endpoints that answer a question about a moment default to the current time and so return something different tomorrow. Send the timestamp whenever you cache, store or test. Determinism.
- Convert times for display yourself. Instants in responses are ISO 8601 UTC strings.
- Watch the changelog. New fields are optional and backward compatible; the changelog has an RSS feed.
Before you ship
- Run one request per endpoint you use with the live key, and confirm the plan includes each: a key on a lower plan gets
403 PLAN_REQUIRED. - Force a
429in a test and watch your client back off rather than loop. - Send a birth before 1950 and one from a place that has used daylight saving, and check the ascendant against a source you trust.
- Confirm that no key appears in your client bundle, logs or error reports.
Questions
- Should I retry a 429 from the AstroNode API?
- It depends on
error.code. RetryRATE_LIMITEDafter theRetry-Afterheader. Do not retryQUOTA_EXCEEDED: itsRetry-Afteris the time until the next UTC month, and retrying will not help until then or until the plan changes. - Is it safe to cache API responses?
- Yes for calculations: the same input returns the same
data. Includemeta.engine_versionand a normalised request body in the cache key, and pass the moment explicitly on endpoints that default to the current time. - Do failed requests count toward my quota?
- No. Only responses with a status below 400 are billed. Refused and failed calls are logged but do not consume the monthly quota. A replay of a stored idempotent response is billed like any successful call.