Docs/Server/API and events

HTTP API and events

The HolaClaw Server control API, how clients authenticate with the socket or a bearer token, every endpoint with its scope, and the event stream with its event types.

12 min read Updated November 17, 2026
  • Server
  • Reference
  • API

Every client of HolaClaw Server talks to the daemon over one HTTP/JSON API: the holaclaw command, the HolaClaw apps and your own scripts. It has one resumable event stream per client window, for following a conversation as it runs.

The API lives under /v1. Within /v1, changes are additive only. The OpenAPI specification is api/openapi.yaml in the repository.

Authentication

There are two ways in:

Transport Who you are How
The unix socket the owner, with admin scope whoever can open the socket. Its path is server.socket, /run/holaclaw/holaclaw.sock on a system install.
TCP (server.listen) the identity the token belongs to Authorization: Bearer <token> on every request
Terminal
sudo -u holaclaw curl --unix-socket /run/holaclaw/holaclaw.sock http://localhost/v1/status
curl -H "Authorization: Bearer $HOLACLAW_TOKEN" http://127.0.0.1:8484/v1/status

TCP is off unless server.listen is set, and an address off loopback needs TLS. See config.toml.

Two calls take no bearer token: pairing a device (POST /v1/pair), where the invite code is the credential, and the browser's live-view WebSocket, which takes a single-use ticket instead.

Tokens

Tokens start with hb_ and are shown once, when they are created. Get one with:

  • holaclaw init --token-file <path>, which writes an admin token for the owner;
  • holaclaw token create, for an identity or an existing binding;
  • pairing a device with an invite code.

See the token commands.

Scopes

Every endpoint needs one of two scopes:

  • client: a person's own conversations, the event stream for them, status, agents, models, channels and skills.
  • admin: everything client can do, plus approvals, identities, invites, tokens, tasks, memory, connectors, credentials, channel and provider sign-ins, skill changes, backups and taking over the browser.

A token is client unless created otherwise, and a user can hold only client tokens. A request acts at the lower of the token's scope and the identity's role. What each role and scope may reach is in Security and hardening.

Errors

An error answers with a JSON body {"code": "…", "message": "…"}. The codes are stable: bad_request, unauthorized, forbidden, identity_disabled, not_found, conflict, too_large, rate_limited, not_implemented, not_initialised and internal. Until holaclaw init has created the owner, every call answers 503 with not_initialised.

Endpoints

Paths are relative to /v1.

System

Method Path Scope What it does
GET /status client Version, uptime, active sessions, pending approvals.
GET /agents client The configured agents.
GET /models client The configured models.
GET /channels client The channels and their state.
GET /traces/{id} client One trace: its events and messages. A client token reads only traces of its own sessions.
GET /events client The event stream. See The event stream.

Sessions and messages

Method Path Scope What it does
GET /sessions client The caller's sessions, rooms left out.
POST /sessions client Creates a session, or returns the existing one (200) for the same conversation id. Takes agent (default main), conversation and title.
GET /sessions/{id} client One session.
DELETE /sessions/{id} client Deletes a session, with its messages, events, blobs and recall.
POST /sessions/{id}/messages client Stores a message and queues a turn. Answers 202 with the trace_id.
GET /sessions/{id}/messages client The messages, with after and limit (up to 500).
POST /sessions/{id}/abort client Aborts the running turn.
GET /sessions/{id}/traces client One line per trace of the session, newest first.
POST /blobs client Uploads an attachment.
GET /blobs/{id} client Reads a blob referenced by a message the caller may see.

A message takes a client-generated ULID as id, which is its idempotency key for 10 minutes: a resend is accepted with duplicate: true and starts no second turn. Send it as JSON, or as multipart/form-data with a message part (the JSON) and any number of file parts.

A session that continues on another channel, or a task's session, is read-only for the caller: sending to it answers 409.

You and your devices

Method Path Scope What it does
GET /me client Who the caller is: identity, role, effective scope, binding and token.
GET /me/devices client The caller's own holaclaw bindings.
POST /me/devices client Mints an invite onto the caller's own identity, to pair another device. Expires after 15 minutes.
DELETE /me/devices/{binding} client Removes one of the caller's bindings and revokes its tokens.
POST /me/token/rotate client Rotates the token that signs this request and returns the new secret.
POST /pair none Pairs a device with an invite code. Returns its first token, once.

