Skip to main content

Error envelope

Every Spatius API error returns the same JSON envelope, regardless of which endpoint failed:
  • code is a stable machine-readable string. Program against code, not message.
  • message is a human-readable explanation specific to this occurrence.
  • requestId uniquely identifies the request. It is also returned in the X-Request-ID response header. Quote it when contacting support.

HTTP status and error code mapping

Job failure codes

When a creation job reaches failed, the job’s error object carries one of these codes: The retryable flag on the error indicates whether resubmitting the same request may succeed.

Rate limits

Limits are enforced per account. Your account may be configured below these hard caps: Read limits apply to the GET endpoints; creation limits apply to POST /avatars. When a limit is hit, the API returns 429 with rate_limit_exceeded (or concurrency_limit_exceeded when the concurrency cap is the binding constraint). Back off and retry — for job polling, an interval of 5–10 seconds stays comfortably within the read limits.

Pagination

Both list endpoints (GET /avatars and GET /avatar-jobs) paginate the same way. They accept pagination.pageSize and pagination.pageToken, and return pagination.nextPageToken and pagination.totalCount. pageSize defaults to 20 and has a maximum of 99.
A pageSize above 99 does not return 99 items — it falls back to the default of 20. Request at most 99 to avoid receiving fewer items than you expect.
To page through results, pass the previous response’s pagination.nextPageToken as pagination.pageToken. An empty nextPageToken means there are no more pages. Treat the token as opaque and pass back exactly what you received; do not construct or increment it yourself. An invalid page token is rejected with 400 and invalid_request.
Keep pageSize the same for every request in a pagination sequence. A token is only valid for the pageSize it was issued with, and reusing it with a different pageSize is rejected with 400 and invalid_request. To change the page size, start again from the first page with no pageToken.

Next steps

Overview

The asynchronous avatar creation flow, end to end.

Authentication

The X-App-ID and X-API-Key header pair.