> ## Documentation Index
> Fetch the complete documentation index at: https://docs.quackpay.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Rate limits and retries

> Handle rate, concurrency, and quota responses without overwhelming the API.

The API can reject a request when it exceeds a rate, concurrency, or quota limit. Those responses use `429 Too Many Requests` and may include `Retry-After` plus standard rate-limit headers.

No numeric limit is promised in this documentation. Limits can depend on the model, access mode, account, or deployment. Read the response headers and keep your client configurable.

## The rate-limit response

```json theme={null}
{
  "error": {
    "message": "Rate limit exceeded.",
    "type": "rate_limit_error",
    "code": "rate_limit_exceeded",
    "param": null
  }
}
```

The response may include:

* `Retry-After` — a server-provided backoff hint.
* Rate-limit headers — available quota or window information when exposed by the deployment.
* `X-Request-ID` — a correlation ID for tracing.

## Recommended backoff

1. If `Retry-After` is present, wait at least that long.
2. Otherwise use bounded exponential backoff, such as 1, 2, 4, 8 seconds.
3. Add random jitter to each delay.
4. Stop after a small number of attempts and return a recoverable error to your caller.

```javascript theme={null}
async function waitForRetry(attempt, retryAfterSeconds) {
  const serverDelay = Number(retryAfterSeconds);
  const baseDelay = Number.isFinite(serverDelay)
    ? serverDelay * 1000
    : Math.min(8000, 1000 * 2 ** attempt);
  const jitter = Math.floor(Math.random() * 250);
  await new Promise((resolve) => setTimeout(resolve, baseDelay + jitter));
}
```

## Avoid retry storms

* Limit concurrent requests in your worker pool.
* Apply backoff per operation, not once globally for all traffic.
* Do not retry a malformed request or invalid credentials.
* Prefer a queue for bursty workloads.
* Record retry count and final status for monitoring.

## Idempotency note

The current API contract does not define an idempotency-key header. Decide whether repeating a request is acceptable before retrying, especially if your application performs side effects after receiving a decision.

<Info>
  The right limit strategy is to respect server hints and remain conservative when no numeric limit is published. Do not build a client that depends on a hard-coded request-per-minute value from an example.
</Info>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.