Documentation Index
Fetch the complete documentation index at: https://docs.capy.ai/llms.txt
Use this file to discover all available pages before exploring further.
What session identity tokens are for
Session identity tokens let code running inside a Captain VM prove which Capy session it came from. Typical uses include enforcing per-session limits, binding external resources to a specific session, or accepting requests only from active sessions you expect. Each token represents one Captain session. Capy signs the token, refreshes it while the session stays active, and invalidates it when the session ends.Treat the token as an opaque bearer-style string. It is a JWT, but customers
should not parse or verify it locally.
Where to read the token
You can get the current token in either place:- Inside the Captain VM at
/etc/capy/session-token(chmod 600) - Via
GET /v1/threads/{threadId}/session-token
Token lifecycle
- Minted when the session starts
- Expires 30 minutes after issuance
- Refreshed automatically in the background on each Captain VM heartbeat, typically about every 15 minutes before expiry
- Cleared when the session stops or is archived
/etc/capy/session-token and the value returned by GET /v1/threads/{threadId}/session-token stay current.
Recommended verification pattern
When a service receives a session token from agent-controlled code:- Send the token to
POST /v1/sessions/verify - Confirm the response has
valid: true - Confirm
projectIdmatches the project you expected - Optionally confirm
threadIdmatches the specific session you expected - Trust the session identity only after those checks pass
Security model
Capy signs session identity tokens with a Capy-managed key that is separate from internal infrastructure secrets. Customers must never attempt to verify the JWT cryptographically themselves.POST /v1/sessions/verify is the only authoritative verification path. It confirms that the token matches a real session and that the session is still valid for the caller’s project access.
Failure responses are intentionally opaque:
expiredmeans the token was valid but is no longer currentinvalidcovers malformed tokens, signature failures, wrong issuer, wrong audience, wrong purpose, and other verification failures
The caller of
POST /v1/sessions/verify must have API access to the project
that owns the session. This prevents cross-project and cross-tenant
enumeration.