Skip to content

Conventions

Shared rules that apply across the whole bridge API. Read once; they hold for every endpoint in the reference.

Base URL

Every path in this reference is relative to the origin of your Hermes WebUI server — e.g. https://hermes.example.com or http://127.0.0.1:8787. There is no /v1 version prefix; the surface is versioned by the server release (see Insights & updates for the running version).

Headers

Header When
Content-Type: application/json On any request with a JSON body (most POSTs).
Accept: text/event-stream On the SSE streaming GETs.
Cookie: hermes_session=… On every request once logged in (your HTTP session replays it automatically).
X-Hermes-CSRF-Token: … Signed-in browser POST/PUT/PATCH/DELETE requests on a password-protected instance; use the current session token the WebUI page supplies. Never publish a real token or cookie value.
Authorization / X-Api-Key / custom Only for proxy/token-gated deployments — see Authentication.

Uploads (/api/upload, /api/transcribe) use multipart/form-data instead of JSON — noted per endpoint.

Methods

  • GET — usually retrieves data (lists, details, streams, status), but some compatibility endpoints change state, including /api/chat/cancel. Follow each endpoint's documented behaviour.
  • POST — everything mutating (create, rename, delete-by-body, chat, git ops, cron ops). Hermes uses POST for most mutations including deletes (the delete target is in the JSON body), rather than DELETE. A handful of newer endpoints use PATCH/DELETE/PUT — noted per endpoint.

Session IDs

Most endpoints operate on a session (a conversation). A session_id is an opaque string returned by /api/sessions and /api/session/new. Pass it either as a query param (?session_id=… on GETs) or in the JSON body (on POSTs) — each endpoint's spec says which. Workspace, git, file, approval, and clarify calls are all scoped by session_id.

Response shape

Successful JSON responses are objects. List endpoints wrap their array under a named key ({ "sessions": [...] }, { "projects": [...] }, { "crons": [...] }) rather than returning a bare array, so the response can carry sibling metadata. Field names are snake_case.

Errors

Failed requests use standard HTTP status codes with a JSON body:

{ "error": "human-readable message" }

(Some endpoints also include a detail or message field.) Common codes:

Status Meaning
400 Malformed request (bad/missing params or body).
401 Not authenticated — log in (see Authentication).
403 Authenticated but the action is refused.
404 No such session / resource / path.
409 Conflict (e.g. a git operation that can't proceed).
429 Rate-limited (repeated login attempts).
500 Server-side failure — surface the message; safe to retry idempotent reads.

A client should treat any non-2xx as a failure and read the error field for display.

Pagination & large payloads

  • Session list returns all sessions (sidebar-sized). Session detail (GET /api/session?session_id=…) uses msg_limit for a tail window and msg_before for the zero-based scroll-back index; use messages=0 for metadata only. See the sessions reference for limits, truncation metadata and explicit full-transcript behaviour.
  • Search (GET /api/sessions/search) uses q, content=1 or 0 (also search message bodies), and depth (default 5; 0 searches the full transcript).
  • These are query-string names, not camelCase JSON fields.
  • File reads stream raw bytes (/api/file/raw, /api/media); JSON file reads come via /api/file.

IDs, timestamps, and booleans

  • Timestamp formats are endpoint-specific. Session created_at, updated_at and last_message_at are Unix epoch seconds and may have a fractional part; some other fields use ISO-8601 strings. Do not run an ISO parser over every timestamp; keep the units and nullability documented for each field.
  • Booleans are JSON true/false (not 0/1).
  • Message ids within a session are integers; session/project/cron ids are strings.

Idempotency & retries

Never infer retry safety from the HTTP method alone: some GETs change state (for example /api/chat/cancel). Retry only operations documented as safe to repeat. Mutations are generally not idempotent (a second /api/session/new makes a second session); after a timeout on a mutating request, check state first (e.g. re-list sessions) before repeating it.

Streaming

Anything real-time (live chat, approvals, clarifications) is Server-Sent Events, documented in Streaming (SSE). SSE GETs are long-lived — don't apply your normal short request timeout to them.