Skip to content

Errors

The RFC 9457 problem document every Betwatch API failure returns, and what each error code means.

Every failure — a bad filter, a missing race, an exhausted quota, a bug on our side — returns the same shape. Write one error handler and you have handled the whole API.

HTTP/1.1 422 Unprocessable Entity
Content-Type: application/problem+json
{
  "type": "https://docs.betwatch.com/api/errors#filter_required",
  "title": "Unprocessable Entity",
  "status": 422,
  "code": "filter_required",
  "detail": "Odds requests need an event, entrant, meeting, or venue filter. Discover events with /v2/events first, then request their prices.",
  "instance": "/v2/odds",
  "requestId": "01K3F9QW2H7YB4NPX8VJDT6MRC",
  "traceId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
Member What it is for
code Branch on this. A stable, machine-readable label.
status The HTTP status, repeated in the body for convenience.
title Short summary of the problem type. Prose — do not match on it.
detail What went wrong with this request, in a sentence you can show a human. Prose.
type A URI that resolves to this page, anchored at the code.
instance The path that failed.
requestId, traceId Quote these when you contact support and we can find your exact request.
errors Present on validation failures: one entry per field, with message, location, and the value we received.

code is part of the contract, and the full list below is in the OpenAPI document as an enum on PublicProblem.code — you can generate your error types from it rather than transcribing this page. New codes can appear as the API grows, so still treat one you do not recognise as “an error of this HTTP status class” rather than failing hard. Existing codes will never be removed or repurposed.

Validation failures name the field

{
  "type": "https://docs.betwatch.com/api/errors#invalid_request",
  "title": "Unprocessable Entity",
  "status": 422,
  "code": "invalid_request",
  "detail": "validation failed",
  "errors": [
    { "message": "unexpected query parameter", "location": "query.eventId", "value": "evt_7Kd2mQx4TnPbW9sVfHjLcR" }
  ]
}

Unknown query parameters are rejected rather than ignored. If you misspell event as eventId, the honest answer is a 422 — silently answering a question you did not ask would hand you a page of the wrong races and no way to notice.

Credentials and entitlement

authentication_required

401 — no X-API-Key header, an invalid or revoked key, or a credential in the query string. Check the header name and that the key has not been revoked. See Authentication.

scope_required

403 — your key’s plan does not grant the scope this endpoint needs, most often stream. See Scopes.

plan_required

403 — the key is valid but no active API product is attached to the account. Start or renew a plan at Account → API.

entitlement_empty

403 — the plan grants no sports or countries, so there is no data any read could return. This is a subscription problem, not a filter problem; contact support if you expect data access.

account_disabled

403 — an operator has temporarily suspended API access for this account, usually after traffic that threatened service for everyone. Your keys are intact. Contact support; this is meant to be undone.

ip_not_allowed

403 — the key is limited to an IP allowlist and the request came from an address outside it. Keys have no allowlist unless one was agreed with support; contact us to change it.

Budgets

rate_limited

429 — you exceeded the short-window limit for this class of request. Retry after the number of seconds in the Retry-After header. See Rate limits.

quota_exceeded

429 — the monthly request quota is spent. Do not retry: it resets at the boundary in X-RateLimit-Monthly-Reset, which may be weeks away. Fail fast, alert, and upgrade the plan.

quota_unavailable

503 — we could not read the quota counter, so the request was refused rather than served unmetered. Retry with backoff.

Request shape

invalid_request

400 or 422 — the request does not satisfy the contract: an unknown query parameter, a malformed value, a bad type. errors names the field.

invalid_filter

422 — a filter value is well-formed JSON but not valid here: an id whose shape does not match its resource, an unknown sport or source, a limit outside 1–200, both after and before at once, a startFrom after its startTo, or a cursor belonging to a different collection.

filter_required

422 — the endpoint refuses an unscoped read. /v2/odds needs event, entrant, meeting, or venue; /v2/entrants needs event or competitor. detail says which. Discover with /v2/events first.

not_found

404 — no such resource, or it is outside what your plan can see. These are deliberately indistinguishable: whether a race exists is not something an unentitled key gets to learn.

method_not_allowed

405 — the path exists but not with that method. The public API is read-only; everything is GET.

unsupported_media_type

406 or 415 — we cannot produce or accept the media type you asked for. Send Accept: application/json.

Streaming

stream_unavailable

503 — the stream cannot serve you right now, either because replay state is momentarily unavailable or because concurrency enforcement is down. Retry with backoff. Also returned by GET /v2/events/{id}/snapshot when it cannot mint a stream cursor: the snapshot fails rather than hand you a bootstrap that would silently miss changes.

stream_limit

429 — you are at your plan’s concurrent-stream limit. Close a connection before opening another. One filtered stream can cover many races; you rarely need one per race.

cursor_expired

409 — the cursor is older than your plan’s replay window, or is not usable any more. Bootstrap again over REST and reconnect with the cursor that response returned.

cursor_scope_changed

409 — the cursor was minted for a different filter set, entitlement, or account. Cursors are not portable between scopes: reconnect with the same filters you bootstrapped with, or bootstrap again.

A snapshot (GET /events/snapshot or GET /events/{id}/snapshot) can also return it when a race moved in or out of your filters and the change has not reached the stream yet. The API waits about a second for that before answering, so retry the snapshot after a short pause.

Ours, not yours

internal_error

500 — a bug on our side. Retry once with backoff; if it persists, send us requestId and traceId.

unavailable

503 — a dependency is briefly unavailable. Retry with backoff.

Retrying, in one table

code Retry?
rate_limited Yes, after Retry-After.
quota_unavailable, stream_unavailable, unavailable, internal_error Yes, with exponential backoff.
quota_exceeded No. Wait for the monthly reset or upgrade.
cursor_expired, cursor_scope_changed Not as-is. Bootstrap over REST, then reconnect.
authentication_required, scope_required, plan_required, entitlement_empty, account_disabled, ip_not_allowed No. Nothing about the request will change the answer.
invalid_request, invalid_filter, filter_required, not_found, method_not_allowed, unsupported_media_type No. Fix the request.
Navigation

Type to search…

↑↓ navigate↵ selectEsc close