Core API Reference

Sessions — Core API

User session management endpoints. Sessions track authenticated users and their tokens. Use these endpoints to monitor, suspend, or revoke user sessions.

Base URL: https://api.authpi.com — see the Core API overview for authentication, pagination, and idempotency, or try these endpoints in the interactive reference.

GET/v1/accounts/{account_id}/issuers/{issuer_id}/users/{user_id}/sessions

List User Sessions

Lists all sessions for a user.

Sessions represent authenticated contexts for a user. Each session tracks:

  • Status - Current state (active, suspended, revoked, expired)
  • Device info - User agent, IP address, device fingerprint
  • Tokens - Associated access and refresh tokens
  • Activity - Last activity timestamp

Session statuses:

  • inactive - Session created but not yet activated (pre-token issuance)
  • active - Normal operational state
  • suspended - Temporarily blocked by admin (can be reactivated)
  • revoked - Permanently terminated (logout or security action)
  • expired - Session lifetime exceeded

Use this endpoint to:

  • Show users their active sessions
  • Identify suspicious sessions for security review
  • Audit session history

Path parameters

NameTypeRequiredDescription
account_idstringRequiredThe unique identifier of the account
issuer_idstringRequiredThe unique identifier of the issuer
user_idstringRequiredThe unique identifier of the user

Query parameters

NameTypeRequiredDescription
statusinactive | active | expired | revoked | suspendedOptionalFilter sessions by status

Responses

CodeDescriptionSchema
200Sessions retrieved successfullyobject
401Unauthorized - Authentication is required or has failed.ApiError
403Forbidden - You don't have permission to perform this action.ApiError
404Not Found - The requested resource does not exist.ApiError

GET/v1/accounts/{account_id}/issuers/{issuer_id}/sessions/{session_id}

Get Session

Retrieves detailed information about a specific session.

Returns complete session data including:

  • User info - The user ID associated with this session
  • Client info - The OAuth client that initiated the session
  • Device context - User agent, IP address, device fingerprint
  • Timestamps - Created, last activity, expiration times
  • Token metadata - Current access/refresh token JTIs (not the tokens themselves)

Use this endpoint to:

  • Investigate suspicious activity
  • Verify session validity before sensitive operations
  • Get context for security audit logs

Path parameters

NameTypeRequiredDescription
account_idstringRequiredThe unique identifier of the account
issuer_idstringRequiredThe unique identifier of the issuer
session_idstringRequiredThe unique identifier of the session

Responses

CodeDescriptionSchema
200Session retrieved successfullyobject
401Unauthorized - Authentication is required or has failed.ApiError
403Forbidden - You don't have permission to perform this action.ApiError
404Not Found - The requested resource does not exist.ApiError

POST/v1/accounts/{account_id}/issuers/{issuer_id}/sessions/{session_id}/revoke

Revoke Session

Permanently revokes a session.

Revoking a session immediately:

  • Invalidates all tokens associated with the session
  • Prevents any further token refresh attempts
  • Logs the user out of this session
  • Revokes linked RP/client sessions when the target is an OP/SSO session
  • Emits session.terminated events and OIDC backchannel logout per affected client session

Revocation reasons: Include a reason in the request body for audit purposes — one of: user_logout, admin_action, security_event, password_changed, inactivity, token_compromised, other.

Pass revoke_all_user_sessions: true to revoke every non-terminal session belonging to this session's user ("log out everywhere"), including active, suspended, and not-yet-activated inactive sessions.

Important: This action is permanent. To temporarily block a session while investigating, use Suspend Session instead.

Path parameters

NameTypeRequiredDescription
account_idstringRequiredThe unique identifier of the account
issuer_idstringRequiredThe unique identifier of the issuer
session_idstringRequiredThe unique identifier of the session

Request body

Content type: application/json

PropertyTypeRequiredDescription
reasonuser_logout | admin_action | security_event | password_changed | inactivity | token_compromised | …Required
reason_detailsstringOptional
revoke_all_user_sessionsbooleanOptional

Responses

CodeDescriptionSchema
200Session revoked successfullyobject
400Bad Request - The request is malformed or contains invalid data.ApiError
401Unauthorized - Authentication is required or has failed.ApiError
403Forbidden - You don't have permission to perform this action.ApiError
404Not Found - The requested resource does not exist.ApiError

POST/v1/accounts/{account_id}/issuers/{issuer_id}/sessions/{session_id}/suspend

Suspend Session

Temporarily suspends a session.

Use suspension when you need to block access while investigating suspicious activity, without permanently revoking the session.

When suspended:

  • All tokens immediately become invalid
  • Token refresh attempts fail
  • The session can be reactivated later

Use cases:

  • Detected unusual activity requiring investigation
  • User reports possible account compromise
  • Temporary administrative hold

Difference from revoke:

  • Suspended sessions can be reactivated
  • Revoked sessions are permanently terminated

Include a reason in the request body for audit purposes.

Path parameters

NameTypeRequiredDescription
account_idstringRequiredThe unique identifier of the account
issuer_idstringRequiredThe unique identifier of the issuer
session_idstringRequiredThe unique identifier of the session

Request body

Content type: application/json

PropertyTypeRequiredDescription
reasonsecurity_event | token_compromised | device_mismatch | risk_review | otherRequired
reason_detailsstringOptional
suspend_all_user_sessionsbooleanOptional

Responses

CodeDescriptionSchema
200Session suspended successfullyobject
400Bad Request - The request is malformed or contains invalid data.ApiError
401Unauthorized - Authentication is required or has failed.ApiError
403Forbidden - You don't have permission to perform this action.ApiError
404Not Found - The requested resource does not exist.ApiError

POST/v1/accounts/{account_id}/issuers/{issuer_id}/sessions/{session_id}/reactivate

Reactivate Session

Reactivates a previously suspended session.

After investigation confirms the session is legitimate, use this endpoint to restore access.

When reactivated:

  • Session status returns to active
  • Tokens become valid again (if not expired)
  • User regains access without re-authenticating

Limitations:

  • Only suspended sessions can be reactivated
  • Revoked or expired sessions cannot be reactivated
  • The user must obtain new tokens via refresh if their previous tokens expired during suspension

Path parameters

NameTypeRequiredDescription
account_idstringRequiredThe unique identifier of the account
issuer_idstringRequiredThe unique identifier of the issuer
session_idstringRequiredThe unique identifier of the session

Responses

CodeDescriptionSchema
200Session reactivated successfullyobject
400Bad Request - The request is malformed or contains invalid data.ApiError
401Unauthorized - Authentication is required or has failed.ApiError
403Forbidden - You don't have permission to perform this action.ApiError
404Not Found - The requested resource does not exist.ApiError