Skip to content
On this page

Directus Cloud

Everything you need to start building. Provisioned in 90 seconds. Starting at $15/month.

Get Started

Policies

Policies define a specific set of access permissions, and are a composable unit that can be assigned to both roles and users. Learn more about Policies.

The Policy Object

id uuid
Primary key of the policy.

name string
Name of the policy.

icon string
Icon for the policy. Displayed in the Data Studio.

description string
Description for the policy. Displayed in the Data Studio.

ip_access csv
A CSV of IP addresses that this policy applies to. Allows you to configure an allowlist of IP addresses. If empty, no IP restrictions are applied.

enforce_tfa boolean
Whether or not Two-Factor Authentication is required for users that have this policy.

admin_access boolean
If this policy grants the user admin access. This means that users with this policy have full permissions to everything.

app_access boolean
Whether or not users with this policy have access to use the Data Studio.

users many-to-many
The users this policy is assigned to directly, this does not include users which receive this policy through a role. It expects and returns data from the directus_access collection. Many-to-many to users via access.

roles many-to-many
The roles this policy is assigned to. It expects and returns data from the directus_access collection. Many-to-many to roles via access.

permissions one-to-many
The permissions assigned to this policy. One-to-many to permissions.

json
{
	"id": "653925a9-970e-487a-bfc0-ab6c96affcdc",
	"name": "Admin",
	"icon": "supervised_user_circle",
	"description": null,
	"ip_access": null,
	"enforce_tfa": false,
	"admin_access": true,
	"app_access": true,
	"users": ["0bc7b36a-9ba9-4ce0-83f0-0a526f354e07"],
	"roles": ["8b4474c0-288d-4bb8-b62e-8330646bb6aa"],
	"permissions": ["5c74c86f-cab0-4b14-a3c4-cd4f2363e826"]
}
{
	"id": "653925a9-970e-487a-bfc0-ab6c96affcdc",
	"name": "Admin",
	"icon": "supervised_user_circle",
	"description": null,
	"ip_access": null,
	"enforce_tfa": false,
	"admin_access": true,
	"app_access": true,
	"users": ["0bc7b36a-9ba9-4ce0-83f0-0a526f354e07"],
	"roles": ["8b4474c0-288d-4bb8-b62e-8330646bb6aa"],
	"permissions": ["5c74c86f-cab0-4b14-a3c4-cd4f2363e826"]
}

List Policies

List all policies that exist in Directus.

Request

Query Parameters

Supports all global query parameters.

Response

An array of up to limit policy objects. If no items are available, data will be an empty array.

Example

Retrieve a Policy

List an existing policy by primary key.

Query Parameters

Supports all global query parameters.

Response

Returns the requested policy object.

Example

Create a Policy

Create a new policy.

Request

Query Parameters

Supports all global query parameters.

Request Body

A partial policy object.

Response

Returns the policy object for the created policy.

Example

Create Multiple Policies

Create multiple new policies.

Request

Query Parameters

Supports all global query parameters.

Request Body

An array of partial policy objects.

Response

Returns the policy objects for the created policies.

Example

Update a Policy

Update an existing policy.

Request

Query Parameters

Supports all global query parameters.

Request Body

A partial policy object.

Response

Returns the policy object for the updated policy.

Example

Update Multiple Policies

Update multiple existing policies.

Request

Query Parameters

Supports all global query parameters.

Request Body

keys Required
Array of primary keys of the policies you'd like to update.

data Required
Any of the policy object's properties.

Response

Returns the policy objects for the updated policies.

Example

Delete a Policy

Delete an existing policy.

Request

Response

Empty body.

Example

Delete Multiple Policies

Delete multiple existing policies.

Request

Request Body

An array of policy primary keys

Response

Empty body.

Example