Authentication
Learn how to authenticate with the Agent Action Firewall API.
API Keys
All API requests require authentication using an API key. API keys are scoped to your organization and can have different permission levels.
Creating API Keys
- Log in to the dashboard
- Go to Settings > API Keys
- Click "Create API Key"
- Select permissions and expiration
- Copy and securely store the key
Authentication Header
Include your API key in the X-Agent-Key header:
HTTP
X-Agent-Key: YOUR_API_KEYAgent Identification
Include the agent ID in the X-Agent-Id header:
HTTP
X-Agent-Id: my-agent-nameComplete Example
Bash
curl -X POST https://api.agentactionfirewall.com/v1/actions \
-H "X-Agent-Key: sk_live_abc123..." \
-H "X-Agent-Id: customer-service-bot" \
-H "Content-Type: application/json" \
-d '{"tool": "http_proxy", "operation": "GET", "params": {"url": "https://api.example.com"}}'Permission Scopes
| Scope | Description |
|---|---|
actions:write | Submit and manage actions |
actions:read | View action status and history |
approvals:write | Approve or deny actions |
approvals:read | View pending approvals |
policies:write | Create and modify policies |
policies:read | View policies |
audit:read | Access audit logs |
admin:* | Full administrative access |
Key Types
Agent Keys
For AI agents submitting actions. Limited to actions:write andactions:read scopes.
Admin Keys
For dashboard and administrative operations. Can have any combination of scopes.
Webhook Keys
For validating incoming webhooks. Read-only and scoped to webhook verification.
Key Security
Best Practices
- Never commit API keys to version control
- Use environment variables for key storage
- Rotate keys regularly (at least every 90 days)
- Use the minimum required scopes
- Set key expiration dates
Key Rotation
- Create a new API key with the same scopes
- Update your applications to use the new key
- Verify the new key works correctly
- Revoke the old key in the dashboard
Error Responses
401 Unauthorized
JSON
{
"error": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}403 Forbidden
JSON
{
"error": "FORBIDDEN",
"message": "API key lacks required scope: policies:write"
}SDK Authentication
TypeScript
import { AgentFirewallClient } from '@agent-action-firewall/sdk';
const client = new AgentFirewallClient({
baseUrl: 'https://api.agentactionfirewall.com',
apiKey: process.env.AGENT_FIREWALL_API_KEY!,
agentId: 'my-agent',
});
// The SDK handles authentication headers automatically