Skip to main content

Overview

Deflect uses two types of credentials to authenticate and authorize your requests:
  1. API Key - Authenticates your account (used on backend)
  2. Action ID - Identifies which Defense Action to use (used on frontend and backend)

Getting your credentials

1. API Key (Backend authentication)

Your API key authenticates your backend server with Deflect’s API:
  1. Sign up at deflect.bot
  2. Go to your dashboard
  3. Navigate to “API Keys”
  4. Copy your API key (format: dlfct_xxxxxxxxxx)
Keep your API key secret! Only use it on your backend server, never in client-side code.

2. Action ID (Frontend configuration)

Action IDs identify which Defense Action to use for protection:
  1. In your dashboard, go to “Defense Actions”
  2. Create a new Defense Action or select an existing one
  3. Copy the Action ID
  4. Use this ID in your frontend SDK configuration
Action IDs are safe to use in client-side code - they only specify which protection profile to use.

Using your credentials

Frontend (Client-side SDK)

Backend (Server-side verification)

Complete authentication flow

Here’s how the credentials work together:
  1. Frontend: Configure SDK with Action ID
  2. Frontend: Get token using Deflect.getToken()
  3. Frontend: Send token to your backend in API request
  4. Backend: Verify token with Deflect using API Key + Action ID
  5. Backend: Process request based on verification result

Security best practices

  • Never expose API keys - Use environment variables on backend
  • Validate all tokens - Always verify tokens server-side before processing requests
  • Use HTTPS - Ensure all API calls are encrypted
  • Rotate keys - Regularly update your API keys in the dashboard
  • Monitor usage - Check your dashboard for unusual activity

Environment setup

Set up your credentials securely:

Next Steps