API
Two HTTP surfaces over one Go implementation — the byte-compatible /api and the described /api/v2 — and where to look up either.
StatsHub exposes its data over HTTP from apps/statshub-api, a Go
service that is a route-for-route port of the 218 Next.js route files it
replaced. It serves the same data twice:
| Prefix | What it is |
|---|---|
/api | The original surface. Byte-compatible with the Next.js routes it was ported from, untyped bodies, four different error envelopes. Existing clients depend on all of it. |
/api/v2 | The same 298 operations through typed Go structs, one application/problem+json error model, and an OpenAPI document generated from those types. |
Endpoint reference
Every documented operation, generated from the handler that serves it. Includes a playground.
OpenAPI and /api/v2
How the types are recovered from the Go handlers, and what the generator deliberately leaves open.
Value Bets V2
The prose reference for the endpoint most integrations start with.
Parity stack
Running both implementations against one database to compare them.
Base URL
https://statshub.com/apiLocally that is http://localhost:8080/api when you run bun run dev:api.
Authentication
Most endpoints are open. Those that are not resolve a Supabase session through
internal/auth; the endpoint reference marks which.
Some write endpoints are unauthenticated on purpose
PUT /api/admin/bot-routing and POST /api/bot/telegram have no
authentication, in the original Next.js routes and in the Go port. That was
kept faithful rather than fixed silently, and each is flagged in the handler's
own doc comment — which is what the generated reference shows.
Responses
On /api, a successful body is whatever the original route returned, and a
failure is one of four envelopes: {message}, {error}, or {message, error}
with error as either an object or a string. internal/httpx documents that
distinction as load-bearing for existing clients.
On /api/v2, every failure is application/problem+json carrying the same
text, so a client has one error shape to handle instead of four.
Treat any non-2xx as a failure and log both the status code and the body before retrying.
Machine-readable
https://statshub.com/api/v2/openapi.json served by the API
/openapi.json the copy this site builds from
/statshub.postman_collection.json a Postman collection