Read the last N lines of a session's terminal output.
Renders the tail of an interactive session's PTY output server-side, without attaching or streaming, and without requiring the session host to be online. Output is served from the relay's retained snapshot plus the frames after it while the session's room is live, and from the session recording once it is not. The rendered lines are a derived projection of the terminal, not authoritative screen state; pass raw=1 for the exact encoded frames instead. Lines are PHYSICAL terminal rows, so one wrapped logical line counts as several. truncated=true means older output was dropped before rendering, and snapshotDegraded=true means the screen the lines continue could not be decoded, so they were rendered onto a blank grid. Reading a session recording requires a human user identity; API keys and OAuth-agent tokens can read a live tail only. The id may be the canonical session id or its 16-hex public session hash.
AuthorizationBearer <rsk_live_*>Rensei API key presented as Authorization: Bearer rsk_live_. Required API-key scopes are recorded per operation in x-rensei-required-scopes.
sessionId*string1 <= length <= 256lines?integer1 <= value <= 2000raw?string"0""1""true""false"The session tail.
application/json- response
sessionId*stringepoch*integer-9007199254740991 <= value <= 9007199254740991asOfSeq*integer-9007199254740991 <= value <= 9007199254740991truncated*booleansource*string"live""recording"snapshotDegraded?booleanlines?array<string>raw?array<string>curl -X GET 'https://app.rensei.ai/api/cli/sessions/string/tail'{ "sessionId": "string", "epoch": -9007199254740991, "asOfSeq": -9007199254740991, "truncated": true, "source": "live", "snapshotDegraded": true, "lines": [ "string" ], "raw": [ "string" ]}Replay the ledger event channel for one admitted session.
Returns append-only ledger lifecycle events after the supplied cursor. The cursor is a tuple ({ledgerSeq, structuredSeq, terminalByteOffset}); it deliberately does not impose a single total order across database commits, harness events, and terminal bytes.
Stream ledger lifecycle events for one admitted session.
Server-sent events. Each UNNAMED (default `message`) frame is one SessionEventEnvelope carrying its channel discriminator and native cursor. Two named control events are interleaved: `heartbeat` ({timestamp}) every 15s so an idle stream is provably alive, and `reconnect` ({reason, timestamp}) immediately before the stream self-closes at its lifetime bound - resume from the last envelope cursor. A close without a `reconnect` event means the session reached a terminal phase and its events are drained. Closing the connection is a delivery boundary only: it never changes session identity or terminal state.