Skip to main content

REST Endpoints

The OpenClaw Gateway provides HTTP REST endpoints for specific use cases including OpenAI compatibility, webhooks, and tool invocation.

OpenAI-Compatible Chat Completions

POST /v1/chat/completions

OpenAI-compatible chat completions endpoint. Authentication:
Request Body:
string
required
Model identifier (e.g., "openclaw", "gpt-4"). Maps to OpenClaw agent.
array
required
Array of message objects with role and content
boolean
default:false
Enable streaming responses (SSE)
string
User identifier for session scoping
Response:
string
Completion ID (format: chatcmpl_<uuid>)
string
"chat.completion" or "chat.completion.chunk" (for streaming)
number
Unix timestamp
string
Model identifier from request
array
Array of completion choices
object
Token usage statistics
Example (Non-Streaming):
Response:
Example (Streaming):
Streaming Response (SSE):

Webhook Endpoints (Hooks)

POST /hooks/:path

Custom webhook endpoints for external integrations. Configuration:
Authentication:
Or:
Wake Endpoint:
Agent Endpoint:
string
required
User message to send to agent
string
Target agent ID (defaults to configured default)
string
Session key for conversation context
string
Display name for the sender
boolean
default:true
Whether to deliver response via channel
string
Channel to deliver response (e.g., "signal", "telegram", "discord")
string
Recipient identifier (phone number, user ID, etc.)
string
Override model for this request
string
Thinking budget: "low", "medium", "high"
string
default:"now"
"now" or "next-heartbeat"
number
Request timeout in seconds
Response:
Custom Mappings: You can define custom webhook mappings:
See Hooks for details.

Tool Invocation

POST /api/tools/invoke

HTTP-based tool invocation endpoint. Authentication:
Request Body:
string
required
Tool name to invoke
object
Tool-specific parameters
Example:
Response:

Channel Endpoints

POST /api/slack/events

Slack Events API endpoint for receiving Slack app events. Authentication: Handled via Slack signing secret verification. Request Body: Slack event payload (see Slack Events API). Response:
See Slack Integration for setup.

/api/channels/:channelId/*

Channel-specific HTTP endpoints exposed by channel plugins. Authentication:
Examples:
  • /api/channels/telegram/webhook - Telegram webhook
  • /api/channels/discord/interactions - Discord interactions
Channel endpoints are dynamically registered by plugins. See individual channel documentation.

Health Check

GET /health

Health check endpoint (no authentication required). Response:

Error Responses

All REST endpoints return standard error responses: 400 Bad Request:
401 Unauthorized:
429 Too Many Requests:
500 Internal Server Error:

Next Steps

Hooks

Configure webhook integrations

OpenAI Compatibility

Use OpenAI-compatible API