Skip to content

API Reference

OpenClaw HTTP API documentation.

Authentication

All API requests require authentication:

bash
curl -H "Authorization: Bearer YOUR_GATEWAY_TOKEN" \
  http://localhost:3000/api/endpoint

Endpoints

Health Check

GET /health

Response:

json
{
  "status": "ok",
  "version": "2026.2.13",
  "uptime": 86400
}

Status

GET /api/status

Response:

json
{
  "gateway": "running",
  "channels": {
    "telegram": "connected",
    "discord": "connected"
  },
  "sessions": 5,
  "memory": {
    "used": 256,
    "total": 512
  }
}

Sessions

List Sessions

GET /api/sessions

Response:

json
{
  "sessions": [
    {
      "id": "session-123",
      "channel": "telegram",
      "userId": "user-456",
      "messageCount": 42,
      "lastActivity": "2026-02-14T12:00:00Z"
    }
  ]
}

Get Session

GET /api/sessions/:id

Delete Session

DELETE /api/sessions/:id

Messages

Send Message

POST /api/messages

Body:

json
{
  "channel": "telegram",
  "userId": "user-123",
  "message": "Hello from API!"
}

Channels

List Channels

GET /api/channels

Response:

json
{
  "channels": [
    {
      "name": "telegram",
      "status": "connected",
      "messagesReceived": 1000,
      "messagesSent": 500
    }
  ]
}

Tools

List Tools

GET /api/tools

Response:

json
{
  "tools": [
    {
      "name": "read",
      "description": "Read file contents",
      "enabled": true
    }
  ]
}

Invoke Tool

POST /api/tools/:name/invoke

Body:

json
{
  "params": {
    "path": "/path/to/file"
  }
}

Cron

List Jobs

GET /api/cron

Run Job

POST /api/cron/:id/run

Configuration

Get Config

GET /api/config

Update Config

PATCH /api/config

Body:

json
{
  "logging": {
    "level": "debug"
  }
}

WebSocket API

Connect to real-time events:

javascript
const ws = new WebSocket('ws://localhost:3000/ws');

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log('Event:', data.type, data.payload);
};

Events

EventDescription
message:receivedNew message from channel
message:sentMessage sent to channel
session:createdNew session created
tool:invokedTool was called
errorError occurred

Error Responses

All errors follow this format:

json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "Description of the error",
    "details": {}
  }
}

Error Codes

CodeDescription
UNAUTHORIZEDMissing or invalid token
FORBIDDENInsufficient permissions
NOT_FOUNDResource not found
INVALID_REQUESTMalformed request
RATE_LIMITEDToo many requests
INTERNAL_ERRORServer error

Rate Limits

EndpointLimit
/api/messages100/minute
/api/tools/invoke50/minute
Other endpoints200/minute

API Client

Use the official OpenClaw SDK for your language:

  • JavaScript: npm install @openclaw/sdk
  • Python: pip install openclaw

Released under the MIT License.