Statshawk Account API
Authenticated account reads. `GET /v1/account/usage` reports plan, period usage, remaining units, reset time, and analysis access. Unmetered by design so checking quota never reserves units or trips the hard cap.
Authenticated account reads. `GET /v1/account/usage` reports plan, period usage, remaining units, reset time, and analysis access. Unmetered by design so checking quota never reserves units or trips the hard cap.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/statshawk-ai:statshawk-ai-account-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Stat Engine Account API
description: 'Normalized, source-agnostic sports data API. Major competition coverage includes NBA, MLB, NFL, NHL, KBO, NCAA (basketball and football), and soccer competitions such as EPL, La Liga, Bundesliga, Serie A, Ligue 1, UCL, MLS, and FIFA tournaments. The complete canonical sport identifiers understood by the API are: `basketball`, `football`, `baseball`, `hockey`, `soccer`, `golf`, `tennis`, `racing`, `mma`, `lacrosse`, `rugby`, `volleyball`, `australian_football`, `rugby_league`, `water_polo`, and `field_hockey`. These identifiers describe data shape; call `GET /v1/competitions` for the currently registered competition slugs and `GET /v1/competitions/{comp}/capabilities` for the phases, measures, and standings tables available for a particular competition. Core resources — persons, teams, competitions/editions, contests, and entrants — carry minted ids that serialize as `_` (`per_`, `team_`, `comp_`, `edt_`, `game_`, `cst_`, `ent_`); the prefix is part of the type. Stats are typed per-phase and reconstruct as-of any ingested instant from appearance facts. ## Endpoint groups
| Group | Base path | Description |
|-------|-----------|-------------|
| Persons | `/v1/persons` | Profile, appearances, game log, memberships, season stats, per-person capability discovery, composed player overview |
| Teams | `/v1/teams` | Profile, as-of roster, games, game log, season stats |
| Competitions | `/v1/competitions` | Competitions, editions, edition participants/games/standings, capability discovery |
| Contests | `/v1/contests` | Generalized contest detail for team matches, individual matches, and field/N-ary events; team-match boxscores and sport-scoped play-by-play where available |
| Analysis | `/v1/analysis` | Player-prop card and team comparison (all plans; metered at analysis weights) |
| Account | `/v1/account` | Authenticated plan usage (unmetered — checking quota never consumes units) |
| Assets | `/v1/assets` | Team logo PNGs (proxied, 7-day cache) |
## Authentication
All endpoints in this spec require an API key passed in the `X-API-Key` request header. ## Operational endpoints
Liveness/readiness probes (`/healthz`, `/readyz`, `/metrics`) and ingest administration endpoints (`/v1/ingest/...`) are intentionally **not documented in this spec**. They are operator-only surfaces and live in a separate internal spec; see infra docs for access. ## Response envelope
Successful JSON responses wrap their payload in the following envelope. The team-logo asset endpoint returns PNG bytes instead:
```json
{
"data": {... },
"meta": {
"request_id": "uuid",
"source": "source identifier",
"fetched_at": "2025-01-01T00:00:00Z",
"cache": "HIT | MISS | STALE",
"version": "v1"
}
}
```
Error responses use `{ "error": { "code": "...", "message": "..." } }`. `meta.request_id` uniquely identifies the request — quote it when filing support tickets. `meta.cache` is reserved for response-layer caching (`HIT` / `STALE` / `MISS`); entity reads use the canonical store, with some resources cached after assembly. `HIT` or `STALE` describes the response cache, not current upstream freshness. ## Freshness
Reads are served from the canonical store, which ingest refreshes out-of-band on a per-resource cadence:
- **Live box scores** are re-ingested within minutes of in-game updates while a slate is live. - **Standings** are recomputed whenever a game in the edition finalizes. - **Schedules** are re-synced several times per day. - **Final box scores** describe completed contests, but individual credits and other statistics remain subject to later source corrections. Historical coverage can remain incomplete while out-of-band repair proceeds. `meta.fetched_at` reports response assembly time, or a cached store-fetch timestamp when the read path propagates one. Handler caches such as the stat board use response assembly time even on `HIT` or `STALE`. This field cannot reliably measure payload age and does not report the last upstream correction time.'
license:
name: ''
version: 1.0.0
contact:
name: statshawk support
email: support@statshawk.ai
url: https://statshawk.ai/contact
termsOfService: https://statshawk.ai/terms
x-versioning:
strategy: url-path
current: v1
compatibility: additive-only within a major version, except documented changelog exceptions (2026-09-11 quota hard-stop under /v1)
policy: https://statshawk.ai/docs/getting-started/versioning
x-deprecation-policy:
headers:
- Deprecation
- Sunset
minimumNoticeDays: 90
majorVersionRetirementMonths: 12
changelog: https://statshawk.ai/docs/changelog
policy: https://statshawk.ai/docs/getting-started/versioning
x-permissions:
access: read-only
apiKeyEnvironments:
- sk_live_
- sk_test_
mcpOAuthScopes:
- stats:read
- analysis:read
policy: https://statshawk.ai/docs/getting-started/permissions
servers:
- url: https://api.statshawk.ai
security:
- api_key: []
- bearerAuth: []
tags:
- name: Account
description: Authenticated account reads. `GET /v1/account/usage` reports plan, period usage, remaining units, reset time, and analysis access. Unmetered by design so checking quota never reserves units or trips the hard cap.
paths:
/v1/account/usage:
get:
tags:
- Account
summary: GET /v1/account/usage — current plan, period usage, and analysis access
description: 'Unmetered by design. A valid credential always receives 200, including
when the account is already over its hard cap.'
operationId: get_v1_account_usage
responses:
'200':
description: Current-period plan usage (unmetered; does not consume quota)
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseAccountUsage'
headers:
X-Request-Id:
$ref: '#/components/headers/X-Request-Id'
X-RateLimit-Limit:
$ref: '#/components/headers/X-RateLimit-Limit'
X-RateLimit-Remaining:
$ref: '#/components/headers/X-RateLimit-Remaining'
X-RateLimit-Reset:
$ref: '#/components/headers/X-RateLimit-Reset'
'401':
description: Missing or invalid API key
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'429':
description: Rate limit (`RATE_LIMIT_EXCEEDED`) or monthly quota (`QUOTA_EXCEEDED`).
headers:
X-Request-Id:
$ref: '#/components/headers/X-Request-Id'
X-RateLimit-Limit:
$ref: '#/components/headers/X-RateLimit-Limit'
X-RateLimit-Remaining:
$ref: '#/components/headers/X-RateLimit-Remaining'
X-RateLimit-Reset:
$ref: '#/components/headers/X-RateLimit-Reset'
Retry-After:
$ref: '#/components/headers/Retry-After'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Account store unavailable or quota ledger read failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'501':
description: Capability not supported for this competition (`NOT_SUPPORTED`).
headers:
X-Request-Id:
$ref: '#/components/headers/X-Request-Id'
X-RateLimit-Limit:
$ref: '#/components/headers/X-RateLimit-Limit'
X-RateLimit-Remaining:
$ref: '#/components/headers/X-RateLimit-Remaining'
X-RateLimit-Reset:
$ref: '#/components/headers/X-RateLimit-Reset'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'502':
description: Upstream data provider failed (`PROVIDER_ERROR`).
headers:
X-Request-Id:
$ref: '#/components/headers/X-Request-Id'
X-RateLimit-Limit:
$ref: '#/components/headers/X-RateLimit-Limit'
X-RateLimit-Remaining:
$ref: '#/components/headers/X-RateLimit-Remaining'
X-RateLimit-Reset:
$ref: '#/components/headers/X-RateLimit-Reset'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'503':
description: Database connection pool unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
ErrorDetail:
type: object
description: Machine-readable error code, human-readable explanation, and optional top-level context fields.
required:
- code
- message
properties:
code:
type: string
description: 'Stable machine-readable code; use this for program logic rather than message text.
Examples: NOT_FOUND (missing resource), BAD_REQUEST (invalid input), UNKNOWN_STAT (unknown statistic),
STAGE_NOT_SUPPORTED (unsupported stage), NOT_SUPPORTED (unsupported capability), UNAUTHORIZED (missing authentication),
INVALID_API_KEY (invalid credential), RATE_LIMIT_EXCEEDED (request rate limit),
DB_UNAVAILABLE (database pool unavailable), INTERNAL_ERROR (server failure), CACHE_ERROR (cache failure), or PROVIDER_ERROR (upstream failure).
Middleware can return additional billing or authorization codes.'
message:
type: string
description: Human-readable explanation; wording can change. Do not parse this field for an error category.
additionalProperties:
description: 'Additional structured context flattened beside code and message, with no extra wrapper key.
No additional fields appear when this map is empty. Keys depend on the error category.
On competition-resolution misses and capability gaps the canonical
machine-readable list is [`crate::leagues::AVAILABLE_COMPETITIONS`]
(`error.available_competitions`): every registered slug on `NOT_FOUND`
/ invalid-competition `BAD_REQUEST`, or the slugs that implement the
named capability on `NOT_SUPPORTED`. The engine registry is the only
source of truth — clients (including MCP) pass this array through and
must not maintain a parallel list. The human `message` may summarize.'
AccountUsage:
type: object
description: Current-period quota snapshot for the authenticated account.
required:
- tier
- units_used
- units_limit
- units_remaining
- period_reset
- analysis_unlocked
- upgrade_url
properties:
analysis_unlocked:
type: boolean
description: 'Whether the effective tier permits analysis routes. This is a plan
capability flag, not a quota check; true does not guarantee remaining units.'
example: true
configured_tier:
type:
- string
- 'null'
description: 'The plan the account is configured for when `reason` is
`billing_incomplete` or `payment_overdue`; `tier` still reports the
effective `free`.'
example: hobby
period_reset:
type: string
description: 'Exclusive end of the effective billing period as an RFC3339 UTC instant.
Uses the cached entitlement window when available, otherwise the UTC
calendar month. A stale cached window can report a past reset instant.'
example: '2026-10-01T00:00:00Z'
reason:
type:
- string
- 'null'
description: '`payment_overdue` when a paid plan''s renewal payment failed and the
account runs on Free limits until it is fixed. `billing_incomplete`
when this is a paid-tier row that fail-closed to
`free` for lack of billing linkage (`AccountContext::degraded_from`).
Absent for genuinely free and for fully-linked accounts, so those
payloads are byte-for-byte unchanged. Same marker BillingLayer puts
in `TIER_REQUIRES_PAID` data: the fix is billing setup, not an
upgrade.'
example: billing_incomplete
tier:
type: string
description: Effective plan slug (`free`, `hobby`, `pro`, …).
example: hobby
units_limit:
type: integer
format: int64
description: 'Effective period quota in billable API units. Uses the cached entitlement
cap, account cap, or tier default according to billing policy; not a request count.'
example: 25000
units_remaining:
type: integer
format: int64
description: '`max(0, units_limit - units_used - units_in_flight)`: the quota the
account has not used. `units_in_flight` is the weight of requests
whose outcome is not settled yet. Units the API has set aside for
this account''s next requests but not spent are counted as remaining;
for a short time after a restart of the API a few of them can be
unavailable to requests. `units_used` stays finalized-only.'
example: 20800
units_used:
type: integer
format: int64
description: 'Finalized billable API units consumed in the effective billing period,
not a request count. Excludes in-flight reservations. Zero when no matching ledger row exists.'
example: 4200
upgrade_url:
type: string
description: 'Always `https://app.statshawk.ai/billing` — required on every
success payload, not only near-cap. Same constant BillingLayer
uses for `TIER_REQUIRES_PAID` / `QUOTA_EXCEEDED`. MCP prefers
this over marketing `/pricing` for logged-in accounts.'
example: https://app.statshawk.ai/billing
ErrorResponse:
type: object
description: Error response body.
required:
- error
properties:
error:
$ref: '#/components/schemas/ErrorDetail'
description: Structured failure details. Error responses do not use the successful data/meta envelope.
ApiResponseAccountUsage:
type: object
description: 'Successful response envelope: resource data and request metadata.'
required:
- data
- meta
properties:
data:
$ref: '#/components/schemas/AccountUsage'
description: Resource payload returned by this endpoint, inside the success envelope.
meta:
$ref: '#/components/schemas/ResponseMeta'
description: Request identifier, source attribution, fetch timestamp and response cache state.
ResponseMeta:
type: object
description: 'Metadata block included in every API response envelope.
Reports the request identifier, read source label, response timestamp, cache outcome, and API version.
These fields do not report the upstream observation time or guarantee complete data coverage.'
required:
- request_id
- fetched_at
- cache
- version
properties:
cache:
$ref: '#/components/schemas/CacheStatus'
description: 'Uppercase response cache token: HIT (cached), MISS (uncached/cache miss), or STALE (accepted stale cache).'
fetched_at:
type: string
format: date-time
description: 'RFC 3339 UTC timestamp of response assembly, or the cached store-fetch time when a read path propagates it.
Handler caches such as the stat board retain response assembly time even on HIT or STALE.
This field cannot reliably measure payload age and is not the upstream observation/update time.
Composite reads use the last store-call cache outcome unless the handler supplies its own cache status.'
example: '2025-10-15T18:30:00Z'
request_id:
type: string
format: uuid
description: Unique identifier for this request; quote this when filing support tickets.
source:
type:
- string
- 'null'
description: 'Optional label for where the handler served data, such as `postgres` or `registry`.
Null when the handler supplied no label. This is not necessarily an upstream provider identifier.'
example: postgres
version:
type: string
description: API version string, currently always `"v1"`.
example: v1
CacheStatus:
type: string
description: 'Response cache status, serialized as an uppercase token.
`HIT` means a relevant store read or handler response cache returned a cached payload; `MISS` means a cache miss or an uncached read.
`STALE` means a cached payload passed its fresh TTL but remains inside the allowed stale interval. It does not guarantee a refresh has started. Current entity-store caching records HIT or MISS.
Composite reads report the last store-call outcome; this does not prove every nested resource shares one fetch time.'
enum:
- HIT
- MISS
- STALE
headers:
X-RateLimit-Remaining:
description: Requests remaining in the current rate-limit window.
schema:
type: integer
X-RateLimit-Reset:
description: Unix timestamp (seconds) when the current rate-limit window resets. On quota responses, the billing-period end.
schema:
type: integer
X-RateLimit-Limit:
description: Maximum requests allowed in the current rate-limit window.
schema:
type: integer
Retry-After:
description: 'Seconds to wait before retrying. Sent on every `429` (per-second limiter: effectively always `1`; monthly quota: seconds until the period resets).'
schema:
type: integer
X-Request-Id:
description: Request correlation id (also echoed in `meta.request_id` on success).
schema:
type: string
format: uuid
securitySchemes:
api_key:
type: apiKey
in: header
name: X-API-Key
description: Raw API key (`sk_live_…` or `sk_test_…`). Preferred for REST clients. Keys are read-only; the environment prefix is the only key role. See https://statshawk.ai/docs/getting-started/permissions
bearerAuth:
type: http
scheme: bearer
bearerFormat: API key
description: 'Same API key as a bearer token: `Authorization: Bearer sk_live_…` (scheme required).'