Skip to content
Orvanov0.2.0

users.listSessions

GET
/v1/users/{userId}/sessions
import { Client, Orvano } from '@orvano/js/server'
const orvano = new Orvano(
new Client({ endpoint: 'https://orvano.example.com', apiKey: process.env.ORVANO_API_KEY }),
)
const sessionPage = await orvano.users.listSessions('<userId>')
console.log(sessionPage)

Lists a user’s active sessions, newest first. current is always false.

Server SDKs: JavaScript on a server, Dart, and .NET call it with an API key. API key scope: users.read. A failure answers with a problem details body; its code has a page under Errors.

userId
required
string

The user ID.

cursor
string

The nextCursor of the previous page.

limit
integer format: int32

Sessions per page, 1 to 100. Defaults to 25.

The request has succeeded.

Media typeapplication/json

One page of a user’s active sessions, newest first.

object
items
required

The sessions on this page.

Array<object>

An active session of a user: one signed in device or browser.

object
id
required

The session ID.

string
createdAt
required

When the user signed in.

string format: date-time
lastRefreshedAt
required

When the session last traded its refresh token.

string format: date-time
userAgent
required
Any of:
string
sdk
required
Any of:
string
ipAddress
required
Any of:
string
current
required

Whether this is the session making the call.

boolean
method
required

How the session began.

string
Allowed values: password sign_up magic_link email_code recovery
nextCursor
required
Any of:
string
Example
{
"items": [
{
"id": "01924f5e-9a1b-7c4d-8e21-3d5e6f7a8b9c",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
"sdk": "orvano-js/0.1.0",
"ipAddress": "203.0.113.7",
"current": true,
"method": "password"
}
]
}

An unexpected error response.

Media typeapplication/problem+json

An RFC 9457 problem details body. Every operation declares it as its default response, sent as application/problem+json.

object
type
required

Identifies the error: https://orvano.dev/errors/<code>.

string
title
required

The standard HTTP reason phrase for the status.

string
status
required

The HTTP status code.

integer format: int32
detail

A short, safe sentence about this occurrence, when the server has one.

string
code
required

Orvano’s stable error code, from the ErrorCode catalog. SDKs treat it as a plain string.

string
requestId
required

The request ID to quote when reporting a problem; also sent as X-Request-Id.

string
Example
{
"type": "https://orvano.dev/errors/not_found",
"title": "Not Found",
"status": 404,
"code": "not_found",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736"
}