Rensei docs

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.

GET
/api/cli/sessions/{sessionId}/tail

Authorization

headerAuthorizationBearer <rsk_live_*>

Rensei API key presented as Authorization: Bearer rsk_live_. Required API-key scopes are recorded per operation in x-rensei-required-scopes.

Path Parameters

sessionId*string
Length1 <= length <= 256

Query Parameters

lines?integer
Range1 <= value <= 2000
raw?string
Value in"0""1""true""false"

Response Body

The session tail.

application/json
  1. response
sessionId*string
epoch*integer
Range-9007199254740991 <= value <= 9007199254740991
asOfSeq*integer
Range-9007199254740991 <= value <= 9007199254740991
truncated*boolean
source*string
Value in"live""recording"
snapshotDegraded?boolean
lines?array<string>
raw?array<string>
Example Request
curl -X GET 'https://app.rensei.ai/api/cli/sessions/string/tail'
Example Response
{  "sessionId": "string",  "epoch": -9007199254740991,  "asOfSeq": -9007199254740991,  "truncated": true,  "source": "live",  "snapshotDegraded": true,  "lines": [    "string"  ],  "raw": [    "string"  ]}