Documentation

Errors, Pagination and Rate Limits

Pagination parameters, status and error codes, rate-limit buckets, per-endpoint limits and rate-limit headers.

Request conventions are described in Making Requests.

Pagination

ParameterDefaultDescription
page11-based page number
page_size20Items per page. Maximum 100
sort_bynoneField to sort by. Endpoint-specific
sort_orderascasc or desc

total_items counts the records paged over, not the items returned. An endpoint that filters after paging can return a short or empty page while later pages still hold items. Continue while current_page < total_pages.

Status and error codes

Every error body has errors and message, and most have a code. A refusal that carries structured data, such as the amount owed on a 402, adds details. Branch on the status first and on code where there is one: many 400, 403, 404 and 409 responses carry no code, and their message is written for a person.

StatuscodeMeaning
400none, or invalid_valueThe request is well formed but refused: a value out of range, a state that does not allow the action
401varies, e.g. invalid_credentialsMissing, invalid or expired token. Refresh or sign in again
402payment_requiredThe action needs a payment. details carries the amount and currency
403insufficient_scopesThe token lacks a scope the endpoint requires
403noneThe token's user has no role that allows this
403forbidden_not_authorizedThe caller is the wrong actor: admitting somebody else without the authority
404none, or a specific code belowNot found
409none, or a specific code belowConflicts with the current state
410resync_requiredA check-in manifest delta is too far behind; fetch the full manifest
422validation_errorThe body or parameters failed the schema. errors maps each field to its message
429rate_limit_exceededSee Retry-After
500internal_errorError on Davi's side
502upstream_unavailableA service Davi depends on did not answer. Retry later

A record you cannot see answers 404 on some endpoints and 403 on others, depending on whether the record's existence is checked first. Treat both as "not available to this token".

An unknown path or a method a path does not take answers FastAPI's own { "detail": "..." } instead of the envelope.

The OAuth 2.0 endpoints add the RFC 6749 fields, error and error_description, to the same envelope. A 429 from them carries only the envelope.

Specific codes

codeStatusRaised when
identifier_unresolved404The supplied identifier matched no wallet or user
idempotency_conflict409An admit's idempotency key was reused for a different person
already_checked_in409Two admits for the same person raced, and this one lost
forbidden_not_authorized403Admitting somebody else without the authority to do so

POST /sessions/{session_slug}/admit does not use error statuses for refusals at the door. Every gate that turns somebody away, including closed doors and hours, answers 200 with decision: "blocked" and a blocked_reason. See Run Activities and Check-ins for the statuses it does return.

Rate limits

Requests are counted over a sliding window: an allowance refills continuously rather than resetting on the minute. Authenticated buckets are keyed on user and client together, so traffic from another application the same user has authorized does not count against yours.

BucketLimit
Reads300 / minute
Writes60 / minute
Expensive20 / minute
Unauthenticated30 / minute, per IP and per path

Expensive operations

The expensive bucket is a fixed list of routes, reads among them:

RouteChargedReason
POST /sessions/{session_slug}/admitper callRecords attendance at a door
POST /rewards/{reward_slug}/claimper callLedger write
POST /rewards/{reward_slug}/redeemper callLedger write
POST /rewards/{reward_slug}/propagateper callLedger write
POST /rewards/{reward_slug}/triggerper callLedger write
POST /organizations/{organization_slug}/cardsper itemTakes cards into inventory, up to 20 per call
PATCH /organizations/{organization_slug}/membership-tiers/{tier_uuid}per callCan reprice every membership on the tier
POST /organizations/{organization_slug}/membership-tiers/{tier_uuid}/memberships/moveper callMoves every membership on the tier
POST /activities/{activity_slug}/sessions/batchper callCreates a run of sessions in one statement
GET /users/searchper callSearches every account
GET /sessions/{session_slug}/checkin-manifestper callBuilds the offline door manifest
GET /sessions/{session_slug}/checkin-manifest/displayper callBuilds the offline door manifest
GET /sessions/{session_slug}/checkin-manifest/deltaper callBuilds the offline door manifest

POST /organizations/{organization_slug}/cards is the only endpoint charged per item: twenty cards in one request spend twenty of the expensive allowance. The batch cap and the bucket are both 20, so one full batch uses the whole minute's allowance. A session batch is one charge however many dates it creates.

Per-endpoint overrides

These endpoints have their own limits in addition to the buckets. Where both apply, the tighter one decides.

EndpointLimitKeyed on
POST /oauth2/token20 / minuteclient_id + IP
POST /oauth2/token (failed auth)5 / minuteIP
GET /oauth2/authorize60 / minuteIP
POST /oauth2/introspect100 / minuteclient_id
POST /oauth2/revoke30 / minuteclient_id
Ledger writes signed by one wallet100 / hourThe sending wallet

Rewards are sent from the issuing organization's wallet, so every redemption an organization issues, from any integration and the dashboard alike, shares that organization's 100 an hour.

Headers

Every successful response carries these headers, as does a 429 from a bucket:

HeaderMeaning
RateLimit-LimitThe bucket's allowance
RateLimit-RemainingWhat is left in the current window
RateLimit-ResetOn a 429, seconds until a request will be allowed. Otherwise the window length
RateLimit-PolicyThe policy, e.g. 300;w=60
Retry-AfterOn a 429 only. Seconds to wait

The same values are also sent under the older X-RateLimit-* names. An error response other than a 429 carries none of them, and a 429 from a per-endpoint limit carries only Retry-After.

A 429 is refused before the request runs. Retrying after Retry-After needs no reconciliation of state.

Caching an access token for its lifetime, rather than requesting one per call, is the largest saving on the token endpoint's allowance.

Next