Quickstart
From nothing to a tuned live integration, in the order you build it. Steps 1 and 3 alone get you a scored sandbox event in five minutes; each step links to the reference page with every detail.
How the pieces fit
| # | Who | What happens |
|---|---|---|
| 1 | Your page | Collects device data and gets a device id (fp_id) from Defraudo. |
| 2 | Your page → your backend | Sends the user's action (sign-up, deposit…) together with fp_id. |
| 3 | Your backend → Defraudo | Sends the event and gets the decision: allow, review or block. |
| 4 | Your analysts | Decide review cases in the dashboard; each decision reaches your backend as a webhook. |
Step 1. Get access and keys
- Accept the invitation email and sign in to the dashboard. Sign-in uses a password and an authenticator app.
- Your company has two projects: sandbox for integration and testing, and live for real traffic. Nothing sent to sandbox touches live.
- In the sandbox project open API keys and create:
- a secret key
ak_sandbox_...for your backend; - a publishable key
pk_sandbox_...for your web pages.
- a secret key
A key is shown once. Keep the secret key in your secrets store and never put it in a page or an app. Details: Base URL and authentication.
Step 2. Add the device collector to your pages
Do this on every page where the user registers, signs in, deposits or withdraws.
-
In the dashboard, project Settings, add your site to the allowed browser origins (for example
https://www.example.com). -
Add the collector script Defraudo gives you (a versioned URL with an integrity value) to those pages.
-
Start collection when the page loads and finish it at the user's action:
const config = { url: 'https://api.defraudo.com/v1/fp/collect', apiKey: 'pk_sandbox_...' };AntiFrodFP.prewarm(); // on page loadconst { data } = await (await AntiFrodFP.submitFast(config)).json(); // on submit// send data.fp_id to your backend together with the form -
Send
data.fp_idto your backend with the form data.
The publishable key must belong to the same project as the secret key your backend uses. A native iOS or Android app does not run the collector; mark its events "platform": "ios" or "android" instead. A Telegram bot or Mini App has its own setup: Telegram bot and Mini App. Details: Device fingerprint.
Step 3. Send events from your backend
Send one event for each action below, before you complete it:
| User action | event_type |
|---|---|
| Creates an account | registration |
| Signs in | login |
| Deposits money | deposit |
| Withdraws money | withdrawal (or payout) |
| Pays for something | payment |
Each event carries your own id for the user and what you know about the action:
- curl
- Node.js
- Python
- PHP
curl -X POST https://api.defraudo.com/v1/events \
-H "Authorization: Bearer $DEFRAUDO_KEY" \
-H "Content-Type: application/json" \
-d '{
"event_id": "0b7b1c2e-5d0a-4f6e-9c1d-2a3b4c5d6e7f",
"event_type": "payment",
"external_account_id": "user-1001",
"context": { "ip": "203.0.113.7", "user_agent": "Mozilla/5.0" },
"user": { "email": "jane@example.com" },
"payment": { "amount_cents": 4999, "currency": "EUR", "bin": "411111", "last4": "1234" }
}'
import crypto from 'node:crypto';
const response = await fetch('https://api.defraudo.com/v1/events', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DEFRAUDO_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
event_id: crypto.randomUUID(),
event_type: 'payment',
external_account_id: 'user-1001',
context: { ip: '203.0.113.7', user_agent: 'Mozilla/5.0' },
user: { email: 'jane@example.com' },
payment: { amount_cents: 4999, currency: 'EUR', bin: '411111', last4: '1234' }
})
});
const { data } = await response.json();
console.log(data.decision, data.risk_score);
import os
import uuid
import requests
response = requests.post(
'https://api.defraudo.com/v1/events',
headers={'Authorization': f"Bearer {os.environ['DEFRAUDO_KEY']}"},
json={
'event_id': str(uuid.uuid4()),
'event_type': 'payment',
'external_account_id': 'user-1001',
'context': {'ip': '203.0.113.7', 'user_agent': 'Mozilla/5.0'},
'user': {'email': 'jane@example.com'},
'payment': {'amount_cents': 4999, 'currency': 'EUR', 'bin': '411111', 'last4': '1234'},
},
timeout=5,
)
data = response.json()['data']
print(data['decision'], data['risk_score'])
<?php
$bytes = random_bytes(16);
$bytes[6] = chr(ord($bytes[6]) & 0x0f | 0x40);
$bytes[8] = chr(ord($bytes[8]) & 0x3f | 0x80);
$payload = [
'event_id' => vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($bytes), 4)),
'event_type' => 'payment',
'external_account_id' => 'user-1001',
'context' => ['ip' => '203.0.113.7', 'user_agent' => 'Mozilla/5.0'],
'user' => ['email' => 'jane@example.com'],
'payment' => ['amount_cents' => 4999, 'currency' => 'EUR', 'bin' => '411111', 'last4' => '1234'],
];
$ch = curl_init('https://api.defraudo.com/v1/events');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 5,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('DEFRAUDO_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$data = json_decode(curl_exec($ch), true)['data'];
echo $data['decision'], ' ', $data['risk_score'], PHP_EOL;
What matters most:
event_id: a new UUID per action. Resending the same request is safe and is not scored twice.external_account_id: the same id for the same user every time, so their actions link into one account.context.ip: the user's real IP, not your server's.context.fp_idand"platform": "web"for actions made in a browser. A web action without a device id is blocked by the iGaming presets.- Never send a full card number: only
binandlast4. For a wallet or bank account usepayment.account_refwithaccount_ref_type.
Send only fields you actually have; leave the rest out. Every event you send appears in Events in the dashboard. Every field: Events. Personal data handling: PII and card data.
Step 4. Act on the decision
The response tells you what to do:
decision | What your system does |
|---|---|
allow | Complete the action. |
review | Hold the action. A case opens in the dashboard; wait for the analyst's decision (step 5). |
block | Refuse the action. |
{
"status": 1,
"data": {
"event_id": "0b7b1c2e-5d0a-4f6e-9c1d-2a3b4c5d6e7f",
"risk_score": 0,
"max_possible": 935,
"decision": "allow",
"breakdown": [],
"flags": [],
"trust_override": false,
"hard_block_hit": false,
"latency_ms": 3,
"account_public_id": "acc_01k6hs3ybb7xhrm2b5ce6jw7mt",
"enrichment_status": { "mx-check": "ok", "disposable-email": "ok", "maxmind": "ok" },
"environment": "sandbox"
},
"errors": []
}
Read the score later.
Any scored event can be fetched by its event_id:
curl https://api.defraudo.com/v1/scores/0b7b1c2e-5d0a-4f6e-9c1d-2a3b4c5d6e7f \
-H "Authorization: Bearer $DEFRAUDO_KEY"
The response has "status": "pending" while an async event is still queued and "status": "scored" with the score, decision and breakdown afterwards. It does not repeat degraded, latency_ms or account_public_id. An unknown event_id returns 404.
Decide in advance what your system does if Defraudo does not answer in time (allow, hold or refuse); after a 500 or 503, retry with the same event_id. Score thresholds and rules are set per project in the dashboard. Details: Events → Reading the result and Errors.
Step 5. Receive webhooks
Webhooks tell your backend when an analyst decides a review case, so you can complete or refuse the held action.
- Expose an HTTPS endpoint on your backend.
- In the dashboard, project Settings → Webhook, set its URL and create a signing secret.
- Verify the signature on every request, answer any
2xx, and ignore awebhook_idyou have already processed. - Use test send in the same section to check the endpoint.
Signature code for Node.js, Python and PHP: Webhooks. How cases work: Cases and review.
Step 6. Set up detection
The integration sends the data; the dashboard decides what to do with it. Do this in sandbox first, then repeat in live.
- Choose a rule set. On Rules, Change set offers the Defraudo presets: Essentials for any business, iGaming Standard and iGaming Advanced for casinos and sportsbooks. A switch shows a preview on your last 30 days of events, arrives in
shadowand takes effect when you confirm it. See Rules and presets. - Set the thresholds. In Settings → Webhook & thresholds set the score at which an event goes to
reviewand toblock, and whether manual review is on. With manual review off nothing goes to review: an event below the block threshold is allowed. - Watch shadow rules before you rely on them. A
shadowrule is scored on every event but never changes a decision. On Rules check how often each one fires, simulate a rule on recent traffic, and publish it toactivewhen the hits look right. - Add your own rules for what the presets do not cover: a large first deposit, a country you do not serve, a payout right after sign-up. Write them on Rules, test against a past event, simulate, then publish. See Writing rules.
- Load what you already know. Import the fraudsters you have already caught, and the customers you trust, into Trustchain from a CSV: emails, phones, cards, devices, IPs and accounts.
- Invite your team. In Settings → Team members add analysts to work the review queue and admins to manage rules. What each role can do: Dashboard → Roles.
- Turn on alerts. In Notifications send your team an email on new cases, rule hits and traffic spikes.
Step 7. Test in sandbox
Before going live, run through this in the sandbox project:
- A registration, a login, a deposit and a withdrawal from a browser reach Events in the dashboard, each with a device.
- The same user's actions appear under one account in Accounts.
- Your backend applies
allow,reviewandblockas planned. - A
reviewcreates a case; deciding it in Cases sends a webhook that your backend verifies and applies. - Resending a request with the same
event_iddoes not create a second event.
Step 8. Go live
- In the live project create a live secret key
ak_live_...and a publishable keypk_live_..., and add your production site to its allowed origins. - Switch your backend and pages to the live keys, and set the webhook in the live project too.
- Repeat step 6 in the live project: rule set, thresholds, Trustchain, team and alerts.
- If you are replacing another antifraud provider, run both side by side first: keep acting on the old provider and send its verdict in
external_decision, then compare in the dashboard. See Running alongside your current provider.
Questions during the integration: send the x-request-id from the response with your message, so we can find the exact request.