Overview
Theprincipal_sessions sub-client lets you create short-lived session tokens for your end-users. These tokens power the Permission Dashboard where users can view which agents have access and revoke grants.
principal_sessions.create()
Create a session token for an end-user. Returns a URL they can open to manage their permissions.Parameters: CreatePrincipalSessionParams
The end-user’s principal ID — the same
user_id used in grantex.authorize().Session duration. Format:
"30m", "1h", "24h". Defaults to "1h", capped at "24h".Response: PrincipalSessionResponse
The signed JWT session token.
Full URL the user can open in their browser to view and revoke permissions.
ISO 8601 timestamp when the session token expires.
Errors
| Status | Code | Cause |
|---|---|---|
| 400 | BAD_REQUEST | Missing principal_id or invalid expires_in format |
| 404 | NOT_FOUND | No active grants exist for this principal |