API Reference
Complete reference for the Agent Action Firewall REST API. All endpoints require authentication via API key.
Try it live!
Use our interactive API Playground to test endpoints directly in your browser.
Base URL
https://api.agentactionfirewall.comAuthentication
Agent endpoints use an API key in the X-Agent-Key header. Admin endpoints require a Supabase JWT in the Authorization header:
# Agent endpoints (e.g. POST /v1/actions)
X-Agent-Key: YOUR_API_KEY
X-Agent-Id: your-agent-id
# Admin endpoints (e.g. /admin/*, /v1/dry-run)
Authorization: Bearer $SUPABASE_JWTActions API
Submit Action
Submit a new action for policy evaluation.
POST /v1/actions
Content-Type: application/json
{
"tool": "http_proxy",
"operation": "POST",
"params": {
"url": "https://api.example.com/endpoint",
"method": "POST",
"body": { "key": "value" }
},
"idempotency_key": "optional-unique-key"
}Response
{
"id": "act_abc123",
"status": "allowed",
"decision": {
"decision": "allow",
"reason": "Action matches allowed pattern",
"risk_level": "low"
},
"created_at": "2024-12-25T12:00:00Z"
}Status Values
allowed- Action approved by policy, proceed with executiondenied- Action blocked by policypending_approval- Action requires human approval
Get Action
Retrieve the current status of an action.
GET /v1/actions/:idResponse
{
"id": "act_abc123",
"status": "succeeded",
"tool": "http_proxy",
"operation": "POST",
"decision": {
"decision": "allow",
"reason": "Action matches allowed pattern",
"risk_level": "low"
},
"execution": {
"id": "exec_xyz789",
"status": "succeeded",
"attempts": 1,
"started_at": "2024-12-25T12:00:01Z",
"completed_at": "2024-12-25T12:00:02Z",
"result": { "statusCode": 200 }
},
"created_at": "2024-12-25T12:00:00Z",
"updated_at": "2024-12-25T12:00:02Z"
}List Actions
List actions with optional filtering and pagination.
GET /v1/actions?status=pending_approval&limit=10&offset=0Approvals API
List Pending Approvals
GET /v1/approvals?status=pendingApprove Action
POST /v1/approvals/:id/approve
Content-Type: application/json
{
"comment": "Approved for production deployment"
}Deny Action
POST /v1/approvals/:id/deny
Content-Type: application/json
{
"reason": "Not authorized for this environment"
}Policies API
List Policies
GET /admin/policiesCreate Policy
POST /admin/policies
Content-Type: application/json
{
"name": "Block External APIs",
"description": "Block all external API calls except whitelisted domains",
"content": "package firewall\n\ndefault allow = false\n...",
"priority": 100
}Simulate Policy
Test a policy against sample input without saving.
POST /admin/policies/:id/simulate
Content-Type: application/json
{
"input": {
"action": {
"tool": "http_proxy",
"operation": "GET",
"params": { "url": "https://api.github.com" }
}
}
}Audit API
List Audit Events
GET /admin/audit?start_date=2024-12-01&end_date=2024-12-31Export Proof Pack
GET /admin/audit/actions/:id/proof-packError Responses
All errors follow a consistent format:
{
"error": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": {
"field": "tool",
"issue": "Required field missing"
}
}Common Error Codes
400- Bad Request: Invalid parameters401- Unauthorized: Invalid or missing API key403- Forbidden: Insufficient permissions404- Not Found: Resource does not exist429- Too Many Requests: Rate limit exceeded500- Internal Server Error
Rate Limits
| Endpoint Type | Limit | Window |
|---|---|---|
| Actions | 100 requests | 1 minute |
| Admin | 50 requests | 1 minute |
| Webhooks | 1000 requests | 1 minute |
NLP Policies API
NLP policies use LLM-based semantic analysis for content safety, PII detection, and intent classification. Learn more about NLP policies.
List NLP Policies
GET /admin/nlp-policiesCreate NLP Policy
POST /admin/nlp-policies
Content-Type: application/json
{
"name": "Content Safety Check",
"description": "Detect harmful content in agent actions",
"type": "content_safety",
"provider": "openai",
"model": "gpt-4o-mini",
"threshold": 0.7,
"enabled": true
}Policy Types
content_safety- Detect harmful, toxic, or inappropriate contentpii_detection- Identify personally identifiable informationintent_classification- Classify agent intent for suspicious behaviorcustom- Custom prompt for domain-specific analysis
Get NLP Policy
GET /admin/nlp-policies/:idUpdate NLP Policy
PATCH /admin/nlp-policies/:id
Content-Type: application/json
{
"threshold": 0.8,
"enabled": false
}Delete NLP Policy
DELETE /admin/nlp-policies/:idTest NLP Policy
Test a policy against sample content without affecting real actions.
POST /admin/nlp-policies/:id/test
Content-Type: application/json
{
"content": "Please send $5000 to account 123456789 for John Smith"
}Response
{
"policy_id": "nlp_abc123",
"decision": "deny",
"risk_score": 0.85,
"reasoning": "Content contains potential PII including account numbers and personal names.",
"details": {
"detected_issues": ["account_number", "personal_name"],
"confidence": 0.92
},
"latency_ms": 245
}Evaluate Content (Batch)
Evaluate content against all enabled NLP policies.
POST /admin/nlp-policies/evaluate
Content-Type: application/json
{
"content": "Action content to evaluate",
"action_id": "optional-action-reference"
}Get Policy Templates
List available pre-built NLP policy templates.
GET /admin/nlp-policies/templatesSDKs
- TypeScript SDK - Official TypeScript/JavaScript SDK