Read the structured program state, latest-wins per key.
The queryable half of the ledger: one JSON value per key with its version, author and timestamp. With ?key=<key> reads that key append history newest-first (use limit to bound it); without it reads the latest value of the 500 most recently written keys (sorted by key), with truncated and the total keyCount when the program holds more. Visibility matches the program itself.
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.
programId*string^prog_[0-9a-f]{32}$key?string1 <= length <= 128limit?integer1 <= value <= 200Current program state, or one key history.
application/json- response
ledgerVersion*stringprogramVersion*stringprogramId*string^prog_[0-9a-f]{32}$states*array<>items <= 500truncated*booleankeyCount*integer0 <= value <= 9007199254740991curl -X GET 'https://app.rensei.ai/api/cli/programs/string/state'{ "ledgerVersion": "rensei.session-ledger/v1alpha1", "programVersion": "rensei.session-ledger.program/v1alpha1", "programId": "string", "states": [ { "ledgerVersion": "rensei.session-ledger/v1alpha1", "programVersion": "rensei.session-ledger.program/v1alpha1", "programId": "string", "key": "string", "version": 1, "value": null, "author": { "kind": "human", "id": "string" }, "createdAt": "2019-08-24T14:15:22Z" } ], "truncated": true, "keyCount": 0}Read the current resumable topology for one program ledger.
One authoritative read joins the immutable program event stream to current session-ledger edges and nodes, and inlines the most recent program records so a cold session needs one call rather than three. Terminal children are absent even when no later program event was appended. mailbox counts one reader's unread mail (broadcasts plus records addressed to it or to one of the comma-separated roles it claims): the authenticated principal by default, or readerSessionId when named. It is null when no reader can be attributed.
Compare-and-set write of one structured program state key.
Latest-wins per key with history: every write appends one versioned row. Omit expectedVersion (or null) to create the key; pass a version to require the current version to match. A mismatch is refused with 409, never merged. A program holds at most 1,000 distinct keys: creating one more is refused with 422 (existing keys keep writing; state is append-only, so keys are never removed). Queue actions append, claim and complete operate on the queue key with an explicit expectedVersion (null creates it). Append requires id, projectId and title; claim and complete require id. claimedBy is the server-derived principal ref. Non-open claims and completion by another principal are refused with typed codes. Every queue mutation appends a history row; queues over 16 KiB are refused. The author is derived from the authenticating principal and is never read from the body.