Overview
The gateway provides:- REST API: Full agent control via HTTP
- Webhooks: Receive messages from external platforms
- WebSocket: Real-time bidirectional communication
- Web Dashboard: Browser-based UI for monitoring and control
- OpenAI Compatibility: Drop-in replacement for OpenAI API
- SSE Events: Real-time event streaming
Quick Start
🦀 ZeroClaw Gateway listening on http://127.0.0.1:42617
🌐 Web Dashboard: http://127.0.0.1:42617/
POST /pair — pair a new client (X-Pairing-Code header)
POST /webhook — {"message": "your prompt"}
POST /api/chat — {"message": "...", "context": [...]}
POST /v1/chat/completions — OpenAI-compatible
GET /health — health check
GET /metrics — Prometheus metrics
🔐 PAIRING REQUIRED — use this one-time code:
┌──────────────┐
│ ABCD-1234 │
└──────────────┘
Send: POST /pair with header X-Pairing-Code: ABCD-1234
{
"paired": true,
"persisted": true,
"token": "zcl_live_abc123...",
"message": "Save this token — use it as Authorization: Bearer <token>"
}
Configuration
Configure the gateway inconfig.toml:
Security
Pairing System
The gateway uses a secure pairing flow:- One-time code: Generated on startup (8-character alphanumeric)
- Rate limiting: 10 pairing attempts per minute per IP
- Lockout: 5-minute lockout after 3 failed attempts
- Bearer tokens: Long-lived tokens (256-bit random)
- Persistence: Tokens saved to config.toml
Public Bind Protection
The gateway refuses unsafe configurations:-
Use a tunnel (recommended):
-
Explicit opt-in (for internal networks only):
Rate Limiting
The gateway implements sliding-window rate limiting:Webhook Secrets
Protect webhook endpoints with shared secrets:API Endpoints
Core Endpoints
POST /pair - Pairing
POST /pair - Pairing
Exchange pairing code for bearer token.Request:Response:
POST /webhook - Simple Chat
POST /webhook - Simple Chat
Send a message to the agent (no tools).Request:Response:
POST /api/chat - Agent Chat with Tools
POST /api/chat - Agent Chat with Tools
Full agent loop with tool execution.Request:Response:
POST /v1/chat/completions - OpenAI Compatible
POST /v1/chat/completions - OpenAI Compatible
Drop-in replacement for OpenAI API.Request:Response:
GET /health - Health Check
GET /health - Health Check
Check gateway status (always public).Request:Response:
GET /metrics - Prometheus Metrics
GET /metrics - Prometheus Metrics
Prometheus-compatible metrics (requires auth or localhost).Request:Response:
Dashboard API
All dashboard endpoints require bearer token authentication:GET /api/status- System status overviewGET /api/config- Current configuration (secrets masked)PUT /api/config- Update configurationGET /api/tools- List available toolsGET /api/memory- List/search memory entriesPOST /api/memory- Store memory entryDELETE /api/memory/:key- Delete memory entryGET /api/cost- Cost tracking summaryGET /api/cron- List cron jobsPOST /api/cron- Add cron jobDELETE /api/cron/:id- Remove cron jobGET /api/integrations- List integrationsPOST /api/doctor- Run diagnosticsGET /api/events- SSE event stream
WebSocket Chat
Real-time bidirectional chat via WebSocket:Webhook Integrations
The gateway supports webhooks from multiple platforms:GET /whatsapp- Meta webhook verificationPOST /whatsapp- Receive messages
GitHub
POST /github- Issue/PR comment webhook
Nextcloud Talk
POST /nextcloud-talk- Bot webhook
Reverse Proxy Setup
For production, use a reverse proxy like Nginx or Caddy:Nginx
Caddy
Tunneling
For development or testing, use tunnels:Cloudflare Tunnel
Ngrok
Docker Setup
Run the gateway in Docker:Best Practices
Always use pairing in production
Always use pairing in production
Use HTTPS via reverse proxy or tunnel
Use HTTPS via reverse proxy or tunnel
Never expose the gateway directly on HTTP in production. Use:
- Reverse proxy with TLS (Nginx, Caddy)
- Cloudflare Tunnel
- Ngrok with custom domain
Configure rate limits appropriately
Configure rate limits appropriately
Adjust based on your traffic:
Monitor with Prometheus
Monitor with Prometheus
Scrape
/metrics endpoint:Use idempotency for critical webhooks
Use idempotency for critical webhooks
Send
X-Idempotency-Key header:Next Steps
Deployment
Deploy ZeroClaw to production
Creating Channels
Add messaging platform support