Base URL
The default API listen address is:~/.openfang/config.toml:
Endpoint Count
OpenFang provides 140+ API endpoints across the following categories:- Agent management and lifecycle
- Workflow orchestration and execution
- Memory (KV store, sessions, knowledge graph)
- Channel adapters (40+ messaging platforms)
- Skills and marketplace (FangHub + ClawHub)
- MCP server integration
- A2A (Agent-to-Agent) protocol
- Security and audit trails
- Usage tracking and budgets
- System configuration
Communication Protocols
REST API
All endpoints follow RESTful conventions:GETfor retrieval operationsPOSTfor creation operationsPUTfor full updatesPATCHfor partial updatesDELETEfor removal operations
WebSocket
Real-time bidirectional communication with agents:Server-Sent Events (SSE)
Token-by-token streaming for long-running responses:text_delta, tool_use, and done events.
Rate Limiting
OpenFang implements a GCRA (Generic Cell Rate Algorithm) cost-aware rate limiter with:- Per-IP token bucket tracking
- Automatic stale entry cleanup
- Cost-based limits (expensive operations consume more tokens)
- Hourly reset window
Security Headers
All API responses include comprehensive security headers:Content-Security-Policy: Restricts resource loadingX-Frame-Options: DENY: Prevents clickjackingX-Content-Type-Options: nosniff: Prevents MIME sniffingStrict-Transport-Security: Forces HTTPS (when TLS enabled)Referrer-Policy: no-referrer: Protects sensitive URLs
Error Responses
All errors follow a consistent JSON structure:| Status Code | Meaning |
|---|---|
200 OK | Request succeeded |
201 Created | Resource created successfully |
400 Bad Request | Invalid request format or parameters |
401 Unauthorized | Missing or invalid API key |
403 Forbidden | Valid auth but insufficient permissions |
404 Not Found | Resource does not exist |
413 Payload Too Large | Request body exceeds size limit |
429 Too Many Requests | Rate limit exceeded |
500 Internal Server Error | Server-side error |
Public Endpoints
The following endpoints do not require authentication:GET /api/health— Basic health checkGET /— WebChat UIGET /logo.png— Logo imageGET /favicon.ico— Favicon
Content Negotiation
All endpoints accept and returnapplication/json unless otherwise specified:
text/event-stream:
Versioning
The API is currently unversioned. Breaking changes will be communicated via:- Release notes
- Migration guides
- Deprecation warnings in responses
/v2/ prefixed endpoints.
Next Steps
Authentication
Learn how to authenticate API requests
Agents
Create and manage agent lifecycles
Workflows
Orchestrate multi-agent workflows
Memory
Store and retrieve agent memory
