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

# Rate Limits

> How the v2 API throttles requests and interview-invite sends, and how to retry politely

The v2 API applies two limits, both scoped **per organization** — every API key issued to the same org draws from the same buckets:

1. **Request rate limits** — a ceiling on how many API calls you make, in a burst (per-minute) and sustained (per-hour) window.
2. **Interview invite budgets** — a ceiling on how many interview invites you can *send*, across four windows (per-minute, per-hour, daily, monthly).

The two are not independent: both read the same organization settings. The request limits and the invite budget's burst and sustained windows use the same `rate_limit_burst` and `rate_limit_sustained` values, so a change to those settings changes both. They are counted in separate buckets, so API calls don't use up invite sends and invite sends don't use up API calls.

Both surface as **HTTP `429`** with a `Retry-After` header and `code: "rate_limited"` in the body. They have different response shapes, described below — including what happens when the limiter itself is briefly unavailable (`X-RateLimit-Degraded` on ordinary requests, `503 rate_limit_unavailable` on invite sends).

> [!NOTE]
>
> Limits are enforced against the organization, not the individual API key. Spreading load across multiple keys does **not** raise your ceiling.

***

## Invalid API keys

A request with a key Classet does not recognise returns `401`. Two limits stop that from being repeated without end. Both answer `429` with `Retry-After` and `code: "rate_limited"`, before the key is checked.

* **Per key.** After 10 rejections of the same key in a minute, that key is refused for the rest of the minute, from any address. Fix the key; retrying will not help.
* **Per address.** An address may present 300 keys a minute that Classet does not know to be valid. This only matters to a caller trying many different keys.

```json theme={null}
{
  "error": "This API key was rejected too many times; check the key before retrying",
  "code": "rate_limited",
  "request_id": "9f6a2c1e-4b3d-4a8e-9f2a-7c1d0e5b6a3f",
  "retry_after": 41
}
```

A key that has not been checked yet (new, or unused for a day) may have 30 requests in flight at once. Beyond that, the extra requests get `429` with `retry_after: 1` and the message "has not been verified yet"; this is not a verdict on the key, and it stops as soon as one request authenticates.

A key that has worked in the last 24 hours is exempt from both limits, wherever the request comes from, so another caller on your address cannot use up a budget you depend on. A key that has not been used for more than a day can receive the per-address `429` while its address is over the limit; wait for `Retry-After` and send it again.

## Request rate limits

Every authenticated `/v2/*` request counts against your org's request budget. `GET /v2/health`, `GET /v2/openapi.json`, and `GET /v2/docs` are exempt.

The v2 request bucket is isolated from the legacy v1 request bucket, even when both services use the same Redis deployment. v2 traffic therefore cannot consume v1 request quota. Interview invite budgets remain shared intentionally across API and dashboard send surfaces so the organization-wide send cap cannot be bypassed.

Rate limits are set per organization: a burst limit per minute and a sustained limit per hour, shared by all of the organization's API keys. Your current values are `data.limits.rate_limit_burst` and `data.limits.rate_limit_sustained` in [`GET /v2/organization`](/docs/api-reference/organization/get-organization); `null` means your organization uses the platform default. A `429` response carries `Retry-After` and `X-RateLimit-*` headers.

| Window | Setting | Resets |
| - | - | - |
| Burst | `rate_limit_burst` requests per minute | Rolling 60-second window |
| Sustained | `rate_limit_sustained` requests per hour | Rolling 1-hour window |

To change your organization's limits, contact Classet support at [success@classet.ai](mailto:success@classet.ai).

### If you poll

Repeated list calls are the usual way to run into the request limit. Instead of re-reading whole lists on a timer, fetch only what changed with `updated_since` (see [Pagination and delta sync](/docs/guides/pagination-and-delta-sync.md)), and let [webhooks](/docs/guides/webhooks.md) tell you when an interview or application changes.

### Response headers

When request rate limiting is active, every response carries these headers so you can track your remaining budget without waiting for a `429`:

| Header | Description |
| - | - |
| `X-RateLimit-Limit` | The limit for the window being reported |
| `X-RateLimit-Remaining` | Requests left before you hit the cap |
| `X-RateLimit-Used` | Requests consumed in the current window |
| `X-RateLimit-Reset` | Unix epoch (seconds) when the window resets |
| `X-RateLimit-Window` | Length in seconds of the window being reported: `60` for burst, `3600` for sustained |
| `X-RateLimit-Degraded` | **Only when degraded** — `true` means the limiter was unreachable and this request was **not** rate-limited (see below) |
| `Retry-After` | **Only on `429` / `503`** — seconds to wait before retrying |

