Skip to main content

users

Creates, updates, deletes, gets or lists a users resource.

Overview

Nameusers
TypeResource
Idcloudflare.zero_trust.users

Fields

The following fields are returned by SELECT queries:

Get user response

NameDatatypeDescription
idstringUUID. (example: f174e90a-fafe-4643-bbbc-4a0ed4fc8415)
namestringThe name of the user. (example: Jane Doe)
access_seatbooleanTrue if the user has authenticated with Cloudflare Access.
active_device_countnumberThe number of active devices registered to the user.
created_atstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
emailstring (email)The email of the user. (example: jdoe@example.com)
gateway_seatbooleanTrue if the user has logged into the WARP client.
last_successful_loginstring (date-time)The time at which the user last successfully logged in. (example: 2020-07-01T05:20:00Z)
seat_uidstringThe unique API identifier for the Zero Trust seat.
uidstringThe unique API identifier for the user.
updated_atstring (date-time) (example: 2014-01-01T05:20:00.12345Z)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectuser_id, account_idGets a specific user for an account.
createinsertaccount_id, emailCreates a new user.
updatereplaceuser_id, account_id, name, emailUpdates a specific user's name for an account. Requires the user's current email as confirmation (email cannot be changed).
deletedeleteuser_id, account_idDeletes a specific user for an account. This will also revoke any active seats and tokens for the user.
delete_mfa_authenticatorsexecuser_id, account_id, authenticator_idDeletes a specific MFA device for a user. This action is only available if MFA is turned on for the organization.

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.
authenticator_idstring
user_idstringThe user ID.

SELECT examples

Gets a specific user for an account.

SELECT
id,
name,
access_seat,
active_device_count,
created_at,
email,
gateway_seat,
last_successful_login,
seat_uid,
uid,
updated_at
FROM cloudflare.zero_trust.users
WHERE user_id = '{{ user_id }}' -- required
AND account_id = '{{ account_id }}' -- required
;

INSERT examples

Creates a new user.

INSERT INTO cloudflare.zero_trust.users (
email,
name,
account_id
)
SELECT
'{{ email }}' /* required */,
'{{ name }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

REPLACE examples

Updates a specific user's name for an account. Requires the user's current email as confirmation (email cannot be changed).

REPLACE cloudflare.zero_trust.users
SET
email = '{{ email }}',
name = '{{ name }}'
WHERE
user_id = '{{ user_id }}' --required
AND account_id = '{{ account_id }}' --required
AND name = '{{ name }}' --required
AND email = '{{ email }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Deletes a specific user for an account. This will also revoke any active seats and tokens for the user.

DELETE FROM cloudflare.zero_trust.users
WHERE user_id = '{{ user_id }}' --required
AND account_id = '{{ account_id }}' --required
;

Lifecycle Methods

Deletes a specific MFA device for a user. This action is only available if MFA is turned on for the organization.

EXEC cloudflare.zero_trust.users.delete_mfa_authenticators
@user_id='{{ user_id }}' --required,
@account_id='{{ account_id }}' --required,
@authenticator_id='{{ authenticator_id }}' --required
;