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 usesPOSTfor most mutations including deletes (the delete target is in the JSON body), rather thanDELETE. A handful of newer endpoints usePATCH/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:
(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=…) usesmsg_limitfor a tail window andmsg_beforefor the zero-based scroll-back index; usemessages=0for metadata only. See the sessions reference for limits, truncation metadata and explicit full-transcript behaviour. - Search (
GET /api/sessions/search) usesq,content=1or0(also search message bodies), anddepth(default5;0searches 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_atandlast_message_atare 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(not0/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.