Docs

Errors

Codes, body shape and what to do about each.

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.

HTTPcodeCommon cause
401unauthenticatedMissing API key, malformed, revoked, or the prefix disagrees with the stored type/mode.
403forbiddenpk_ key on an sk_ endpoint, Origin not allowed, or insufficient role.
401key_expiredThe key passed its expiry date. Create or rotate one.
403secret_key_requiredA 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.
403insufficient_scopeThe secret key is restricted to other scopes. See Console → Sites & API keys.
403ip_not_allowedThe secret key has an IP allowlist and this request came from elsewhere.
403origin_not_verifiedLIVE pk_ key, Origin on a domain that is not verified yet.
404not_foundThe subject/resource does not exist (read endpoints do not create subjects).
409idempotency_key_reused_with_different_bodySame Idempotency-Key, different body.
422validation_failedThe body fails the Zod schema — see issues.
429rate_limitedThis API key (or your IP) exceeded its request budget. Wait Retry-After seconds — see Rate limits below.
429quota_exceededHobby: the month’s included events plus the 20% grace are used up (LIVE writes only). Upgrade to keep recording.
429spending_ceiling_reachedStarter/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
Hobby10/s · 60/min50/s · 1,200/min
Starter50/s · 600/min200/s · 6,000/min
Pro100/s · 1,500/min500/s · 15,000/min
Scale200/s · 3,000/min1,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.