Skip to content

List a user's sessions

GET
/admin/users/{ref}/sessions

Lists another user’s signed-in sessions, most recently used first, in the same shape as GET /account/sessions. Use it to see where someone is signed in, and end a session with DELETE /admin/users/{ref}/sessions/{id}.

You need users.read. The ip field also needs users.pii.read; without it you get the same rows without addresses. system.admin covers both. No row is marked current, even when you list your own sessions.

As on your own list, sessions idle for more than 30 minutes can still appear, impersonation sessions aren’t marked, and there’s no paging. The user isn’t looked up first, so an unknown ref returns an empty list rather than 404.

ref
required
integer format: int64

The user’s signed-in sessions.

object
items
required
Array<object>

One signed-in session. user_agent is the User-Agent header from the request that started the session, and is left out when there wasn’t one.

object
id
required
string format: uuid
created_at
required
string format: date-time
last_used_at
required

When a request last used the session. A session unused for more than 30 minutes stops working.

string format: date-time
expires_at

When the session ends no matter how it’s used. Ordinary sign-ins have no fixed end, so it’s left out; impersonation sessions end 30 minutes after they start.

string format: date-time
nullable
ip

The IP address the session was started from: the first entry in X-Forwarded-For when there is one, otherwise the connection’s address. The client can set that header, and a value that isn’t a valid address isn’t recorded. Only GET /admin/users/{ref}/sessions returns it, and only if you have users.pii.read as well as users.read (system.admin also works). It’s left out otherwise, and also when no address was recorded, so a missing ip doesn’t tell you which.

string
nullable
user_agent
string
nullable
current

true on the session making this request. Only GET /account/sessions sets it, and only when you call it with the session cookie; otherwise it’s left out.

boolean

Authentication required, missing, or invalid

object
error
required

Human-readable error summary

string
Example
the request could not be completed
Example
{
"error": "authentication required: sign in and retry with a valid session or API token"
}

Authenticated but missing required capabilities

object
error
required

Human-readable error summary

string
Example
the request could not be completed

Resource not found

object
error
required

Human-readable error summary

string
Example
the request could not be completed