Appearance
Operator Approvals
Some actions move money or cannot be undone: buying a challenge, withdrawing profit, refunding a stake, cancelling. You can have FAST ask your backend before it records any of them. You configure one approval URL. FAST POSTs a signed request to it, and goes ahead only if you answer { "approved": true } within 5 seconds.
Approvals are different from webhooks. A webhook tells you something has already happened. An approval call asks permission before FAST records the action. Most integrations use both.
When FAST calls you
| Action | Endpoint | Approval type | X-Fast-Event |
|---|---|---|---|
| Buy a challenge | POST /v1/challenges/purchase | purchase | approval.purchase |
| Withdraw funded-account profit | POST /v1/users/:userId/withdraw | withdrawal | approval.withdrawal |
| Refund the own stake after a pass | POST /v1/users/:userId/challenge/refund-stake | withdrawal | approval.withdrawal |
| Refund the own stake in the funded phase | POST /v1/users/:userId/funded/refund-stake | withdrawal | approval.withdrawal |
| Cancel a challenge | POST /v1/users/:userId/challenge/cancel | cancel | approval.cancel |
| Cancel a funded account | POST /v1/users/:userId/funded/cancel | cancel | approval.cancel |
Continuing a passed challenge into the funded account (POST /v1/users/:userId/challenge/continue) never asks for approval. It is the player's decision. See Challenge Outcome.
A payout is asked for once, when it is requested. What happens after an approval depends on who asked:
- From the widget (user token), the payout becomes a pending payout request (
202,funded_account.payout_requested). The account takes no new bets until you execute it withPOST /v1/admin/payout-requests/:id/confirmor turn it down with/reject. Confirming does not call the approval URL again. - From your backend (server key), it executes at once (
200,funded_account.payout), unless the body setsdeferred: true, which leaves it pending like a widget request.
Payouts FAST creates on its own (the mandatory payout and the final payout of a closing account) never call the approval URL: they always wait as pending requests for your confirm or reject. See Withdrawals.
Whether the call happens depends on whether a URL is set and who started the action:
| Approval URL | Started by your backend (key-…) | Started from the widget (pk_… + user token) |
|---|---|---|
| Set | FAST calls it | FAST calls it |
| Not set, staging tenant | Proceeds | Proceeds (auto-approved, so demos work) |
| Not set, production tenant | Proceeds | Refused: 403 approval_required |
Once a URL is set, FAST calls it for every action in the table, including the ones your own backend starts with the server key. If your backend has already decided, your handler can approve those straight away. The userId and type tell you which action it is.
Configure the URL
In the backoffice: Settings → Approval URL. Or with your server key:
bash
curl -X PUT https://api.fundedfast.eu/v1/admin/settings/approval-urls \
-H "X-API-Key: $FAST_API_KEY" -H "Content-Type: application/json" \
-d '{"approvalUrl": "https://your-backend.example.com/fast/approve"}'
# -> 200 { "approvalUrl": "https://your-backend.example.com/fast/approve", "correlationId": "…" }Send {"approvalUrl": null} to turn approvals off. The SDK equivalent is fast.admin.settings.setApprovalUrl(url).
The URL must be https:// on the standard port (443), use a domain name rather than an IP address, and resolve to a public address. FAST rejects anything else with 400 validation_error when you save it, and declines the action if the check fails when it calls. FAST does not follow redirects, so point the URL at the final endpoint.
The URL is copied to your production tenant when it is created from staging. Production has its own webhook secret, though, so your handler has to verify with the production secret there.
The request
http
POST /fast/approve HTTP/1.1
Content-Type: application/json
X-Fast-Event: approval.purchase
X-Fast-Approval-Id: 7d0c… (same as approvalId)
Idempotency-Key: 7d0c…
X-Webhook-Signature: 3f1c… (64 hex chars)
{"type":"purchase","approvalId":"7d0c…","userId":"player-42","tenantId":"…","tierId":"…","tierName":"Standard","purchasePrice":90,"tierPrice":100,"purchaseDiscount":10,"currency":"EUR","timestamp":"2026-10-06T12:00:00.000Z"}Every body has type, approvalId, userId, tenantId, currency and timestamp. On a purchase currency is the tier's currency; on a withdrawal, refund or cancel it is currently always EUR, whatever the tier's currency. The rest depends on the action:
type | Extra fields |
|---|---|
purchase | tierId, tierName, purchasePrice (what you collect from the player: the tier price less any purchase discount reward, and exactly the ownStake the challenge records), tierPrice (the tier's list price), purchaseDiscount (the discount applied, else 0) |
withdrawal (profit withdrawal) | grossAmount (the gross profit that will leave the balance: the grossAmount sent, or on the last payout the whole gross profit), amount (the user's share: the profit split of grossAmount, rounded down to the cent, within the caps), operatorShare (grossAmount - amount), ownStakeReturn (own stake returned on the first payout, else 0), rewardBonus (payout bonus reward paid on top, else 0), totalPayout (amount + ownStakeReturn + rewardBonus: what you will actually pay), currentBalance (ledger balance) |
withdrawal (stake refund) | amount: the own stake to be refunded |
cancel | amount: always 0, since a cancellation refunds nothing |
Verify the signature
X-Webhook-Signature is the hex HMAC-SHA256 of the raw request body, keyed with your webhook secret. It is the same scheme FAST uses for webhooks. Compute it over the bytes you received, before any JSON parsing, and compare in constant time:
typescript
import { createHmac, timingSafeEqual } from 'node:crypto';
function verifyFastSignature(rawBody: string, signature: string, secret: string): boolean {
const expected = createHmac('sha256', secret).update(rawBody).digest('hex');
if (!signature || signature.length !== expected.length) return false;
return timingSafeEqual(Buffer.from(expected, 'hex'), Buffer.from(signature, 'hex'));
}The SDK exports the same check as verifyWebhookSignature(rawBody, signature, secret) from @fundedfast/sdk/webhooks. It is async.
FAST never sends an unsigned approval. Every tenant gets a webhook secret when it is created; if FAST cannot read it (for example it cannot be decrypted), it does not call your URL at all and declines the action, the same as a timeout: the caller gets 402 <type>_declined with a message saying the tenant has no usable webhook secret. Rotate the secret in the backoffice (Settings → Webhooks) to fix it. So reject any request whose signature is missing or does not match.
The response
Answer with a 2xx and a JSON body, within 5 seconds:
json
{ "approved": true }json
{ "approved": false, "reason": "Deposit limit reached" }Anything other than "approved": true (the boolean) is a decline. So are a timeout, a non-2xx status, a body that is not JSON, a body larger than 64 KB, and a connection error. The 5 seconds cover the whole answer, body included, not just the headers. FAST does not follow redirects. FAST fails safe and does not retry.
When you decline, the original request fails with 402 and an error code of <type>_declined. Your reason becomes the message:
json
{ "error": "purchase_declined", "message": "Deposit limit reached", "correlationId": "…" }For a refund, the code is withdrawal_declined, because refunds use type: "withdrawal".
Example handler
typescript
import express from 'express';
import { createHmac, timingSafeEqual } from 'node:crypto';
const app = express();
const SECRET = process.env.FAST_WEBHOOK_SECRET!;
app.post('/fast/approve', express.raw({ type: 'application/json' }), async (req, res) => {
const raw = req.body.toString('utf8');
const sig = String(req.headers['x-webhook-signature'] ?? '');
const expected = createHmac('sha256', SECRET).update(raw).digest('hex');
if (sig.length !== expected.length ||
!timingSafeEqual(Buffer.from(sig, 'hex'), Buffer.from(expected, 'hex'))) {
return res.status(401).json({ approved: false, reason: 'bad signature' });
}
const body = JSON.parse(raw);
switch (body.type) {
case 'purchase':
// Collect body.purchasePrice from the player's wallet before approving.
return res.json(await collectStake(body.userId, body.purchasePrice));
case 'withdrawal':
// KYC, limits, and fraud checks for a payout or stake refund.
return res.json(await authorizePayout(body.userId, body.totalPayout ?? body.amount));
case 'cancel':
return res.json({ approved: true });
default:
return res.json({ approved: false, reason: 'unknown action' });
}
});
// collectStake / authorizePayout are yours: each returns { approved, reason? }.Keep the handler fast. The 5-second budget includes network time, and the player is waiting for the result.
Approval is not the payout
Approving tells FAST to record the action, and nothing more. The money still moves on your side:
- purchase: collect the stake in your approval handler, or before your backend calls purchase. FAST never charges the player.
- withdrawal: pay
totalPayoutonce the payout executes (funded_account.payout), not when you approve: a widget request only waits as a pending request until you confirm it. Pay the refundedownStakewhen the refund call succeeds. Thefunded_account.payout,challenge.stake_refundedandfunded_account.stake_refundedwebhooks confirm what FAST recorded, and the payout webhook carries the final figures.
What FAST checks before it asks you
FAST runs every check of the action before calling your approval URL: self exclusion, an open challenge or reward account, the purchase cooldown, a disabled tier, the monthly cap, the payout conditions. A request that would be refused is refused without asking you, so you are never asked to charge a player FAST then turns away.
It then reserves the action: one approval per player is in flight at a time. A double click or a second request while you are answering gets 409 approval_in_progress and never reaches you.
Every approval request carries approvalId, also sent as the X-Fast-Approval-Id and Idempotency-Key headers. Key what you do in the handler (a collected stake, a reserved payout) on it.
When an approved action does not happen
If the action still fails after your yes (for example, the price changed or the account closed in the second between), or the approval call timed out, failed with an HTTP error or could not reach you, FAST sends a signed approval.cancelled webhook with the same approvalId and the request it sent you. Undo what your handler did for that id. You never need the caller's error to find out: for a widget request the caller is the player's browser.
Related
- Challenge Purchase
- Withdrawals
- Challenge Outcome
- Webhook Handling: same signature scheme