Overview
Deflect uses two types of credentials to authenticate and authorize your requests:- API Key - Authenticates your account (used on backend)
- 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:- Sign up at deflect.bot
- Go to your dashboard
- Navigate to “API Keys”
- 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:- In your dashboard, go to “Defense Actions”
- Create a new Defense Action or select an existing one
- Copy the Action ID
- 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:- Frontend: Configure SDK with Action ID
- Frontend: Get token using
Deflect.getToken()
- Frontend: Send token to your backend in API request
- Backend: Verify token with Deflect using API Key + Action ID
- 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
- JavaScript SDK Guide - Implement frontend protection
- API Reference - Detailed backend verification