### Degraded mode (`X-RateLimit-Degraded`)

If the rate-limit backend is briefly unreachable, ordinary API requests **fail open**: they are served normally rather than being blocked by our infrastructure issue. Those responses carry `X-RateLimit-Degraded: true` and **omit** the usual `X-RateLimit-*` budget headers (there's no live count to report).

Treat the header as a signal to self-throttle: your budget wasn't debited, but it also wasn't checked — keep to your normal pace rather than opportunistically bursting. Degraded mode is transient and clears on its own.

> [!NOTE]
>
> Interview invite sends are the exception — they **fail closed** instead. See [When the invite limiter is unavailable](#when-the-invite-limiter-is-unavailable-503) below.

### 429 response body

```json theme={null}
{
  "error": "Rate limit exceeded",
  "code": "rate_limited",
  "request_id": "9f6a2c1e-4b3d-4a8e-9f2a-7c1d0e5b6a3f",
  "message": "You have exceeded your rate limit of 1000 requests per hour",
  "retry_after": 42,
  "limit": 1000,
  "remaining": 0,
  "reset_at": "2026-06-27T18:00:00.000Z"
}
```

| Field | Type | Description |
| - | - | - |
| `error` | string | Always `Rate limit exceeded` |
| `code` | string | Always `rate_limited` |
| `request_id` | string | Matches the `X-Request-Id` response header |
| `message` | string | Human-readable explanation |
| `retry_after` | number | Seconds until the exceeded window resets (mirrors the `Retry-After` header) |
| `limit` | number | The limit you exceeded |
| `remaining` | number | Always `0` on a `429` |
| `reset_at` | string | ISO 8601 timestamp when the window resets |

***

## Interview invite budgets

Sending an interview invite is metered separately from ordinary API traffic. The following endpoints each reserve **one** invite slot before any candidate or call record is created:

* `POST /v2/candidates` (when `send_sms` or `send_email` is set)
* `POST /v2/candidates/:id/interview`
* `POST /v2/calls` (deprecated v1 alias)

These share the same budget as dashboard single-send and CSV campaign sends. If a window is exhausted, the API returns `429` **before** creating the candidate/call — so a rejected send never leaves an orphaned record behind.

### The four windows

A send is checked against all four windows in order; the **first** one that would be exceeded is the one reported.

| Window | `exceeded_window` value | Source | Resets |
| - | - | - | - |
| Burst (per-minute) | `burst` | `rate_limit_burst` | Top of each minute |
| Hourly (sustained) | `sustained` | `rate_limit_sustained` | Top of each hour |
| Daily | `daily` | `daily_interview_invite_cap` | Midnight UTC |
| Monthly | `monthly` | `monthly_interview_invite_cap` | 1st of the month (UTC) |

> [!NOTE]
>
> The burst and hourly caps use the same `rate_limit_burst` and `rate_limit_sustained` values as the request limits; read yours from [`GET /v2/organization`](/docs/api-reference/organization/get-organization). The **daily** and **monthly** caps are **unset by default** (no limit) and only apply once your org has a `daily_interview_invite_cap` / `monthly_interview_invite_cap` configured. The hourly window reports as `sustained` — that is the literal value in the `exceeded_window` field.

### 429 response body

```json theme={null}
{
  "error": "Interview invite limit exceeded",
  "code": "rate_limited",
  "request_id": "9f6a2c1e-4b3d-4a8e-9f2a-7c1d0e5b6a3f",
  "message": "This interview invite would exceed your daily send limit of 500. You've already used your full daily allowance. This limit resets at midnight UTC. Need a higher limit? Contact Classet support.",
  "exceeded_window": "daily",
  "limit": 500,
  "retry_at": "2026-06-28T00:00:00.000Z"
}
```

| Field | Type | Description |
| - | - | - |
| `error` | string | Always `Interview invite limit exceeded` |
| `code` | string | Always `rate_limited` |
| `request_id` | string | Matches the `X-Request-Id` response header |
| `message` | string | Human-readable explanation including the window, remaining allowance, and reset hint |
| `exceeded_window` | string | One of `burst`, `sustained`, `daily`, `monthly` |
| `limit` | number | The cap for the exceeded window |
| `retry_at` | string | ISO 8601 timestamp when that window resets |

The `Retry-After` header is also set (in seconds) whenever `retry_at` is present.

### When the invite limiter is unavailable (503)

Invite sends **fail closed**: if the rate-limit backend is unreachable, the send is rejected rather than allowed to silently bypass your caps. The invite endpoints return **`503`** with `code: "rate_limit_unavailable"` and a `Retry-After` header:

```json theme={null}
{
  "error": "Invite rate limiting is temporarily unavailable",
  "code": "rate_limit_unavailable",
  "request_id": "9f6a2c1e-4b3d-4a8e-9f2a-7c1d0e5b6a3f"
}
```

No invite slot is consumed and no candidate or call record is created — the request had no effect. This is a transient infrastructure condition on our side, not a limit you exceeded: wait `Retry-After` seconds (typically 30) and retry the same request, ideally with an [`Idempotency-Key`](/docs/guides/idempotency).

***

## Retrying politely

When you receive a `429`, **honor the `Retry-After` header** rather than retrying immediately. It tells you exactly how many seconds to wait for the exceeded window to reset. Both limit types set it, so a single helper covers both.

```typescript Node.js (fetch) theme={null}
const API_BASE = "https://api.classet.ai/v2";
const MAX_RETRIES = 3;

const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));

async function requestWithRetry(
  path: string,
  init: RequestInit,
  attempt = 0
): Promise<Response> {
  const res = await fetch(`${API_BASE}${path}`, {
    ...init,
    headers: { "X-API-KEY": process.env.CLASSET_API_KEY!, ...init.headers },
  });

  if (res.status !== 429) return res;

  if (attempt >= MAX_RETRIES) {
    throw new Error(`Rate limited after ${MAX_RETRIES} retries: ${path}`);
  }

  // Prefer the server's hint; fall back to exponential backoff if absent.
  const retryAfter = Number(res.headers.get("Retry-After"));
  const waitSeconds = Number.isFinite(retryAfter) && retryAfter > 0
    ? retryAfter
    : 2 ** attempt;

  console.warn(`429 on ${path} — waiting ${waitSeconds}s before retry ${attempt + 1}`);
  await sleep(waitSeconds * 1000);

  return requestWithRetry(path, init, attempt + 1);
}

// Example: send an interview invite, retrying if a budget window is exhausted.
const res = await requestWithRetry("/candidates", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    first_name: "Jordan",
    last_name: "Rivera",
    phone: "+15555550123",
    job_id: "k7Hq2xVbN",
    send_sms: true,
  }),
});

if (res.ok) {
  const { data } = await res.json();
  console.log("Invite sent for candidate", data.candidate_id);
}
```

```python Python (requests) theme={null}
import os
import time
import requests

API_BASE = "https://api.classet.ai/v2"
MAX_RETRIES = 3

def request_with_retry(method, path, **kwargs):
    headers = {"X-API-KEY": os.environ["CLASSET_API_KEY"], **kwargs.pop("headers", {})}

    for attempt in range(MAX_RETRIES + 1):
        res = requests.request(method, f"{API_BASE}{path}", headers=headers, **kwargs)

        if res.status_code != 429:
            return res

        if attempt == MAX_RETRIES:
            raise RuntimeError(f"Rate limited after {MAX_RETRIES} retries: {path}")

        # Prefer the server's hint; fall back to exponential backoff if absent.
        retry_after = res.headers.get("Retry-After")
        wait_seconds = int(retry_after) if retry_after and retry_after.isdigit() else 2 ** attempt

        print(f"429 on {path} — waiting {wait_seconds}s before retry {attempt + 1}")
        time.sleep(wait_seconds)

# Example: send an interview invite, retrying if a budget window is exhausted.
res = request_with_retry(
    "POST",
    "/candidates",
    json={
        "first_name": "Jordan",
        "last_name": "Rivera",
        "phone": "+15555550123",
        "job_id": "k7Hq2xVbN",
        "send_sms": True,
    },
)

if res.ok:
    print("Invite sent for candidate", res.json()["data"]["candidate_id"])
```

> [!TIP]
>
> A daily or monthly invite budget can take hours — or days — to reset. Inspect `exceeded_window` before blindly sleeping on `Retry-After`: for a `daily` or `monthly` window, the right move is usually to **queue the remaining sends and resume later**, not to hold the request open. Only `burst` and `sustained` windows are short enough to wait out in-process.

> [!WARNING]
>
> Never retry a `429` in a tight loop without backoff. Hammering an exhausted window won't get your invite through any faster and only adds load. Always wait at least `Retry-After` seconds.

***

## Best practices

* **Watch the `X-RateLimit-Remaining` header** and slow down proactively instead of waiting for a `429`.
* **Batch where you can** — prefer one paginated `GET` over many small ones.
* **Treat invite budgets as a queue depth.** When sending at scale, drip sends out to stay under your per-minute (`burst`) and per-hour (`sustained`) windows rather than firing them all at once.
* **Need higher limits?** Daily and monthly invite caps, plus the request burst/sustained ceilings, are configurable per organization. Contact [Classet support](mailto:success@classet.ai).


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