Approvals

Method Path Scope What it does
GET /approvals admin The pending approvals.
POST /approvals/{id} admin Answers one: {"approve": true, "choice": "once"}. choice is once (default), session or always.

Identities, invites and tokens

Method Path Scope What it does
GET /identities admin Identities with their bindings. pending=true lists only the unconfirmed ones.
POST /identities admin Creates a confirmed identity with no bindings.
GET /identities/{id} admin One identity.
PATCH /identities/{id} admin Confirms a pending identity, or renames one or changes its role.
DELETE /identities/{id} admin Deletes an identity. Its tasks are cancelled; its own memory is forgotten unless keep_memory=true.
POST /identities/{id}/assign admin Moves a pending identity onto a confirmed one.
POST /identities/{id}/disable admin Switches an identity or a room off.
POST /identities/{id}/enable admin Switches it back on.
DELETE /bindings/{ref} admin Removes one binding.
POST /invites admin Mints a one-shot code for one channel instance.
GET /tokens admin Active tokens. all=true adds revoked ones; identity and binding filter.
POST /tokens admin Mints a token. The secret is shown once.
PATCH /tokens/{id} admin Raises or lowers a token's scope.
DELETE /tokens/{id} admin Revokes a token. Its binding stays.
POST /tokens/{id}/rotate admin Replaces a token with a new one on the same binding.

Tasks

Method Path Scope What it does
GET /tasks admin Every task, newest first.
POST /tasks admin Creates a task. See Scheduled tasks.
GET /tasks/{id} admin One task, with its grants.
DELETE /tasks/{id} admin Cancels a task and revokes its grants.

Memory

Method Path Scope What it does
GET /memory admin Searches memory. Needs agent and partition.
POST /memory admin Writes a note.
DELETE /memory/{id} admin Forgets one memory.
GET /memory/partitions admin The memory partitions of one agent.

Skills

Method Path Scope What it does
GET /skills client One agent's skills, whether each is eligible, and the trash.
GET /skills/{id} client One skill: body, raw file and versions.
POST /skills/upload admin Uploads a local skill folder for an install.
POST /skills admin Installs, or previews, a skill from an upload or a git repository.
POST /skills/{id}/revert admin Makes an earlier version current.
POST /skills/{id}/restore admin Brings a skill back from the trash.
DELETE /skills/{id} admin Moves a skill to the trash, or deletes it from there.

Connectors

Method Path Scope What it does
GET /connectors admin Every connector.
POST /connectors admin Creates a connector.
POST /connectors/inspect admin Asks a server what it is, without signing in. Stores nothing.
GET /connectors/{id} admin One connector, with its tools.
POST /connectors/{id}/code admin Finishes the open sign-in with the redirect's code.
POST /connectors/{id}/reconnect admin Opens a new sign-in.
DELETE /connectors/{id} admin Deletes a connector in any state.

Credentials and sign-ins

Method Path Scope What it does
PUT /credentials/{provider} admin Sets a provider's credentials. Write-only: there is no way to read them back.
POST /credentials/{provider}/login admin Starts a device-code sign-in (ChatGPT subscription).
GET /credentials/{provider}/login admin Polls that sign-in.
POST /channels/{name}/login admin Starts a pairing-code link (WhatsApp).
GET /channels/{name}/login admin Polls the link.
DELETE /channels/{name}/login admin Unlinks the channel, or cancels a pending link.

Backups

Method Path Scope What it does
GET /backups admin The backups the daemon keeps, newest first.
POST /backups admin Takes a backup. Answers 202 at once; poll the record until it is ready or failed. One at a time.
POST /backups/upload admin Hands the daemon an archive to keep. Restores nothing.
GET /backups/{id} admin One backup.
GET /backups/{id}/content admin Downloads a ready backup's archive.
POST /backups/{id}/verify admin Checks the archive against its manifest.
POST /backups/{id}/restore admin Replaces the database and blobs, then restarts the daemon. Expect the connection to drop.
DELETE /backups/{id} admin Deletes a backup, or cancels a running one.

Browser

