Practical patterns for building reliable clients against the Crustdata API. Each section explains the signal the API sends, then shows the code you need to react to it.Documentation Index
Fetch the complete documentation index at: https://docs.crustdata.com/llms.txt
Use this file to discover all available pages before exploring further.
Handle rate limits
Crustdata returns rate limit headers on every response. Read them after each call and pace your client accordingly — this is more reliable than guessing limits up front, and it gives you visibility before you hit the cap.Rate limits are enforced on a sliding window. The window does not
reset at fixed clock intervals — instead, each request counts against the
limit for the duration of the window, and
x-ratelimit-reset tells you
how many seconds until the oldest request ages out and capacity frees up.
Spreading traffic evenly is safer than bursting and waiting for a “reset.”Rate limit headers
| Header | Meaning |
|---|---|
x-ratelimit-limit | Maximum requests allowed within the sliding window. |
x-ratelimit-remaining | Requests you have left right now. |
x-ratelimit-reset | Seconds until the next request ages out and capacity frees up. |
Read the headers and pace requests
After each request, inspectx-ratelimit-remaining. When it gets close to zero, wait x-ratelimit-reset seconds before sending the next call.
Retry on 429 with backoff and jitter
If you do receive a429 Too Many Requests, wait x-ratelimit-reset seconds and retry. Add jitter so concurrent workers do not all retry at the same instant.
See Rate limits for default per-endpoint limits
and how to request higher throughput.
Handle insufficient credits
When your account has no remaining credits, the API returns402 Payment Required with a structured error body. Treat this as terminal — retrying will not succeed until credits are added.
Response shape
| Field | Description |
|---|---|
error.type | insufficient_credits for this case. |
error.message | Human-readable message safe to surface in logs and UI. |
error.metadata | Reserved for additional context. May be empty. |
Detect and stop
Catch402 early, pause the workflow, and alert the operator. Do not feed the same request back into a retry loop.

