Skip to main content

Public reads — no auth

The asset state, history, alerts and stats endpoints are public:
No Authorization header required. There is a soft per-IP rate limit (~300 req/min in production; repo default 60/min). The embed widget, the Telegram bot and the public dashboard all read through these endpoints.

Authenticated routes — JWT

User-scoped routes (subscriptions, webhooks, preferences, delivery history) require a JWT in the Authorization: Bearer <token> header:
The token is HS256, 7-day lifetime, with revocation tracked server-side in web_sessions.

How to obtain a JWT

There are two ways to get a JWT in v1: the Telegram Login Widget and the magic-link flow. The Telegram Login Widget is the primary path. Reasons:
  • Telegram is already the identity for the alert bot (@PeganaWatchBot).
  • No password storage, no email verification, no captcha.
  • One account links Telegram subscriptions, web dashboard sessions, and webhook ownership.
The magic-link flow is the alternative: POST /v1/auth/magic/mint issues a single-use link, and POST /v1/auth/magic/consume exchanges it for a JWT.
POST /v1/auth/telegram
Response:
In practice you do not call this endpoint directly. The Pegana web app embeds the Telegram Login Widget which produces and posts the signed payload.

API keys

There are no API keys in v1. If your use case needs them (server-to-server reads under a quota, key rotation, scoped permissions), open an issue: github.com/lrafasouza/pegana-replay/issues.

x402 — payment, not auth

The MCP paid tools (get_asset_history, subscribe_peg_events) use x402 instead of JWT. The MCP client opens an HTTP 402 challenge, signs a USDC transfer (via Coinbase CDP), and replays the request. No persistent credentials, no API key. See MCP paid tools — x402 for the full flow.