Appearance
TypeScript SDK
Official TypeScript SDK for the FAST platform, version 4.0.0. Zero dependencies. Works in Node.js 18+, Deno, Bun, and edge runtimes. Every amount it sends and returns is EUR with at most 2 decimals.
The SDK holds a server key, so run it on your backend. In a browser it refuses to start with anything but a public pk_ key unless you pass dangerouslyAllowBrowser: true.
Install
bash
npm install @fundedfast/sdkQuick Start
typescript
import { FastClient } from '@fundedfast/sdk';
const fast = new FastClient({ apiKey: process.env.FAST_API_KEY! });
// Forward a bet
await fast.bets.ingest({
userId: 'player-42',
externalBetId: 'BET-001',
stakeAmount: 5.00,
odds: 2.10,
status: 'placed',
});
// Check progress
const progress = await fast.users.getProgress('player-42');Namespaces
Operator (integration)
| Namespace | Purpose |
|---|---|
fast.challenges | Purchase, list tiers, tier terms, leaderboard |
fast.bets | Validate, ingest, batch ingest |
fast.users | Progress, ruleset, history, timeline, payout state (getWithdrawable), payouts (withdraw, listPayoutRequests), continue, refund and cancel choices, achievements, rewards, tournaments, loyalty |
fast.events | SSE token issuance and stream URL |
fast.reconciliation | Cross-reference bet data |
fast.widget | Widget module toggles and branding config |
fast.sandbox | Reset staging data, time travel for one user (timeTravel) |
The user actions of the engagement modules sit with their admin namespace but call the user routes, so they work with an integration key too: fast.admin.bonuses.activate, fast.admin.missions.join and fast.admin.tournaments.join.
Admin (backoffice)
Every fast.admin.* call to a /v1/admin/*, /v1/audit/* or /v1/analytics/* route needs a server key with the admin scope. A production key has the integration scope unless FAST changed it, and gets 403 insufficient_scope here. See Authentication.
| Namespace | Purpose |
|---|---|
fast.admin.challengeTiers | CRUD challenge tiers |
fast.admin.rulesets | CRUD rulesets |
fast.admin.bets | List, settle, bulk operations |
fast.admin.payouts | Payout requests (list, confirm, reject) and the funded accounts overview |
fast.admin.webhooks | Deliveries, retry, dead letters, rotate secret, post-bet hook dead letters |
fast.admin.settings | Integration mode, URLs, theme, currency, timezone, settlement hold, widget layout |
fast.admin.payouts | Payout requests (list, confirm, reject), funded accounts overview, accounts that need a decision |
fast.admin.bonuses | Offers, active bonuses, stats |
fast.admin.missions | CRUD missions, stats, enroll users in a targeted mission (enroll) |
fast.admin.tournaments | CRUD tournaments, cancel, settle, invite |
fast.admin.loyalty | Config, tiers, user management |
fast.admin.achievements | CRUD achievements, grant, GDPR export/erase |
fast.admin.rewards | Grant, revoke, history |
fast.admin.rewardRules | CRUD reward rules |
fast.admin.selfExclusion | Exclude/lift users |
fast.admin.adapters | Payload field mapping |
fast.admin.reconciliation | Reconciliation flags |
fast.admin.audit | Audit log queries, GDPR bulk export, retention policy |
fast.admin.analytics | Overview, challenges, revenue, users, funnel, engagement, benchmarks |
fast.admin.notificationChannels | Slack/Teams/Discord/custom channels |
fast.admin.users | User lookup, revoke funded account |
fast.admin.templates | Browse and clone challenge templates |
fast.admin.support | Support requests to the FAST team |
typescript
// Hold a win's profit for 48 hours before it can be paid out (0 to 168)
const { settlementHoldHours } = await fast.admin.settings.setSettlementHold(48);
// Funded accounts FAST cannot settle on its own
const decisions = await fast.admin.payouts.needsDecision();
for (const d of decisions) {
if (d.kind === 'final_payout_rejected') console.log(d.userId, d.rejectedRequest?.amount);
}Configuration
typescript
const fast = new FastClient({
apiKey: 'key-...',
baseUrl: 'https://api.fundedfast.eu/v1', // default
timeout: 10_000, // default 10s
retry: { maxRetries: 3 }, // exponential backoff; POSTs reuse one X-Idempotency-Key across retries
// retry: false turns retries off
debug: false, // console logging, key redacted
headers: { 'X-Request-Source': 'backend' },// extra headers on every request
fetch: customFetch, // your own fetch implementation
// Observability hooks
onRequest: ({ method, url }) => logger.info(`${method} ${url}`),
onResponse: ({ status, durationMs }) => metrics.record(status, durationMs),
});The retry defaults are maxRetries: 3, initialDelay: 300, maxDelay: 10000 (ms) and retryableStatuses: [429, 500, 502, 503, 504].
Error Handling
typescript
import { FastApiError, FastTimeoutError, FastNetworkError } from '@fundedfast/sdk';
try {
await fast.bets.ingest(bet);
} catch (err) {
if (err instanceof FastApiError) {
// err.status, err.code, err.correlationId, err.isRetryable
} else if (err instanceof FastTimeoutError) {
// err.timeoutMs
} else if (err instanceof FastNetworkError) {
// err.cause
}
}Webhook Verification
typescript
import { verifyWebhookSignature, parseWebhookEvent } from '@fundedfast/sdk/webhooks';
const valid = await verifyWebhookSignature(rawBody, signature, secret);
const event = parseWebhookEvent(rawBody);rawBody must be the request body exactly as received (a string), not JSON.stringify of a parsed object; signature is the X-Webhook-Signature header.
To keep working through a secret rotation, check the whole request instead. It tries every secret you pass against both X-Webhook-Signature and X-Webhook-Signature-Previous:
typescript
import { verifyWebhookRequest } from '@fundedfast/sdk/webhooks';
const valid = await verifyWebhookRequest(rawBody, req.headers, [newSecret, oldSecret]);See Rotating the secret.
Dual Build
Ships ESM and CommonJS. Both fully typed.
typescript
// ESM
import { FastClient } from '@fundedfast/sdk';
// CommonJS
const { FastClient } = require('@fundedfast/sdk');