Skip to content

Stream events

GET
/api/events
Code sample: Shell / cURL
curl --request GET \
--url http://127.0.0.1:8004/api/events \
--header 'Authorization: Bearer <token>'

Newline-delimited JSON, one event per line, until the client disconnects. The first is ready, with the sessions the events after it change; resync marks where events were lost. Empty lines keep the connection alive. Each event is {time, type, ...}, time in Unix milliseconds. Guest (sandboxed) credentials can’t use it.

session
string

A session ID or name: only that session’s events, ending once it closes.

One event per line

Media typeapplication/x-ndjson

One line of the stream.

object
One of:

First on every stream: the state the events after it change, and the session session named, if any.

object
version
required
string
session_id
string | null format: uuid
sessions
required
Array<object>
object
id
required
string format: uuid
name
required
string
runtime

Where a session’s shells run.

One of:
object
type
required
string
Allowed values: local
windows
required
Array<object>
object
id
required
string format: uuid
name
required
string
panes
required
Array<object>
object
id
required
string format: uuid
title
string | null
cwd
string | null
cwd_remote

cwd is on another host.

boolean
agent_status
object
state
required

Lifecycle states for an agent occupying a pane.

This intentionally follows Herdr’s small semantic vocabulary. Failure and permission details belong in the accompanying message/notification instead of multiplying lifecycle states.

string
Allowed values: unknown idle working waiting blocked done
agent
string | null
source
string | null
message
string | null
background

Background work the agent’s screen shows, such as “2 shells, 1 monitor”.

string | null
agent_id

Names the running agent instance, so a client can target it.

integer | null format: int64
agent_since

When the agent entered its current state, in Unix seconds.

integer | null format: int64
unread
One of:

A pane notification nobody has viewed yet.

object
level
required
string
Allowed values: info attention success error
title
string | null
body
string | null
git
One of:

A pane’s place in a git repo.

object
repo_id
required

The repo’s common git dir, shared by all its worktrees.

string
repo_name
required
string
worktree_root
required
string
branch

None when HEAD is detached.

string | null
main_worktree
required

The repo’s main worktree rather than a linked one.

boolean
editor

The native editor over a pane, the same in every tab.

object
shown
required
boolean
files
required

Open files (absolute paths), in tab order.

Array<string>
active
string | null
active_pane
required
integer
layout
required
One of:
object
pane_id
required
string format: uuid
type
required
string
Allowed values: leaf
zoomed_pane
string | null format: uuid
active_window
required
integer
type
required
string
Allowed values: ready
time
required

Unix milliseconds.

integer format: int64

Example

{
"type": "session_created"
}

A malformed query parameter

Media typetext/plain
string

Missing or wrong access token

Media typetext/plain
string

The request’s Host or Origin isn’t allowed, or the caller can’t use this route (a guest token, or btmux connect)

No such session

Media typetext/plain
string