# Errors

> Codes, body shape and what to do about each.

Source: https://croombit.com/en/docs/api-errors

Every error is built to get you unblocked, not just to name the problem: `{ code, message, hint?, issues? }` — the `hint` says exactly how to fix it, and `issues` points at the offending field.

| HTTP | code | Common cause |
| --- | --- | --- |
| 401 | `unauthenticated` | Missing API key, malformed, revoked, or the prefix disagrees with the stored type/mode. |
| 403 | `forbidden` | `pk_` key on an `sk_` endpoint, Origin not allowed, or insufficient role. |
| 401 | `key_expired` | The key passed its expiry date. Create or rotate one. |
| 403 | `secret_key_required` | A `pk_` key tried to record a consent with `source` `IMPORT` or `MIGRATION`, or with `ip` / `userAgent`. Call it from your server with an `sk_` key. |
| 403 | `insufficient_scope` | The secret key is restricted to other scopes. See Console → Sites & API keys. |
| 403 | `ip_not_allowed` | The secret key has an IP allowlist and this request came from elsewhere. |
| 403 | `origin_not_verified` | LIVE `pk_` key, Origin on a domain that is not verified yet. |
| 404 | `not_found` | The subject/resource does not exist (read endpoints do not create subjects). |
| 409 | `idempotency_key_reused_with_different_body` | Same `Idempotency-Key`, different body. |
| 422 | `validation_failed` | The body fails the Zod schema — see `issues`. |
| 429 | `rate_limited` | This API key (or your IP) exceeded its request budget. Wait `Retry-After` seconds — see Rate limits below. |
| 429 | `quota_exceeded` | Hobby: the month’s included events plus the 20% grace are used up (LIVE writes only). Upgrade to keep recording. |
| 429 | `spending_ceiling_reached` | Starter/Pro: the overage ceiling you set yourself is reached (+20% grace). Raise or remove it in the console. |

## Rate limits

Each API key has its own request budget per second and per minute, set by your plan and shared by every server, browser or app using that key. Secret (`sk_`) keys carry your server-to-server calls; publishable (`pk_`) keys carry every visitor’s banner and preference reads, so their budget is much larger. A per-IP limit applies on top: 20/s · 300/min per IP in general, and 250/s · 6,000/min per IP for `/v1` calls made with an `sk_` key (counted separately, and above every plan’s per-key budget), so one backend or NAT sending all your server traffic is held only by its keys’ budgets.

| Plan | `sk_` keys | `pk_` keys |
| --- | --- | --- |
| Hobby | 10/s · 60/min | 50/s · 1,200/min |
| Starter | 50/s · 600/min | 200/s · 6,000/min |
| Pro | 100/s · 1,500/min | 500/s · 15,000/min |
| Scale | 200/s · 3,000/min | 1,000/s · 30,000/min (raised per contract) |

Every `/v1` response tells you where you stand: `RateLimit-Limit` (requests allowed in the current window), `RateLimit-Remaining` and `RateLimit-Reset` (seconds until the window resets). Past the budget you get `429` with `{ "code": "rate_limited" }` and a `Retry-After` header — wait that many seconds and retry. To send lots of records, use `POST /v1/consent/batch` instead of one call per record.