Skip to content

Authentication ​

All API requests to FAST require authentication. The method depends on the caller type.

API Keys ​

Every tenant receives three credentials during onboarding:

KeyPrefixPurposeWhere to use
Server API Keykey-...Server-side access (bets, purchases, withdrawals, minting user tokens; the admin API only with the admin scope)Your backend only
Public Widget Keypk_...Tenant-level reads only (tiers, terms, leaderboard, loyalty tiers, widget config)Frontend / embedded widget (safe to expose)
Webhook Secret(64-character hex string, no prefix)HMAC-SHA256 verification of inbound webhooks and approval callsYour backend

You start with a staging tenant for testing. When ready, a production tenant is created with fresh keys.

bash
# Backend .env: server key and webhook secret never reach the browser
FAST_API_KEY=key-abc123...
FAST_WEBHOOK_SECRET=9f2c4e...a71b   # 64 hex characters
# public key is the ONLY credential that may appear in frontend HTML
FAST_WIDGET_KEY=pk_xyz789...

Using the server API key ​

Pass the key in the X-API-Key header on every request:

X-API-Key: key-your-production-key

The server key runs the full server-to-server flow and can act on any user in your tenant. What else it can do is its scope:

  • integration, the default on a production tenant: everything your sportsbook backend sends and reads (bets, purchases, withdrawals, progress, user tokens). The admin API answers 403 insufficient_scope: everything under /v1/admin/* (GDPR export and erase among it), the audit log and its export (/v1/audit/*) and the analytics reports (/v1/analytics/*).
  • admin, the default on a staging tenant: the admin API too (payout decisions, rulesets, tiers, settings, audit log, analytics).

Payout decisions and rule changes belong in the backoffice, behind a login with a one-time code, so a key leaked from your bet integration cannot approve a payout. If you automate admin tasks from your own server, ask FAST to give your production key the admin scope. The backoffice shows the scope under Settings, Tenant Info. A rotated key stops working at once, on every API instance.

Public widget key: what it can and cannot do ​

The pk_... key is embedded in the browser, so it is public and shared by every visitor. It therefore grants tenant-level reads only:

  • GET /v1/challenge-tiers, GET /v1/challenge-tiers/:id/terms
  • GET /v1/leaderboard (anonymized)
  • GET /v1/loyalty/tiers
  • GET /v1/widget/config
  • GET /v1/tournaments, GET /v1/tournaments/:id/leaderboard

The public key cannot, on its own:

  • access any /v1/users/:id/* resource (returns 403; user data needs a user token)
  • ingest bets (POST /v1/bets, /bets/batch are server-key only)
  • call anything outside the widget's own list: the admin, analytics, audit, reconciliation and staging endpoints all return 403 forbidden

To read or act on a specific user from the browser, the request must additionally carry a user token that is bound to that user. Even with one, the widget reaches only the user endpoints the widget itself uses: progress, history, withdrawable, achievements, rewards, bonuses, missions and loyalty to read; purchase, withdraw, continue, challenge refund-stake, the two cancels, reward claim, mission and tournament join and bonus activation to act. Everything else, such as the funded own stake refund, the timeline or payout request history, needs your server key.

Key security ​

Keys are stored as SHA-256 hashes. FAST never stores plaintext keys. If a key is compromised, request rotation through the super admin console or contact support@fundedfast.eu.

User Token ​

A user token binds a browser request to one specific userId. It is how the plug-and-play widget makes user-scoped calls without shipping a powerful key to the browser.

Your backend mints it (after it has authenticated the player in its own session) using the server key:

bash
curl -X POST https://api.fundedfast.eu/v1/sse/token \
  -H "X-API-Key: key-your-server-key" \
  -H "Content-Type: application/json" \
  -d '{"userId": "player-42"}'
json
{ "token": "eyJ0aWQ...", "expiresAt": "...", "ttl": 3600, "userId": "player-42" }

The token is an HMAC-signed {tenantId, userId, expiry} (1-hour TTL). Send it:

  • on REST calls as the X-User-Token header, alongside the pk_ key
  • on SSE as ?token=<token>&userId=player-42
  • to the widget as the data-user-token attribute

FAST enforces token.uid === the userId being accessed, so a token for player-42 can only ever touch player-42. This is what prevents anyone who copies the public key from reading or acting on other users.

Minting is a trusted operation: only a server key (or an existing user token refreshing its own userId) may mint. On sandbox/staging tenants the public key may also self-mint as a convenience for demos; in production this is refused (403 forbidden): the operator backend must inject data-user-token.

Token lifetime & refresh ​

  • TTL is 1 hour. The widget renews the injected token automatically: shortly before expiry it exchanges the still-valid token for a fresh one, so open tabs keep working without any host-page code.
  • Self-refresh chains are capped at 24 hours from the original mint (iat travels with the token). Past the cap, POST /v1/sse/token returns 403 token_chain_expired and only your backend (server key) can mint again.
  • onTokenExpired (widget config) fires, at most once per 30s, only when the widget can no longer renew the token itself (chain cap hit, or the token was already expired). Mint a fresh token from your backend and call widget.update({ userToken }).

Widget money actions require operator approval ​

For actions triggered from the widget (buy, withdraw, refund, cancel), FAST additionally calls your single configured approvalUrl (the action type is in the payload and the X-Fast-Event header) and only proceeds on { "approved": true }. On production tenants, if the URL is not configured, a widget-initiated action is refused with 403 approval_required. Staging/sandbox tenants auto-approve when no URL is set (so demos work without an approval endpoint). Actions performed directly by your backend (server key) go through the same approval call when an approvalUrl is set; with none set they proceed, because your backend already vouched for them. See Operator Approvals. See Challenge Purchase and Withdrawals.

Admin JWT ​

Operator backoffice users authenticate with email and password via POST /v1/auth/login. The response contains a JWT token valid for 1 hour.

bash
curl -X POST https://api.fundedfast.eu/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "admin@example.com", "password": "your-password"}'

Use the token in the Authorization header for /v1/admin/* endpoints (the backoffice uses the equivalent httpOnly session cookie). Your backend can call the same /v1/admin/* endpoints with the server key in X-API-Key instead, once that key has the admin scope:

Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

If MFA is enabled, the login response returns mfaRequired: true and a short-lived mfaToken (5 minutes) instead of a session. The mfaToken is good for nothing but the next step: complete authentication with POST /v1/auth/mfa/verify using it and the 6-digit code sent to your email. Use POST /v1/auth/mfa/send to resend the code (90-second rate limit). A code is good for 15 minutes; five wrong codes void it, so ask for a new one. Login itself allows 5 attempts per email and 20 per IP in 15 minutes.

Passwords ​

  • Forgot password: POST /v1/auth/forgot-password with { "email": "..." } emails a link to choose a new password. It always answers 200, whether or not the address has an account, and changes nothing until the link is used. The link works once, for 30 minutes, and only the newest link of an account works.
  • Reset: the link opens the backoffice (or the admin console) with ?resetToken=...; the page calls POST /v1/auth/reset-password with { "token": "...", "newPassword": "..." }.
  • Change password: POST /v1/auth/change-password while signed in.

A reset or a change ends every session of the account, the current one included: sign in again with the new password. If you suspect someone else is in your account, a reset signs them out.

Super Admin Key ​

FAST internal endpoints under /v1/super-admin/* require the X-Super-Admin-Key header or a JWT with the fast_admin role.

X-Super-Admin-Key: your-super-admin-key

Super admin endpoints have their own rate limit of 60 requests per minute per client IP. The tenant limits below do not apply to them.

SSE Token ​

Server-Sent Events (SSE) connections cannot send HTTP headers, so the token goes in the URL. A URL ends up in proxy and browser logs, so the stream takes its own stream token, which opens the stream and nothing else. POST /v1/sse/token, called by your backend with the server key, returns both the user token (token) and the stream token (streamToken):

bash
curl -X POST https://api.fundedfast.eu/v1/sse/token \
  -H "X-API-Key: key-your-server-key" \
  -H "Content-Type: application/json" \
  -d '{"userId": "player-42"}'

Connect to SSE with the stream token (no key in URL). The user token is refused here, and the stream token is refused as X-User-Token:

GET /v1/events?token=<streamToken>&userId=player-42

Tokens expire after 1 hour and are scoped to a single user. The stream ends when its token expires (it sends token_expired first): mint a new token and reconnect. A user can hold 5 streams at once. Rotating your API keys also rotates the token secret, which cuts off every user and stream token at once. See Real-Time Events for full details.

Rate Limits ​

FAST enforces per-tenant rate limits using Redis-backed counters with in-memory fallback. Limits are per source IP (server-key traffic) unless noted otherwise, per 1-minute window.

Endpoint CategoryLimit
/v1/bets/* (validate, single and batch together)3000/min, plus 30 events per user per minute (see below)
/v1/users/*2000/min
/v1/challenges/*1000/min
/v1/admin/*300/min
/v1/auth/*20/min per client IP for every POST (login, MFA, password reset, refresh, tenant switch); GET /v1/auth/me and /v1/auth/mfa/status are not counted
/v1/audit/*200/min
/v1/reconciliation/*200/min
All other tenant endpoints1500/min

The /v1/auth limit has no tenant layer, since no tenant is known before sign in, and no burst on top. Login and password reset also keep their own tighter limits: login allows 5 attempts per email and 20 per IP in 15 minutes.

Bet ingestion (POST /v1/bets and each item of /v1/bets/batch) is also capped at 30 placements per user per minute. Settlements and voids are never refused for rate. Over it, FAST returns 429 rate_limited without a Retry-After header. See Bet Events.

There is a second, higher cap per tenant across all source IPs combined (10,000/min) so no single tenant can exhaust shared capacity regardless of how many IPs it spreads traffic across.

Widget traffic authenticated with a user token is rate-limited per user, not per IP (default 600/min per endpoint category, env-tunable: WIDGET_USERS_RATE_LIMIT_PER_MIN, WIDGET_TIERS_RATE_LIMIT_PER_MIN, WIDGET_LEADERBOARD_RATE_LIMIT_PER_MIN, WIDGET_DEFAULT_RATE_LIMIT_PER_MIN), so one user cannot exhaust another's budget or bypass the limit by rotating IPs. A public pk_ key with no user token is still limited per source IP. The tenant-wide cap for widget traffic is separately configurable and defaults to 60,000/min.

Rate limit headers are included in every response:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 998
X-RateLimit-Reset: 1706000000

When a limit in the table is exceeded, FAST returns 429 Too Many Requests with a Retry-After header indicating seconds until the window resets. A short-lived burst allowance (100 requests, refilling at 20/s) additionally absorbs spikes, but only while Redis is unreachable and the limiter has fallen back to in-memory counting per API replica; under normal operation the table above is a hard cap with no burst on top.

Separately, a client IP that produces 30 failed authentications (401) within a minute is answered 429 with Retry-After: 60 on every authenticated request until the minute passes.

BLACKLINE CONSULTING d.o.o.