The OpenAPI spec is assembled from utoipa annotations on the axum handlers and
covers the full
/v1 surface (39 paths, enforced in CI). It’s the source of
truth the first-party TypeScript and Python SDKs are generated from.Base URL
Authentication
Most endpoints are public — noAuthorization header required. The user-scoped
routes (anything under /v1/me/*, plus /v1/auth/logout) require a JWT obtained via
Telegram Login. See authentication.
Rate limit
Soft sliding window: 300 req/min per IP on REST. WebSocket allows 5 concurrent connections per IP. Liveness / readiness probes are exempt. Hit the limit? Emailrafael@pegana.xyz.
Cross-origin
CORS allowed frompegana.xyz, www.pegana.xyz, localhost:3000 by default.
Self-hosted instances can extend via CORS_EXTRA_ORIGINS.
Errors
Standard HTTP codes. Error bodies are{"error": "...", "message": "..."} — short,
machine-readable.
SDKs
First-party typed clients — TypeScript (@peganahq/sdk-ts) and Python
(pegana-sdk) — are generated from the OpenAPI spec above and cover every /v1
endpoint, plus a hand-written live-feed WebSocket helper (PegFeed / peg_feed).
openapi-typescript + openapi-fetch
for TypeScript, openapi-python-client for Python; orval also works).
Quick links
Read one state
GET /v1/assets/:asset/state — the canonical read.Stream live
wss://api.pegana.xyz/v1/ws — sub-second push.