Error codes
Every error response has the same JSON envelope: error (a slug for the HTTP status), message (human-readable), request_id, and usually a code.
Error response shape
{
"error": "payment_required",
"message": "No credits remaining",
"request_id": "6f1c2a9e-4b7d-4c1e-9a53-2f0d8b1e7c44",
"code": "402"
}- error — short slug for the HTTP status (e.g. payment_required)
- message — human-readable description
- code — optional machine-readable identifier (see the table below). On generic errors it is the HTTP status as a string, e.g. "401"; schema validation errors have none.
- request_id — an opaque string (echoes your X-Request-Id header if you sent one, otherwise a generated ID); pass it to support to debug a specific call
HTTP status codes
Body or query parameters failed validation (missing field, wrong type, malformed date), or a value was rejected by the calculation.
→ Read `message`: it names the first rule that failed. Compare your request with the schema in the API reference.
No Authorization or X-API-Key header, malformed bearer token, or unknown API key.
→ Verify the header is exactly "Authorization: Bearer <key>" (or "X-API-Key: <key>") — no extra whitespace.
The key is valid but the account has no credits left, or fewer than this endpoint costs.
→ Buy a credit pack in the dashboard or upgrade your plan. There is no automatic overage.
API key is valid but your plan does not include this endpoint (or interpret=true).
→ Upgrade your plan in the dashboard, or call an endpoint your plan includes.
Endpoint path does not exist (typo) or the requested resource is missing.
→ Recheck the path against the API reference — common typos: trailing slash, wrong version prefix.
An Idempotency-Key was reused with a different request body (code idempotency_conflict).
→ Use a new Idempotency-Key for each distinct request.
Used only when you try to create more API keys than your account allows (error key_limit_reached). Invalid request data returns 400.
→ Revoke an unused key in the dashboard, then create the new one.
Exceeded the per-minute or per-day limit for your plan.
→ Honor the Retry-After header — back off exponentially or upgrade the plan.
Unexpected server-side fault — astrom8 incident or unhandled edge case.
→ Retry once after a short delay. If it keeps failing, send the request_id to ops@astrom8.com.
The LLM provider returned output that could not be parsed, even after one repair retry (code interpretation_malformed).
→ No credits are charged. Retry the request; if the provider keeps failing you will get 503 llm_unavailable until it recovers.
A required dependency is unavailable (LLM provider, image storage, PDF rendering or the ephemeris).
→ Wait and retry. If it lasts, email ops@astrom8.com with the request_id.
Custom error codes
| code | HTTP | Meaning |
|---|---|---|
| invalid_input | 400 | A value passed the schema but was rejected by the calculation, e.g. a date the PDF calendar cannot handle. Plain schema failures return error bad_request with no code. |
| unsupported_ayanamsa | 400 | The requested ayanamsa is not supported. Use lahiri. |
| "401" | 401 | error "unauthorized": missing or invalid API key. |
| "402" | 402 | error "payment_required": the account has no credits left, or fewer than this endpoint costs. Buy a credit pack or upgrade. |
| endpoint_tier_locked | 403 | Your plan does not include this endpoint. |
| interpret_tier_locked | 403 | interpret=true needs the Starter plan or higher. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request body. |
| rate_limit_minute | 429 | Per-minute limit for your plan exceeded. Wait for Retry-After seconds. |
| rate_limit_day | 429 | Daily limit for your plan exceeded. It refills at the next UTC midnight (x-ratelimit-reset-day). |
| internal | 500 | The calculation failed on the server. Retry once, then send the request_id to support. |
| interpretation_malformed | 502 | The LLM returned output that could not be parsed. No credits charged. |
| llm_unavailable | 503 | The LLM provider failed, timed out, or is paused by the circuit breaker after repeated failures; retry shortly. No credits charged. |
| interpretation_unavailable | 503 | LLM interpretation is not configured on the server. No credits charged. |
| pdf_unavailable | 503 | PDF rendering is offline. Returned by /api/v3/reports/thai-calendar/pdf. |
| image_unavailable | 503 | Image storage is not configured; other image failures return code internal. No credits charged. |
| ephemeris_unavailable | 503 | The ephemeris engine is unavailable for this calculation. Retry shortly. |