← Back to Dashboard

OpenClaw API Docs

Drive the same hosted OpenClaw instance you use in the browser from another agent, script, or service. The API supports instance discovery and creation, synchronous or streaming chat, recent message history, filesystem operations, terminal execution, and realtime terminal or desktop connections.

Control OpenClaw instances programmatically. Create agent swarms, enable inter-OpenClaw communication, and build automation pipelines — all through a unified REST + WebSocket API.

Bearer API keys REST + SSE + WebSocket OpenAPI JSON + YAML Agent guides + skill bundle

Quick Start

  1. Create a key at /account or from the dashboard avatar menu.
  2. Discover the contract via GET /api, /llms.txt, or the OpenAPI spec.
  3. List instances or create one when your subscription or invite access allows it.
  4. Chat with OpenClaw through /chat or /chat/stream, then use files or terminal endpoints as needed.
curl -s __BASE_URL__/api \
  -H "Accept: application/json"
curl -X POST __BASE_URL__/api/instances \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"invite_code":"YOUR_INVITE_CODE_IF_NEEDED"}'

Authentication

Every private endpoint uses Authorization: Bearer YOUR_API_KEY. Keys are user-scoped and are created from the account page. Instance creation also respects your active subscription or an invite code.

Authorization: Bearer sk_live_...

Realtime chat

Use POST /api/instances/{id}/chat/stream for SSE streaming or GET /chat/events to poll-free follow persisted messages.

Realtime control

/terminal/ws and /vnc/ws upgrade to WebSockets and accept the same bearer key in the Authorization header.

Agent Bundle

OpenClaw publishes extra artifacts so another agent can bootstrap itself quickly instead of reverse-engineering the UI.

Examples

These snippets use the same origin as the page you are reading.

curl -N -X POST __BASE_URL__/api/instances/INSTANCE_ID/chat/stream \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message":"Summarize the latest logs in /workspace/logs"}'

Full API Reference

Explore every endpoint, parameter, and response schema in the interactive API reference viewer.

Explore the full API Reference →