What are Defense Actions?
Defense Actions are customized protection profiles for different endpoints on your site. Each Action is tailored to the specific risks and requirements of that endpoint type. Think of Defense Actions as security policies - you might want different protection levels for a login page versus a contact form.Why use different Defense Actions?
Different endpoints have different risk profiles:- Login pages need to detect credential stuffing and account takeover attempts
- Registration forms should check for fake emails and bulk account creation
- Payment pages require the highest security against fraud
- Contact forms need basic spam protection
- API endpoints may need different rate limiting and validation
Common Defense Action Types
Login Protection
- Detects credential stuffing attacks
- Identifies suspicious login patterns
- Protects against account takeover
Registration Protection
- Validates email providers and domains
- Detects bulk account creation
- Checks for disposable email addresses
- Identifies automated signups
Payment Protection
- Maximum security for financial transactions
- Advanced fraud detection
- Enhanced device fingerprinting
- Stricter IP reputation checks
API Protection
- Rate limiting and abuse prevention
- Bot traffic identification
- Automated request detection
Setting up a Defense Action
1. Create in Dashboard
- Log into your Deflect dashboard
- Navigate to “Defense Actions”
- Click “Create New Action”
- Select the appropriate type for your endpoint
- Configure protection settings
- Save and copy the Action ID
2. Use in your code
3. Verify on backend
Multiple Defense Actions
You can create multiple Defense Actions for different parts of your site:Testing Defense Actions
When developing and testing your integration locally, you can use special test action IDs that return predictable results without consuming API credits or triggering real challenges.Test Action IDs
Two special test action IDs are available:✅ Success Test ID
- Always returns
can_pass: true - Returns mock device, IP, location, and session data
- Perfect for testing successful verification flows
❌ Failure Test ID
- Always returns
can_pass: false - Returns mock device, IP, location, and session data
- Perfect for testing failure/rejection flows
Using Test Action IDs
Key Features
- ✅ Valid API Key Required: You still need to provide a valid API key
- ✅ No Usage Tracking: Test requests don’t count toward your API usage limits
- ✅ Instant Response: Bypasses all session validation and returns immediately
- ✅ Mock Data: Returns consistent test data for development
- ⚠️ Development Only: Do not use test action IDs in production
Example Response
Test action IDs return mock data:Best Practices
- Use specific Action types - Don’t use a generic action for specialized endpoints
- Test before deploying - Verify your Defense Action works in staging first
- Monitor performance - Check your dashboard for detection rates and false positives
- Update configurations - Adjust settings based on your traffic patterns
Next Steps
- Authentication Setup - Configure your API keys
- JavaScript SDK - Implement the client-side protection
- API Reference - Backend verification guide