crewship session
Manage the caller’s active browser sessions — the same surface the Settings → Sessions web panel exposes. Two use cases drive this:- Audit who’s logged in —
session listshows device, IP, and last-seen for every active session. Pipe throughjqfor compliance reports without opening a browser. - Force logout —
session revokekills one session by id. Combined withwhoamiandtoken revokeit gives an admin everything needed to neutralise a leaked credential.
cmd/crewship/cmd_session.go. Sessions are user-scoped, not workspace-scoped — the CLI client clears the workspace_id query param on both endpoints so the request lands clean.
Every subcommand requires
crewship login. No workspace context required.Subcommands
Flags
Beyond these, use the global
--format json / --format yaml for scripting.
Examples
List
STATUS column is one of current (the session backing the token you’re
using right now), active (used within --warn-stale-days), or stale (older
than the threshold). When any stale sessions are found, a table-mode footer
suggests revoking them; the hint is suppressed in JSON output.
Audit dump for compliance
Revoke another session
Revoke your own session
is_current=true and the CLI prints a yellow note so a careless script can warn the human before it locks itself out.
Security notes
- Foreign session ids (sessions belonging to other users) return 404 with the same shape as “does not exist”, so the endpoint can’t be used to enumerate other users’ sessions by id.
- Revoking a session does not invalidate any CLI tokens that user holds. CLI tokens have their own lifecycle — manage them under Settings → CLI tokens or via
crewship token revoke.
Common errors
404 Not Found— the session id doesn’t exist or it belongs to another user. Indistinguishable on purpose.401 unauthorized— your current session was revoked. Runcrewship login.
See also
crewship login— re-authenticate after a self-revoke.crewship whoami— verify the active token is still valid.crewship token— CLI token lifecycle, separate from browser sessions.- Auth API —
GET /api/v1/auth/sessions.