Rensei docs
API ReferenceWorker Protocol

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.

POST
/api/daemon/git-token

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.

Request Body

application/json
  1. body
orgId*string

Must match the authenticated org.

repo?string

Canonical owner/name form. Wins over owner + name when both present.

owner?string
name?string
readOnly?boolean

Mint a read-only single-repository token. Omit or set false for the existing write token.

Defaultfalse

Response Body

Token result.

application/json
  1. response
token*string
expiresAt*string

GitHub's authoritative expires_at for the minted token, surfaced verbatim (not a locally computed now+1h). Schedule any re-mint strictly before this instant.

Formatdate-time
readOnly*boolean

true only when this token was minted read-only (contents:read, one repository)

Example Request
curl -X POST 'https://app.rensei.ai/api/daemon/git-token' \  -H 'Content-Type: application/json' \  -d '{  "orgId": "string"}'
Example Response
{  "token": "string",  "expiresAt": "2019-08-24T14:15:22Z",  "readOnly": true}