Rensei docs
API ReferenceInteractive sessions

Cooperatively stop an interactive session.

Authentication accepts a browser session or a WorkOS user token only; an rsk API key or a BYOA OAuth-agent token is rejected 403. Idempotent-ish: stopping an already-ended session still returns 200 (the underlying Redis/SQL writes are themselves idempotent). 404 - never 403 - for a session belonging to a different org or one the caller has no project access for (no-existence-leak). Teardown drives the cooperative Redis/lock-refresh rail and, belt-and-braces, emits a fire-and-forget relay kill (reason: stopped) when the relay control env is configured. A session that is live on an ADOPTED session-shim lineage (its host daemon restarted and re-owned the harness) cannot be terminalized by the caller - the common release predicate holds its claim until the lineage's own terminal proof. For that case the stop is DELIVERED (relay kill toward the active carrier + the cooperative rail) and the route answers 202 with `stopped:false, delivered:true, pending:"terminal_evidence"`; the row flips to `ended` when the daemon posts the group-reaped tombstone. 409 is reserved for a hold nothing can deliver to (a restart hold window, or an unreconciled lineage): retry. A delivery the relay could not hand to a bound carrier is RE-SENT (on carrier re-attach, on the pty-nudge cycle, and on an interval from the reaper sweep) instead of being frozen behind the permanent stop stamp, and is bounded: the reaper terminalizes the row once the stop has stayed undelivered past its grace. `delivery.deliveryAttempts` / `delivery.lastDeliveryAt` report that progress. A machine principal presenting a x-interactive-spawn-credential header is routed to a separate machine-principal stop path instead of the 403 above, restricted to descendants in that credential's own spawn subtree. Unknown and cross-org targets return 404; a known same-org target outside the subtree is refused by Cedar. A refusal from credential/Cedar attestation returns the typed delegation envelope { code, class, message, axis?, limit?, current?, bindingLevel, bindingScopeId, retryAt?, remedy }.

POST
/api/interactive-sessions/{id}/stop

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

id*string

The session id (agent_sessions.session_id).

Response Body

Stop signal sent.

application/json
  1. response
stopped*boolean
endedAt*string
Example Request
curl -X POST 'https://app.rensei.ai/api/interactive-sessions/string/stop'
Example Response
{  "stopped": true,  "endedAt": "string"}