block decisions, case creation, and webhook delivery — before you go live.
Sandbox vs. Production
Creating a Sandbox API Key
1
Open API Keys settings
In the AntifraudAI dashboard, navigate to Settings → API Keys.
2
Create a new key
Click Create Key. Give the key a descriptive name such as
My App — Sandbox.3
Choose the Sandbox environment
Under Environment, select Sandbox. The generated key will begin with
sk_test_.4
Copy and store the key
Copy the key immediately — it will not be shown again. Store it in your
.env file or secrets manager under a variable such as ANTIFRAUDAI_API_KEY.Test Trigger Values
The sandbox recognises specialuser_id values that produce deterministic, pre-configured outcomes. Use these to reliably test each branch of your decision-handling code without needing to craft specific payload combinations.
Example — triggering a
block decision:
cURL
Response
Trigger values only take effect in the sandbox environment. Sending
test_block as a user_id in production is treated as a regular user and scored by the live ML model.Testing Webhooks Locally
To receive sandbox webhook deliveries on your local development machine, expose a local port to the internet using a tunnel tool.1
Install a tunnel tool
Choose a tool such as ngrok or Cloudflare Tunnel and install it on your machine:
2
Copy the public URL
The tool will print a public HTTPS URL (e.g.
https://abc123.ngrok.io). Copy it.3
Register the endpoint in the sandbox dashboard
In the AntifraudAI dashboard, ensure you are in the Sandbox environment. Go to Settings → Webhooks → Add Endpoint and paste your tunnel URL, appending your handler path (e.g.
https://abc123.ngrok.io/webhooks/antifraudai).4
Send a test transaction and observe the delivery
Submit a transaction using a trigger
user_id such as test_review and watch your local server logs. A case.created event should arrive within seconds. You can also inspect the full request and response in the tunnel tool’s local dashboard (e.g. http://localhost:4040 for ngrok).
