Revoke portal sessions
Changed onRevoke every live session an end user holds on a portal.
Unreleased and subject to change without notice.
Sessions that were created but not yet opened are revoked too, so their portal URLs stop working. Revocation is not instantaneous: session lookups are cached briefly, so a request already in flight may still succeed.
Revoking ends existing sessions only. To keep the end user out, also stop calling portal.createSession for them.
Calling this again for the same end user is safe and revokes nothing.
Required Permissions
Your root key must have one of:
- portal.*.create_portal_session (for any portal in the workspace)
- portal.<portal_id>.create_portal_session (for a specific portal)
It also accepts unkey:v1:<workspace_id>:projects/<project_id>/portals/<portal_id>/sessions/*#write, which dashboard roles carry. Unlike portal.createSession, a dashboard session can call this, not just a root key.
A root key that cannot read the portal's sessions gets 404. One that can read them but lacks the permission gets 403.
Request
- Base URLhttps://api.unkey.com
- URLhttps://api.unkey.com/v2/portal.revokeSession
- AuthHTTP bearer
Request body
Example request
{
"portal": "proj_1234abcd",
"externalId": "user_123"
}Response
The end user's live sessions on the portal are revoked.
Example response
{
"meta": {
"requestId": "req_123"
},
"data": {
"sessionsRevoked": 2
}
}Changes
- info
added the non-success response with the status
- info
- info
endpoint added
- info