Skip to main content

API Reference

AxonFlow exposes two main APIs for interacting with the platform.

Community Examples

See working HTTP API examples with curl in the AxonFlow examples repository.

Services

ServiceLocal PortDescription
Agent8080Policy enforcement, LLM routing, MCP connectors
Orchestrator8081Multi-agent planning, workflow coordination

API Documentation

Core APIs

ReferenceDescription
Agent EndpointsPolicy enforcement, LLM proxy, MCP connectors
Orchestrator EndpointsMulti-agent planning and parallel execution
Error CodesStandard error codes and troubleshooting

Management APIs

ReferenceDescription
LLM Provider APIConfigure LLM providers and routing
Static Policy APIManage pattern-based enforcement policies
Dynamic Policy APIManage Rego-based runtime policies
Policy Templates APIBrowse and apply policy templates
Workflow APIExecute workflows and multi-agent planning
Decision & Execution Replay APIQuery, debug, and export execution history with policy decisions
Audit APISearch and retrieve audit logs
Cost Controls APIBudget management and usage tracking
Connector Marketplace APIDiscover, install, and manage connectors

Authentication

All API requests require Basic authentication using your client ID and client secret:

curl http://localhost:8080/api/v1/static-policies \
-H "Authorization: Basic $(echo -n 'your-client-id:your-client-secret' | base64)"
HeaderRequiredDescription
AuthorizationYesBasic auth with clientId:clientSecret base64-encoded
X-Org-IDNoTenant identifier for multi-tenant isolation
X-User-IDNoUser identifier for audit trail
Content-TypeFor POST/PUTapplication/json

Endpoint Index

Agent Endpoints (port 8080)

CategoryBase PathDescription
Health & Metrics/health, /metrics, /prometheusService health, JSON metrics, Prometheus scraping
Policy Enforcement/api/policy/pre-checkPre-execution policy evaluation
Policy Test/api/policies/testTest queries against policies (no audit)
Audit Recording/api/audit/llm-callRecord LLM interactions for compliance
Proxy Request/api/requestFull LLM request with policy enforcement
Static Policies/api/v1/static-policiesCRUD for pattern-based enforcement rules
LLM Providers/api/v1/llm-providersProvider configuration and routing
MCP Connectors/mcp/connectors, /mcp/resources/queryConnector management and query execution
Client Management/api/clientsAPI client registration
Connector Refresh/api/v1/connectors/refreshReload connector configurations

Orchestrator Endpoints (port 8081)

CategoryBase PathDescription
Health/healthService health check
Dynamic Policies/api/v1/dynamic-policiesCRUD for condition-based runtime policies
Policy Templates/api/v1/templatesBrowse and apply policy templates
Workflows/api/v1/workflows/executeWorkflow execution and tracking
Multi-Agent Planning/api/v1/planLLM-powered task decomposition
Audit Search/api/v1/audit/searchSearch and retrieve audit logs
Budgets/api/v1/budgetsBudget management and usage tracking
Usage/api/v1/usageLLM usage summaries and breakdowns
Connectors/api/v1/connectorsConnector marketplace discovery and install
Executions/api/v1/workflows/executionsQuery workflow execution history

Rate Limiting

API requests are subject to rate limiting. When rate-limited, the API returns HTTP 429 Too Many Requests. Default limits depend on the deployment tier. Use the Retry-After header value to determine when to retry.

Common Endpoints

Health Checks

# Agent health
curl http://localhost:8080/health

# Orchestrator health
curl http://localhost:8081/health

Policy Pre-Check (Agent)

The primary policy enforcement endpoint for Gateway Mode:

curl -X POST http://localhost:8080/api/policy/pre-check \
-H "Content-Type: application/json" \
-H "Authorization: Basic $(echo -n 'my-app:my-secret' | base64)" \
-d '{
"client_id": "my-app",
"user_token": "user-123",
"query": "What is the weather forecast?",
"context": {
"user_role": "agent",
"department": "support"
}
}'

Dynamic Policies (Orchestrator)

# List policies
curl http://localhost:8081/api/v1/dynamic-policies \
-H "Authorization: Basic $(echo -n 'my-app:my-secret' | base64)" \
-H "X-Org-ID: my-tenant"

# Create a policy
curl -X POST http://localhost:8081/api/v1/dynamic-policies \
-H "Content-Type: application/json" \
-H "Authorization: Basic $(echo -n 'my-app:my-secret' | base64)" \
-H "X-Org-ID: my-tenant" \
-d '{
"name": "block-pii",
"type": "content",
"priority": 100,
"enabled": true
}'

Response Format

The /api/v1/process endpoint returns the OrchestratorResponse format:

{
"request_id": "req_abc123",
"success": true,
"data": "The weather in Paris is currently 15°C.",
"redacted": false,
"redacted_fields": [],
"policy_info": {
"allowed": true,
"applied_policies": ["governance.rate_limit"],
"risk_score": 0.1,
"processing_time_ms": 2
},
"provider_info": {
"provider": "openai",
"model": "gpt-4o",
"response_time_ms": 856,
"tokens_used": 43
},
"processing_time": "860ms"
}

Other API endpoints return resource-specific JSON. See individual endpoint docs for response formats.

Error Responses

All API endpoints return errors in a consistent JSON format:

{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error description"
}
}

Common HTTP Status Codes:

HTTP StatusDescription
400Bad Request -- Invalid JSON or missing required fields
401Unauthorized -- Missing or invalid authentication
403Forbidden -- Insufficient permissions or policy blocked
404Not Found -- Resource does not exist
409Conflict -- Resource already exists
429Too Many Requests -- Rate limit exceeded
500Internal Server Error

Example (policy blocked):

{
"error": {
"code": "POLICY_VIOLATION",
"message": "Request blocked by policy: pii-detection"
}
}

See Error Codes for the complete list.

Next Steps