List my sessions
Lists the signed-in user's own sessions in the project they signed in to, newest first, each with the IP address and user agent it began with.
Sessions of every lifecycle state are listed, each with its state, so a
person can see where they signed in and which of those sessions are still
active. Revoking one of them is an administrator's revokeSession
(DELETE /sessions/{session_id}), or the browser's own revokeMySession
(DELETE /sessions/me) for the session it holds. A session never carries
its token here.
With project_id, the sessions are listed only when the session belongs to
that project.
A token issued for the person reads the sessions too, when it carries
session.read. A project secret is no person: it is answered 401, as
a request without a credential.
AuthorizationBearer <token>Scope: session.read
limit?integerMaximum number of items to return.
1 <= value <= 10020page_token?stringToken for fetching the next page of results.
Obtain this value from next_page_token in the previous response.
Omit to start from the beginning.
Its format is opaque and may change between releases.
project_id?stringThe project the caller signs its users in to. The cookie's session is used
only when it belongs to this project; a session of any other project answers
403 with sess.project_mismatch.
A session belongs to one project, while a browser sends its cookie to every app on the same host. An app passes its own project, so that a session of another project never reads or acts as one of its users, and signing out of the app never ends it. The SDKs pass it when they read the session or sign out.
sess.project_mismatch does not mean the session is invalid: it is live in
its own project, so keep its cookie.
^[a-zA-Z0-9_-]+$The user's sessions.
application/json- response
Paginated list of sessions.
sessions*array<>next_page_token?|Token to pass as page_token in the next request to fetch the following page.
Absent when there are no more results.
import { configureZitadel, getApi } from "@zitadel/api/config";// In the browser, through the SDK proxy: the session cookie authenticates the call.const api = getApi(configureZitadel({ projectId: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" }));const mySessions = await api.listMySessions();{ "sessions": [ { "session_id": "string", "project_id": "string", "state": "building", "user_id": "string", "user": { "user_id": "string", "identifier": "string", "identifier_property": "string", "display": "string" }, "factors": [ { "method": "identifier", "verified_at": "2019-08-24T14:15:22Z", "payload": { "method": "identifier", "user_id": "string" } } ], "assurance_levels": [ "string" ], "metadata": {}, "user_agent": { "fingerprint": "string", "ip": "string" }, "created_at": "2019-08-24T14:15:22Z", "expires_at": "2019-08-24T14:15:22Z" } ], "next_page_token": "string"}Was this helpful?