Users
List Users
List all users that exist in Directus.
Query Parameters
Control what fields are being returned in the object.
A limit on the number of objects that are returned.
How many items to skip when fetching data.
What metadata to return in the response.
How to sort the returned items. sort
is a CSV of fields used to sort the fetched items. Sorting defaults to ascending (ASC) order but a minus sign (-
) can be used to reverse this to descending (DESC) order. Fields are prioritized by their order in the CSV. You can also use a ?
to sort randomly.
Select items in collection by given conditions.
Filter by items that contain the given search query in one of their fields.
GET /users
{
"data": [
{
"id": "63716273-0f29-4648-8a2a-2af2948f6f78",
"first_name": "Admin",
"last_name": "User",
"email": "admin@example.com",
"location": null,
"title": null,
"description": null,
"tags": null,
"avatar": null,
"language": "en-US",
"tfa_secret": null,
"status": "active",
"role": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"policies": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"last_access": "2020-05-31T14:32:37Z",
"last_page": "/my-project/settings/collections/a",
"auth_data": {},
"theme_light_overrides": {},
"theme_dark_overrides": {}
}
],
"meta": {}
}
Create Multiple Users
Create multiple new users.
Query Parameters
Control what fields are being returned in the object.
A limit on the number of objects that are returned.
How many items to skip when fetching data.
What metadata to return in the response.
How to sort the returned items. sort
is a CSV of fields used to sort the fetched items. Sorting defaults to ascending (ASC) order but a minus sign (-
) can be used to reverse this to descending (DESC) order. Fields are prioritized by their order in the CSV. You can also use a ?
to sort randomly.
Select items in collection by given conditions.
Filter by items that contain the given search query in one of their fields.
Cursor for use in pagination. Often used in combination with limit.
POST /users
{
"data": [
{
"id": "63716273-0f29-4648-8a2a-2af2948f6f78",
"first_name": "Admin",
"last_name": "User",
"email": "admin@example.com",
"location": null,
"title": null,
"description": null,
"tags": null,
"avatar": null,
"language": "en-US",
"tfa_secret": null,
"status": "active",
"role": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"policies": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"last_access": "2020-05-31T14:32:37Z",
"last_page": "/my-project/settings/collections/a",
"auth_data": {},
"theme_light_overrides": {},
"theme_dark_overrides": {}
}
],
"meta": {}
}
Delete Multiple Users
Delete multiple existing users.
DELETE /users
Update Multiple Users
Update multiple users at the same time.
Query Parameters
Control what fields are being returned in the object.
A limit on the number of objects that are returned.
What metadata to return in the response.
How many items to skip when fetching data.
How to sort the returned items. sort
is a CSV of fields used to sort the fetched items. Sorting defaults to ascending (ASC) order but a minus sign (-
) can be used to reverse this to descending (DESC) order. Fields are prioritized by their order in the CSV. You can also use a ?
to sort randomly.
Select items in collection by given conditions.
Filter by items that contain the given search query in one of their fields.
Request Body
PATCH /users
{
"data": [
{
"id": "63716273-0f29-4648-8a2a-2af2948f6f78",
"first_name": "Admin",
"last_name": "User",
"email": "admin@example.com",
"location": null,
"title": null,
"description": null,
"tags": null,
"avatar": null,
"language": "en-US",
"tfa_secret": null,
"status": "active",
"role": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"policies": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"last_access": "2020-05-31T14:32:37Z",
"last_page": "/my-project/settings/collections/a",
"auth_data": {},
"theme_light_overrides": {},
"theme_dark_overrides": {}
}
],
"meta": {}
}
Create an User
Create a new user.
Query Parameters
Control what fields are being returned in the object.
What metadata to return in the response.
Request Body
POST /users
{
"data": {
"id": "63716273-0f29-4648-8a2a-2af2948f6f78",
"first_name": "Admin",
"last_name": "User",
"email": "admin@example.com",
"location": null,
"title": null,
"description": null,
"tags": null,
"avatar": null,
"language": "en-US",
"tfa_secret": null,
"status": "active",
"role": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"policies": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"last_access": "2020-05-31T14:32:37Z",
"last_page": "/my-project/settings/collections/a",
"auth_data": {},
"theme_light_overrides": {},
"theme_dark_overrides": {}
}
}
Retrieve a User
List an existing user by primary key.
Query Parameters
Unique identifier for the object.
Control what fields are being returned in the object.
What metadata to return in the response.
GET /users/{id}
{
"data": {
"id": "63716273-0f29-4648-8a2a-2af2948f6f78",
"first_name": "Admin",
"last_name": "User",
"email": "admin@example.com",
"location": null,
"title": null,
"description": null,
"tags": null,
"avatar": null,
"language": "en-US",
"tfa_secret": null,
"status": "active",
"role": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"policies": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"last_access": "2020-05-31T14:32:37Z",
"last_page": "/my-project/settings/collections/a",
"auth_data": {},
"theme_light_overrides": {},
"theme_dark_overrides": {}
}
}
DELETE /users/{id}
Update a User
Update an existing user.
Query Parameters
Unique identifier for the object.
Control what fields are being returned in the object.
What metadata to return in the response.
Request Body
Unique identifier for the user.
First name of the user.
Last name of the user.
Unique email address for the user.
Password of the user.
The user's location.
The user's title.
The user's description.
The user's tags.
The user's avatar. Many-to-one to files.
The user's language used in Directus. Language the Data Studio is rendered in. See our Crowdin page for all available languages and translations.
The 2FA secret string that's used to generate one time passwords.
Status of the user.
Unique identifier of the role of this user. Many-to-one to roles.
Static token for the user.
The policies associated with this user. Many-to-many to policies.
When this user used the API last.
Last page that the user was on.
What auth provider was used to register this user.
Primary key of the user in the third party authentication provider, if used.
Required data about the user as provided by the third party auth provider, if used.
When this is enabled, the user will receive emails for notifications.
One of auto, light, dark.
Theme to use in dark mode.
Theme to use in light mode.
Customization for light theme in use.
Customization for dark theme in use.
PATCH /users/{id}
{
"data": {}
}
Invite User
Invites a user to this project. It creates a user with an invited status, and then sends an email to the user with instructions on how to activate their account.
Request Body
Email address of the to-be-invited user.
Role of the new user
Provide a custom invite url which the link in the email will lead to. The invite token will be passed as a parameter. Note: You need to configure the USER_INVITE_URL_ALLOW_LIST environment variable to enable this feature.
POST /users/invite
Accept User Invite
Accept your invite. The invite user endpoint sends the email a link to the Data Studio. This link includes a token, which is then used to activate the invited user.
Request Body
Accept invite token.
Password of the user.
POST /users/invite/accept
Retrieve Current User
Retrieve the currently authenticated user.
Query Parameters
Control what fields are being returned in the object.
What metadata to return in the response.
GET /users/me
{
"data": {
"id": "63716273-0f29-4648-8a2a-2af2948f6f78",
"first_name": "Admin",
"last_name": "User",
"email": "admin@example.com",
"location": null,
"title": null,
"description": null,
"tags": null,
"avatar": null,
"language": "en-US",
"tfa_secret": null,
"status": "active",
"role": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"policies": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"last_access": "2020-05-31T14:32:37Z",
"last_page": "/my-project/settings/collections/a",
"auth_data": {},
"theme_light_overrides": {},
"theme_dark_overrides": {}
}
}
Update Current User
Update the currently authenticated user.
Query Parameters
Control what fields are being returned in the object.
What metadata to return in the response.
PATCH /users/me
{
"data": {
"id": "63716273-0f29-4648-8a2a-2af2948f6f78",
"first_name": "Admin",
"last_name": "User",
"email": "admin@example.com",
"location": null,
"title": null,
"description": null,
"tags": null,
"avatar": null,
"language": "en-US",
"tfa_secret": null,
"status": "active",
"role": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"policies": "2f24211d-d928-469a-aea3-3c8f53d4e426",
"last_access": "2020-05-31T14:32:37Z",
"last_page": "/my-project/settings/collections/a",
"auth_data": {},
"theme_light_overrides": {},
"theme_dark_overrides": {}
}
}
Disable Two-Factor Authentication
Disables two-factor authentication for the currently authenticated user.
Request Body
One-time password generated by the authenticator app.
POST /users/me/tfa/disable
Enable 2FA
Enables two-factor authentication for the currently authenticated user.
Request Body
The TFA secret from tfa/generate.
OTP generated with the secret, to recheck if the user has a correct TFA setup
POST /users/me/tfa/enable
Generate Two-Factor Authentication Secret
Generates a secret and returns the URL to be used in an authenticator app.
Request Body
Response
Successful request
OTP secret to be saved in the authenticator app.
otpauth:// formatted URL. Can be rendered as QR code and used in most authenticator apps.
POST /users/me/tfa/generate
{}
Update Last Page
Updates the last used page field of the currently authenticated user. This is used internally to be able to open the Directus admin app from the last page you used.
Request Body
Path of the page you used last.
Register a new User
Register a new user.
Query Parameters
Control what fields are being returned in the object.
What metadata to return in the response.
Request Body
Email for the new user.
Password for the new user.
First name for the new user.
Last name for the new user.
Provide a custom verification url which the link in the email will lead to. The verification token will be passed as a parameter. Note: You need to configure the USER_REGISTER_URL_ALLOW_LIST environment variable to enable this feature.
POST /users/register
Verify Registered Email
Verify the registered email address. The register user endpoint sends the email a link for verification. This link includes a token, which is then used to activate the registered user.
Query Parameters
Emailed registration token.
GET /users/register/verify-email/{token}