session_token and session_jwt that you can use to authorize requests.
Sessions have a configurable lifetime (default: 60 minutes) and can be extended by re-authenticating them before they expire. Sessions contain authentication factors and can be revoked at any time.
Common operations
- Authenticate Session
- Revoke Session
- Get Sessions
- Exchange Intermediate Session
Validate a session and optionally extend its lifetime. Use this to authorize requests in your application.Parameters:
Authenticate with session token
session_token: The session token to validate (use either this orsession_jwt)session_jwt: Alternative tosession_token- the JWT to validatesession_duration_minutes: (Optional) Extend session lifetime by this many minutessession_custom_claims: (Optional) Custom claims to add to the session JWTauthorization_check: (Optional) Check RBAC permissions during authentication
You can pass an expired JWT (based on its
exp claim) and receive a new JWT if the underlying Session is still valid.Session tokens vs JWTs
Stytch provides two token formats for sessions:Session Tokens
Opaque tokens that must be validated server-side via the authenticate endpoint.
- More secure (can’t be decoded)
- Requires API call to validate
- Can be revoked immediately
Session JWTs
JSON Web Tokens that can be validated locally using your project’s public key.
- Can validate without API calls
- Contains claims (member ID, org ID, etc.)
- Slightly delayed revocation (until JWT expires)
Authentication factors
Sessions track which authentication methods were used. Common factors include:- Magic Links - Email-based authentication
- OAuth - Social login (Google, Microsoft, etc.)
- OTP - One-time passcodes via email or SMS
- SSO - SAML or OIDC connections
- Passwords - Traditional password authentication
- TOTP - Authenticator app codes
- WebAuthn - Biometric or security key authentication