Rensei docs
API ReferenceWorker Protocol

Resolve credential env map for a session

Runtime-worker-JWT-only secret-release endpoint used at session spawn. Requires `worker:session`. Before any credential read, the platform resolves the canonical scope from the active worker row and claimed session: JWT worker (`sub`), org, and project claims must exactly match the active worker; the session must be owned by that worker in the same organization, and session project metadata must match when present. Body `orgId` must match that canonical scope and optional `projectId` is an exact assertion, never an override. Missing or mismatched ownership is collapsed to 404. Returns the blocklist-filtered agent environment and refresh horizon. The optional synthetic `poolId` is cost-attribution metadata and is not emitted into the agent environment. Audit is appended asynchronously without secret values.

POST
/api/daemon/credentials/snapshot

Authorization

workerJwt
headerAuthorizationBearer <JWT>

Short-lived worker runtime JWT minted by the platform. Claims bind the worker, project, organization, registration, and scopes.

Request Body

application/json
  1. body
orgId*string

Must exactly match the runtime worker JWT and canonical active-worker scope.

projectId?string

Optional request assertion. When supplied, must exactly match the session's canonical project, which must be in the active worker's current projectIds set.

envName?string

Environment name for resolution (ADR-2026-05-14).

sessionId*string

Claimed session id. The session must be owned by the runtime worker JWT subject in the canonical active-worker org/project scope.

Response Body

Credential snapshot for the canonically owned worker session.

application/json
  1. response
env*

Resolved credential env-var map (secrets are not logged).

refreshUntil*string

Earliest credential refresh time (floor: now+1h).

Formatdate-time
poolId?string

Optional synthetic metered/shared pool id used for execution cost attribution; never emitted into the agent environment.

Example Request
curl -X POST 'https://app.rensei.ai/api/daemon/credentials/snapshot' \  -H 'Content-Type: application/json' \  -d '{  "orgId": "string",  "sessionId": "string"}'
Example Response
{  "env": {    "property1": "string",    "property2": "string"  },  "refreshUntil": "2019-08-24T14:15:22Z",  "poolId": "string"}

SSE stream for credential rotation events

Runtime-worker-JWT-only Server-Sent Events endpoint. Requires `worker:session`. Before any credential read or subscription, the platform resolves the canonical secret-release scope from the active worker row and claimed session: JWT worker (`sub`), org, and project claims must exactly match the active worker; the session must be owned by that worker in the same org/project scope. Missing or mismatched ownership is collapsed to 404. The stream fails closed: authentication, canonical scope resolution, credential-gate evaluation, initial snapshot materialization/filtering, and rotation subscription registration all complete before `text/event-stream` is returned. It emits `INITIAL`, then filtered `UPDATE` events when an upstream OAuth rotation occurs, plus heartbeat events. Dependency failures return 503 instead of opening a partial stream.

Mint a short-lived GitHub installation token for a repo

Called by the host daemon to obtain a short-lived GitHub App installation token for a specific repository. The token is minted from the org's GitHub App installation and expires in ~1 hour. The `orgId` in the body must match the authenticated org. Auth: `Bearer rsk_*` via `getCliOrSessionAuth` OR worker runtime JWT. API keys gate on their project fence; a runtime JWT gates on the fence of the credential that minted it (null = org-wide on both paths). A repository bound only as context inside that fence returns HTTP 403 with `{ token: null, reason: 'context-repository' }`; callers must not fall back to a PAT for that policy refusal. The refusal gates writes only: readOnly:true still mints a read-scoped token; read-only context delivery stays a separate path. Returns `{ token: null, reason }` (HTTP 200) on soft failures so the caller can decide whether to fall back to a stored PAT.