Skip to main content
The HTTP gateway exposes ZeroClaw’s capabilities via REST API, webhooks, WebSocket, and a web dashboard. It’s built on Axum with proper HTTP/1.1 compliance, security, and rate limiting.

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

Configuration

Configure the gateway in config.toml:

Security

Pairing System

The gateway uses a secure pairing flow:
  1. One-time code: Generated on startup (8-character alphanumeric)
  2. Rate limiting: 10 pairing attempts per minute per IP
  3. Lockout: 5-minute lockout after 3 failed attempts
  4. Bearer tokens: Long-lived tokens (256-bit random)
  5. Persistence: Tokens saved to config.toml

Public Bind Protection

The gateway refuses unsafe configurations:
Error:
Safe options:
  1. Use a tunnel (recommended):
  2. Explicit opt-in (for internal networks only):

Rate Limiting

The gateway implements sliding-window rate limiting:
Rate limits are per-IP and configurable:

Webhook Secrets

Protect webhook endpoints with shared secrets:
The gateway validates requests:

API Endpoints

Core Endpoints

Exchange pairing code for bearer token.Request:
Response:
Send a message to the agent (no tools).Request:
Response:
Full agent loop with tool execution.Request:
Response:
Drop-in replacement for OpenAI API.Request:
Response:
Check gateway status (always public).Request:
Response:
Prometheus-compatible metrics (requires auth or localhost).Request:
Response:

Dashboard API

All dashboard endpoints require bearer token authentication:
  • GET /api/status - System status overview
  • GET /api/config - Current configuration (secrets masked)
  • PUT /api/config - Update configuration
  • GET /api/tools - List available tools
  • GET /api/memory - List/search memory entries
  • POST /api/memory - Store memory entry
  • DELETE /api/memory/:key - Delete memory entry
  • GET /api/cost - Cost tracking summary
  • GET /api/cron - List cron jobs
  • POST /api/cron - Add cron job
  • DELETE /api/cron/:id - Remove cron job
  • GET /api/integrations - List integrations
  • POST /api/doctor - Run diagnostics
  • GET /api/events - SSE event stream

WebSocket Chat

Real-time bidirectional chat via WebSocket:

Webhook Integrations

The gateway supports webhooks from multiple platforms:

WhatsApp

Endpoints:
  • GET /whatsapp - Meta webhook verification
  • POST /whatsapp - Receive messages

GitHub

Endpoint:
  • POST /github - Issue/PR comment webhook

Nextcloud Talk

Endpoint:
  • POST /nextcloud-talk - Bot webhook

Reverse Proxy Setup

For production, use a reverse proxy like Nginx or Caddy:

Nginx

Enable forwarded header trust:

Caddy

Tunneling

For development or testing, use tunnels:

Cloudflare Tunnel

Ngrok

Docker Setup

Run the gateway in Docker:
Start:

Best Practices

Never expose the gateway directly on HTTP in production. Use:
  • Reverse proxy with TLS (Nginx, Caddy)
  • Cloudflare Tunnel
  • Ngrok with custom domain
Adjust based on your traffic:
Scrape /metrics endpoint:
Send X-Idempotency-Key header:

Next Steps

Deployment

Deploy ZeroClaw to production

Creating Channels

Add messaging platform support