Skip to content

Errors & Credits

Error responses

All error responses return JSON with a single error field:

json
{ "error": "Description of what went wrong." }

HTTP status codes

StatusWhen it occurs
400 Bad RequestMissing or invalid request parameters (e.g. lat out of range, invalid unit).
401 UnauthorizedAPI key missing or the Authorization header is malformed.
403 ForbiddenKey has been revoked or the key has run out of credits ("insufficient_credits").
429 Too Many RequestsRate limit exceeded — too many requests per minute. Back off and retry.
500 Internal Server ErrorUnexpected server-side error.
502 Bad GatewayThe upstream weather provider or AI backend is unavailable. Retry after a short delay.

Example: rate limited

json
{
  "error": "rate_limited",
  "message": "Too many requests. Please slow down."
}

When rate limited (429), the response also includes:

Retry-After: 60
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0

Example: invalid coordinates

json
{
  "error": "lat must be a number between -90 and 90, and lon between -180 and 180."
}

Example: out of credits

json
{
  "error": "insufficient_credits"
}

Retrying 502 errors

502 errors are transient. Wait 2–5 seconds and retry. If they persist, check the Sky Style status page.


Response headers

Every v1 API response includes the following standard headers:

HeaderDescription
X-RateLimit-LimitMaximum requests allowed per minute.
X-RateLimit-RemainingRequests remaining in the current 60-second window.
Retry-AfterSeconds to wait before retrying (only present on 429 responses).
Cache-ControlAlways no-store — API responses must not be cached.
Access-Control-Allow-Origin* — the API supports cross-origin requests from any origin.

Credits

Each API key starts with 100 credits. Credits are deducted after each successful request. You can view your current balance in the API Dashboard.

Credit costs

EndpointMethodCredits
/recommendPOST2
/recweatherPOST3
/weatherGET1
/closetGET1

Charging rules

OutcomeCredits charged
Success (2xx)Full cost
Partial success (weather ✅, AI ❌)Half cost (rounded up)
Failure (5xx)0
Auth / validation error (4xx)0

Sky Style Docs — always in sync with skystyle.app/api/v1