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:
model
string
required
Model identifier (e.g., "openclaw", "gpt-4"). Maps to OpenClaw agent.
messages
array
required
Array of message objects with role and content
stream
boolean
default:false
Enable streaming responses (SSE)
user
string
User identifier for session scoping
Response:
id
string
Completion ID (format: chatcmpl_<uuid>)
object
string
"chat.completion" or "chat.completion.chunk" (for streaming)
created
number
Unix timestamp
model
string
Model identifier from request
choices
array
Array of completion choices
usage
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:
message
string
required
User message to send to agent
agentId
string
Target agent ID (defaults to configured default)
sessionKey
string
Session key for conversation context
name
string
Display name for the sender
deliver
boolean
default:true
Whether to deliver response via channel
channel
string
Channel to deliver response (e.g., "signal", "telegram", "discord")
to
string
Recipient identifier (phone number, user ID, etc.)
model
string
Override model for this request
thinking
string
Thinking budget: "low", "medium", "high"
wakeMode
string
default:"now"
"now" or "next-heartbeat"
timeoutSeconds
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:
tool
string
required
Tool name to invoke
params
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