Appearance
Real-Time Events (SSE)
FAST provides a Server-Sent Events stream for real-time notifications. Your frontend receives instant updates when challenges complete, bets are validated, cooldowns trigger, etc.
Authentication
EventSource (SSE) cannot send HTTP headers. FAST uses HMAC-signed tokens to authenticate SSE connections without exposing API keys in URLs.
Token endpoint
Call it from your backend with your server key:
POST /v1/sse/token
X-API-Key: key-your-server-key
Content-Type: application/json
{ "userId": "player-42" }Response:
json
{
"token": "eyJ0aWQiOiJ...",
"streamToken": "eyJ0aWQiOiJ...",
"expiresAt": "2026-06-07T15:00:00.000Z",
"ttl": 3600,
"userId": "player-42"
}Who may mint a token:
| Caller | Allowed |
|---|---|
Server key (key-...) | Any user of your tenant |
A widget user token (X-User-Token) | Only a fresh token for its own userId, and only up to 24 hours after the first token of that chain was minted (403 token_chain_expired after that: mint a new one from your backend) |
Public widget key (pk_...) alone | Staging tenants only. On a production tenant it is refused with 403 forbidden |
token is the user token the widget takes as data-user-token. It authorises the player's actions, so it never goes in a URL. streamToken opens the event stream and nothing else.
Connect to SSE
GET /v1/events?token=<streamToken>&userId=player-42No API key in URL. The stream token is HMAC-signed with a server-side secret and contains:
- Tenant ID (which operator)
- User ID (scoped to one player)
- Expiry timestamp
- The stream scope: the user token is refused on the stream, and the stream token is refused as
X-User-Token
Limits: 5 streams per user (a sixth gets an error event with too_many_connections and is closed). Rotating your API keys also rotates the token secret, which revokes every user and stream token.
Token refresh
Tokens expire after 1 hour (3600 seconds). The ttl field tells you the lifetime. The stream ends when its token expires, after a token_expired event, so reconnect with a fresh token before expiry or on that event.
Recommended: refresh at 80% of TTL (about every 48 minutes). The widget renews its own token; a chain of self refreshes ends 24 hours after your backend minted the first token.
Events
On connect the stream sends a retry: line (the reconnect delay, 1 to 6 seconds, different per connection) and an empty connected event. Refetch progress whenever connected arrives, since a reconnect can miss events.
A stream opened with a user token carries only events about that user. Most webhook event types are mirrored, plus bet.settled. The payloads are smaller than the webhook ones, so treat an event as a signal to refetch progress. Every payload below also carries userId.
| Event | When | Payload |
|---|---|---|
challenge.activated | New challenge purchased and started | challengeId |
challenge.passed | Challenge target reached; user must choose continue or refund | challengeId, programBalance, refundableOwnStake |
challenge.completed | User continued after passing; Reward Account created | challengeId, finalBalance, fundedAccountBalance |
challenge.failed | Challenge failed (total drawdown, expiry, insufficient active days) | challengeId, reason |
challenge.cancelled | User cancelled the challenge | challengeId, ownStakeForfeited, bonusVoided |
challenge.stake_refunded | User exited after passing; own stake to be refunded | challengeId, ownStake, bonusAmount |
funded_account.activated | Funded account created after the user continued | fundedAccountId |
funded_account.payout_requested | A payout request is waiting for the operator | fundedAccountId, payoutRequestId |
funded_account.payout_rejected | A pending payout request was rejected | fundedAccountId, payoutRequestId |
funded_account.payout | Payout executed | the full webhook payload |
funded_account.revoked | Funded account ended (total drawdown, cancellation, admin) | fundedAccountId |
funded_account.inactivity_warning | Funded account closes for inactivity soon (7 days and 1 day before) | fundedAccountId, closesAt |
funded_account.closing | Funded account started closing (lifetime over or inactive) | fundedAccountId, reason |
funded_account.closed | Closing funded account closed with no profit to pay | the full webhook payload |
funded_account.payout_debt | A void after a payout left a debt that later profit repays | fundedAccountId, payoutDebt |
funded_account.stake_refunded | Own stake refunded during the funded phase | fundedAccountId, ownStake |
bet.validation_result | A placed bet was accepted or rejected | betId, status, reasonCodes |
bet.settled | Bet settlement processed (SSE only, no webhook) | betId, outcome (won, lost or void) |
cooldown.triggered | Session stop hit: new tickets paused | reason, expiresAt |
cooldown.lifted | Pause ended | none |
reward.granted | Reward granted | rewardId, rewardType, rewardValue |
bonus.activated | Wagering bonus started | bonusId |
bonus.completed | Wagering requirement met | bonusId |
mission.completed | Mission completed | missionId, missionName |
tournament.user_invited | User invited to a tournament | tournamentId, tournamentName |
loyalty.tier_upgraded | User moved up a loyalty tier | tier |
user.self_excluded | User self-excluded | reason |
user.self_exclusion_lifted | Exclusion lifted | reinstatedBy |
challenge.bonus_voided, challenge.expiring_soon, reward.applied, reward.expired, achievement.earned and the other bonus, mission, tournament and loyalty events are webhook only. tournament.started and tournament.settled concern no single user, so they reach only a tenant wide stream (the backoffice), never a user stream.
Implementation examples
Browser (vanilla JS)
javascript
// 1. Fetch token from your backend (never expose API key in frontend)
const res = await fetch('/api/fast/user-token', { method: 'POST' });
const { streamToken } = await res.json();
// 2. Connect
const es = new EventSource(
`https://api.fundedfast.eu/v1/events?token=${streamToken}&userId=player-42`
);
es.addEventListener('challenge.completed', (e) => {
const data = JSON.parse(e.data);
showNotification('Challenge completed!');
});
es.addEventListener('cooldown.triggered', (e) => {
const { expiresAt } = JSON.parse(e.data); // when the pause ends
disableBettingUntil(expiresAt);
});Your backend (token proxy)
javascript
// Express route that your frontend calls
app.post('/api/fast/user-token', async (req, res) => {
const userId = req.session.userId; // from your auth
const response = await fetch('https://api.fundedfast.eu/v1/sse/token', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.FAST_SERVER_KEY, // key-..., never shipped to the browser
},
body: JSON.stringify({ userId }),
});
const data = await response.json();
res.json(data);
});With the FAST Widget
The widget handles SSE automatically. Give it a user token your backend minted with the server key; it renews the token itself after that:
html
<!-- Optional, recommended: opens the API connection while the script loads. -->
<link rel="preconnect" href="https://api.fundedfast.eu" crossorigin>
<script
src="https://cdn.fundedfast.eu/fast-widget.iife.js"
data-fast-widget
data-api-key="pk_your-widget-key"
data-user-id="player-42"
data-user-token="TOKEN_FROM_YOUR_BACKEND"
data-api-base="https://api.fundedfast.eu/v1"
></script>Without data-user-token the widget can mint a token with the public key only on a staging tenant.
You can also mount it from script instead of data attributes (window.FastWidget.mount() returns an instance with update/destroy/open):
javascript
const widget = FastWidget.mount({
apiKey: 'pk_your-widget-key',
userId: 'player-42',
apiBase: 'https://api.fundedfast.eu/v1',
userToken: tokenFromYourBackend, // pre-generated; data-user-token in HTML form
});
// Later, when your backend hands you a refreshed token (e.g. onTokenExpired):
widget.update({ userToken: refreshedToken });Keep-alive
The server sends a comment line (: keepalive) every 30 seconds to prevent connection timeouts.
Error handling
If the connection drops, EventSource auto-reconnects. On token expiry (401 response), fetch a new token and create a new EventSource instance.
A client that falls more than about 1 MB behind in reading is disconnected; it reconnects and refetches on connected. When the tenant has reached its stream limit (500 open streams per API instance), the server sends an error event with {"error":"too_many_connections"} and closes the stream.