Skip to main content
Every request to the AntifraudAI API must be authenticated. Authentication is handled via API keys passed as Bearer tokens in the Authorization header. You can find and manage your API keys in the AntifraudAI Dashboard. There are two types of keys — sandbox and production — each scoped to their respective environment.
Never include API keys in client-side code, mobile app bundles, or public repositories. API keys grant full access to your AntifraudAI account. If a key is exposed, revoke it immediately from the dashboard and issue a new one.

Bearer Token Authentication

Pass your API key in the Authorization header of every request using the Bearer scheme:

Sandbox vs. Production Keys

Sandbox and production keys are not interchangeable. Sending a sk_test_ key to the production base URL — or vice versa — will return a 401 authentication_failed error.

Authentication Errors

When authentication fails, the API returns a 4xx HTTP status with a JSON error body. The two most common authentication errors are: Example error response:
Store your API key in an environment variable (e.g., ANTIFRAUD_API_KEY) and read it at runtime rather than hard-coding it. This keeps it out of source control and makes key rotation a one-line config change.