Method Path Scope What it does
GET /browser/sessions client The running agent browsers.
POST /browser/sessions/{agent}/view client Issues a short-lived, single-use ticket for the live view.
GET /browser/sessions/{agent}/stream ticket The live view, as a WebSocket.
POST /browser/sessions/{agent}/takeover admin Takes control of the browser. The running browser task pauses.
POST /browser/sessions/{agent}/release admin Hands the browser back.
GET /browser/viewer client A minimal built-in viewer page, for testing the live view.

The event stream

GET /v1/events is a stream of server-sent events. Open one per client window.

Terminal
sudo -u holaclaw curl -N --unix-socket /run/holaclaw/holaclaw.sock http://localhost/v1/events
  • Frames. Each event is an id: line, an event: line with its type, and a data: line with the event as JSON.
  • Focus. ?focus=<session id> sends full events for that session, and slim notifications (type, session_id, id) for the others.
  • Resume. Send the last id you got as the Last-Event-ID header to pick up where you left off.
  • Heartbeat. A comment line every 15 seconds keeps the connection open.
  • Streaming text. model.token events carry the reply as it is generated, and have no id:, so a resume lands on the last stored event. A stream that opens in the middle of a turn first gets one model.partial with the text so far. A turn's text ends with its reply, run.finished or run.aborted.
  • Who sees what. A token sees the events of its own sessions. An admin token also sees events that belong to no session. The socket sees everything.

Each event has this shape:

json
{
  "schema": 1,
  "id": "…",
  "trace_id": "…",
  "span_id": "…",
  "parent_id": "…",
  "session_id": "…",
  "type": "tool.call",
  "time": "2026-11-17T09:14:03Z",
  "duration_ns": 1200000,
  "message_id": "…",
  "attrs": {}
}

The same events make up a trace, which holaclaw trace <id> and GET /v1/traces/{id} show.

Usage and cost

Every event that records a model call carries its usage in attrs:

  • prompt_tokens and completion_tokens, always (0 when the provider reported none);
  • cost_nanousd, the cost in billionths of a US dollar, so sums are exact; cached_tokens and reasoning_tokens, only when the provider reported them;
  • unpriced_calls, how many calls reported no cost.

A call without a cost, such as one to a local model or a subscription, is unpriced, not free. A free model reports a cost of 0. To total a trace or a session, sum over the event types marked "counted" below.

Event types

New types are added over time; existing ones are not removed, so ignore types you do not know.

Group Types
Turns run.started, run.finished, run.aborted, run.step_limit, run.loop_detected, reply
Model calls model.request, model.response (counted), model.error (counted), model.fallback, model.progress, model.usage_limit, model.token and model.partial (streamed only, never stored)
Context context.built, context.compacted (counted)
Tools tool.call, tool.result (counted), tool.rejected, tool.repaired
Policy policy.decision, guard.decision (counted), approval.requested, approval.resolved
Channels channel.received, channel.sent, channel.reacted, channel.status, delivery.degraded
Routing and access router.resolved, router.dropped, access.granted
Identities identity.created, identity.confirmed, identity.assigned, identity.bound, identity.unbound, identity.disabled, identity.enabled, identity.deleted
Tokens token.created, token.updated, token.revoked, auth.refreshed
Memory memory.saved, memory.forgotten, memory.injected, memory.embedded (counted)
Media media.described, media.transcribed, media.refused, image.generated (all counted)
Skills skill.loaded, skill.saved, skill.forgotten, skill.restored, skill.reverted, skill.installed
Tasks task.scheduled, task.started, task.finished, task.missed
Connectors connector.status
Browser browser.task.started, browser.task.finished (counted), browser.step, browser.move, browser.blocked, browser.download, browser.takeover.requested, browser.takeover.started, browser.takeover.ended
Backups backup.created, backup.failed, backup.deleted, backup.restored

A few that are useful to watch:

  • reply carries the agent's answer, including a scheduled task's result in a session with no channel.
  • approval.requested means a tool call is waiting for an owner or admin.
  • policy.decision records every step of the policy for a tool call, never its arguments.
  • tool.result carries taint_score for untrusted content.
  • channel.reacted is the agent reacting on a channel: attrs.emoji on the message message_id.
  • task.missed reports runs that came due while the daemon was down, or were dropped because the previous run was still going.

Was this page helpful?

Can’t find what you need?

Ask the community on Discord.