Skip to content
AstroWay/api v2.19.0 · docs
all systems operational
UA EN

Errors

All errors are returned in a unified format:

{
"error": {
"code": "invalid_api_key",
"message": "The API key provided is invalid or has been revoked.",
"request_id": "01HXY2A7ZM0ABCDEF",
"details": null
}
}
  • code — machine-readable snake_case code, stable, never changes without a major version bump
  • message — human-readable explanation in English
  • request_id — ULID for the request, quote it when contacting support
  • details — optional object with context (for 422 — list of failed fields)
StatusMeaning
200 OKSuccess
400 Bad RequestMalformed request (invalid JSON, missing required fields)
401 UnauthorizedMissing or invalid X-Api-Key
402 Payment RequiredCredits exhausted for current period
403 ForbiddenKey is valid but lacks permission for this action
404 Not FoundEndpoint does not exist
422 Unprocessable EntityValid JSON, but values fail Zod validation
429 Too Many RequestsRate limit exceeded
500 Internal Server ErrorServer-side error — quote request_id in support request
503 Service UnavailableAPI temporarily unavailable (deploy, maintenance)
CodeHTTPMeaning
missing_api_key401Header X-Api-Key not sent
invalid_api_key401Key doesn’t exist or was revoked
insufficient_scope403Key lacks permission for this action (e.g. not a master key)
CodeHTTPMeaning
credits_exhausted402Monthly credit budget exhausted
subscription_inactive402Subscription canceled or expired
overage_disabled402Overage disabled in settings and budget exhausted
CodeHTTPMeaning
rate_limit_exceeded429RPM limit exceeded. Includes retry_after_seconds
CodeHTTPMeaning
invalid_request400Invalid JSON or missing required header
validation_failed422One or more fields failed Zod validation. details contains array of { field, message }

Example 422:

{
"error": {
"code": "validation_failed",
"message": "Request body validation failed.",
"request_id": "01HXY2A7ZM...",
"details": [
{ "field": "datetime", "message": "Invalid ISO 8601 datetime" },
{ "field": "latitude", "message": "Must be between -90 and 90" }
]
}
}
CodeHTTPMeaning
location_out_of_range422Coordinates outside allowed range for this endpoint (e.g. Arctic for Placidus)
date_out_of_range422Date outside Swiss Ephemeris bounds (before -13000 or after 17000)
house_system_unsupported422Polar region with Placidus/Koch — suggest Whole Sign or Equal
ephemeris_error500Internal calculation error — rare, quote request_id
CodeHTTPMeaning
internal_error500Unexpected error. Logged with stack trace, quote request_id
service_unavailable503Deploy or scheduled maintenance. Retry in 30s
dependency_failure503DB or other dependency failure. Retry with exponential backoff
type ApiError = {
error: {
code: string;
message: string;
request_id: string;
details?: unknown;
};
};
async function chart(input: ChartInput) {
const res = await fetch('https://api.astroway.info/v1/chart', {
method: 'POST',
headers: {
'X-Api-Key': process.env.ASTROWAY_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify(input),
});
if (!res.ok) {
const body = (await res.json()) as ApiError;
throw new AstrowayError(body.error.code, body.error.message, body.error.request_id);
}
return res.json();
}
class AstrowayError extends Error {
constructor(
public code: string,
message: string,
public requestId: string,
) {
super(`[${code}] ${message} (request_id=${requestId})`);
}
}

Codes are the stable part of the API. Switch on code, not on message (message text may change without a version bump).

To contact support, send to support@astroway.info:

  1. request_id from the response
  2. Endpoint and abbreviated JSON body (redact secrets)
  3. Expected vs actual behavior
  4. Timezone and approximate request time (UTC)

Response within your plan’s SLA (48h Starter, 24h Pro, custom for Enterprise).

Was this helpful?
Suggest an edit

Last updated: