Skip to main content
AntifraudAI authenticates every API request using API keys — long-lived secret tokens that identify your account and authorize access to the API. API keys are created and managed from the AntifraudAI dashboard at app.antifraudai.com. You can create multiple keys (for example, one per environment or service), restrict each key’s permissions, and revoke any key instantly if it’s ever compromised.
Store your API keys in environment variables (e.g., ANTIFRAUDAI_API_KEY) and read them at runtime. Never hardcode keys directly in source code or check them into version control — even in private repositories.

Creating an API Key

  1. Log in to the dashboard at app.antifraudai.com.
  2. Navigate to Settings → API Keys.
  3. Click Create New Key.
  4. Enter a descriptive label so you can identify the key later (e.g., production-backend, ci-pipeline).
  5. Select the desired permission level (see Key Permissions below).
  6. Click Generate and copy the key immediately.
API keys are shown in full only once at creation time. After you navigate away, only the last four characters are displayed. If you lose a key, generate a new one and rotate it into your integration. Keys are prefixed to indicate their environment:

Using Your API Key

Pass your API key as a Bearer token in the Authorization header of every request:

Key Permissions

When creating an API key, you choose its permission level. Use the most restrictive level that meets your integration’s needs. You cannot upgrade a key’s permissions after creation — create a new key with the required level and retire the old one.

Rotating Keys

Regularly rotating API keys is a security best practice and is essential if a key is ever exposed. Follow these steps to rotate a key with zero downtime:
  1. Create a new key — In Settings → API Keys, create a new key with the same permission level as the key you’re replacing.
  2. Deploy the new key — Update your application’s environment variable (or secrets manager) to use the new key and deploy the change.
  3. Verify the new key is active — Confirm your integration is successfully authenticating with the new key by checking recent API logs in the dashboard.
  4. Delete the old key — In Settings → API Keys, locate the old key and click Revoke.
Deleted (revoked) keys are immediately and permanently invalidated. Any service still using the old key will begin receiving 401 Unauthorized errors the instant the key is revoked. Ensure your new key is fully deployed and verified before revoking the old one.

Authentication Errors

If a request fails due to an authentication or authorization problem, the API returns one of the following HTTP error codes: All error responses follow a consistent JSON structure: