Overview
TheSessionServiceApi provides methods for managing user sessions in Zitadel. Sessions can be used for authentication in OIDC/SAML requests and as OAuth2 access tokens for Zitadel APIs.
Initialize the API
Session Management
create_session
create_session
set_session
set_session
Update an existing session with new information like additional checks or metadata. Returns a new session token.Required permission:
session.writeget_session
get_session
Retrieve a session by its ID. Returns all information about the session including factors, metadata, and user agent.
list_sessions
list_sessions
Searches for sessions matching the given query. Can search by session ID, user ID, creation date, and more.Required permission:
session.readdelete_session
delete_session
Terminate an existing session. This invalidates the session and its token.Required permission:
session.delete (or no permission for own sessions)Session Checks
Sessions support various authentication checks:User Check
Password Check
TOTP/OTP Check
WebAuthn/Passkey Check
Example: Multi-Factor Authentication Flow
Example: Session with Metadata
Using Sessions for Authentication
Session tokens can be used in multiple ways:As OAuth2 Access Token
For OIDC Authentication
Pass the session token as theid_token_hint parameter in OIDC authorization requests.
For SAML Authentication
Session tokens can be used to authenticate SAML requests.Session Lifecycle
See Also
- User Service - Manage users
- OIDC Service - OIDC authentication
- Session Management Guide - Complete guide to session handling