Skip to main content

active_sessions

Creates, updates, deletes, gets or lists an active_sessions resource.

Overview

Nameactive_sessions
TypeResource
Idcloudflare.zero_trust.active_sessions

Fields

The following fields are returned by SELECT queries:

Get active session response

NameDatatypeDescription
account_idstring (example: 1234567890)
device_idstring (example: )
service_token_idstring (example: )
common_namestring (example: )
auth_statusstring (example: NONE)
devicePostureobject
device_sessionsobject
emailstring (example: test@cloudflare.com)
geoobject
iatnumber
idpobject
ipstring (example: 127.0.0.0)
isActiveboolean
is_gatewayboolean
is_warpboolean
mtls_authobject
service_token_statusboolean
user_uuidstring (example: 57cf8cf2-f55a-4588-9ac9-f5e41e9f09b4)
versionnumber

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectuser_id, account_id, nonceGet an active session for a single user.
listselectuser_id, account_idGet active sessions for a single user.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
noncestring
user_idstringThe user ID.

SELECT examples

Get an active session for a single user.

SELECT
account_id,
device_id,
service_token_id,
common_name,
auth_status,
devicePosture,
device_sessions,
email,
geo,
iat,
idp,
ip,
isActive,
is_gateway,
is_warp,
mtls_auth,
service_token_status,
user_uuid,
version
FROM cloudflare.zero_trust.active_sessions
WHERE user_id = '{{ user_id }}' -- required
AND account_id = '{{ account_id }}' -- required
AND nonce = '{{ nonce }}' -- required
;