Policies
List Policies
List all policies 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.
Cursor for use in pagination. Often used in combination with limit.
Responses
Primary key of the policy;
Name of the policy.
Icon for the policy. Displayed in the Data Studio.
Description for the policy. Displayed in the Data Studio.
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.
Whether or not Two-Factor Authentication is required for users that have this policy.
If this policy grants the user admin access. This means that users with this policy have full permissions to everything.
Whether or not users with this policy have access to use the Data Studio.
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.
The roles this policy is assigned to. It expects and returns data from the directus_access collection. Many-to-many to roles via access.
The permissions assigned to this policy. One-to-many to permissions.
Returns the total item count of the collection you're querying.
Returns the item count of the collection you're querying, taking the current filter/search parameters into account.
GET /policies
import { createDirectus, rest, readPolicies } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(readPolicies(query_object));
type Query {
policies: [directus_policies]
}
{
"data": [
{
"id": "22640672-eef0-4ee9-ab04-591f3afb288",
"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"
]
}
],
"meta": {}
}
Create Multiple Policies
Create multiple new policies.
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
Primary key of the policy;
Name of the policy.
Icon for the policy. Displayed in the Data Studio.
Description for the policy. Displayed in the Data Studio.
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.
Whether or not Two-Factor Authentication is required for users that have this policy.
If this policy grants the user admin access. This means that users with this policy have full permissions to everything.
Whether or not users with this policy have access to use the Data Studio.
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.
The roles this policy is assigned to. It expects and returns data from the directus_access collection. Many-to-many to roles via access.
The permissions assigned to this policy. One-to-many to permissions.
Responses
Primary key of the policy;
Name of the policy.
Icon for the policy. Displayed in the Data Studio.
Description for the policy. Displayed in the Data Studio.
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.
Whether or not Two-Factor Authentication is required for users that have this policy.
If this policy grants the user admin access. This means that users with this policy have full permissions to everything.
Whether or not users with this policy have access to use the Data Studio.
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.
The roles this policy is assigned to. It expects and returns data from the directus_access collection. Many-to-many to roles via access.
The permissions assigned to this policy. One-to-many to permissions.
Returns the total item count of the collection you're querying.
Returns the item count of the collection you're querying, taking the current filter/search parameters into account.
POST /policies
import { createDirectus, rest, createPolies } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(createPolicies(policy_object_array));
type Mutation {
create_policies_items(data: [create_directus_policies_input!]!): [directus_policies]
}
{
"data": [
{
"id": "22640672-eef0-4ee9-ab04-591f3afb288",
"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"
]
}
],
"meta": {}
}
Delete Multiple Policies
Delete multiple existing policies.
Responses
DELETE /policies
import { createDirectus, rest, deletePolicies } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(deletePolicies(policy_id_array));
type Mutation {
delete_policies_items(ids: [ID!]!): delete_many
}
Update Multiple Policies
Update multiple existing policies.
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
Primary key of the policy;
Name of the policy.
Icon for the policy. Displayed in the Data Studio.
Description for the policy. Displayed in the Data Studio.
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.
Whether or not Two-Factor Authentication is required for users that have this policy.
If this policy grants the user admin access. This means that users with this policy have full permissions to everything.
Whether or not users with this policy have access to use the Data Studio.
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.
The roles this policy is assigned to. It expects and returns data from the directus_access collection. Many-to-many to roles via access.
The permissions assigned to this policy. One-to-many to permissions.
Responses
Primary key of the policy;
Name of the policy.
Icon for the policy. Displayed in the Data Studio.
Description for the policy. Displayed in the Data Studio.
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.
Whether or not Two-Factor Authentication is required for users that have this policy.
If this policy grants the user admin access. This means that users with this policy have full permissions to everything.
Whether or not users with this policy have access to use the Data Studio.
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.
The roles this policy is assigned to. It expects and returns data from the directus_access collection. Many-to-many to roles via access.
The permissions assigned to this policy. One-to-many to permissions.
Returns the total item count of the collection you're querying.
Returns the item count of the collection you're querying, taking the current filter/search parameters into account.
PATCH /policies
import { createDirectus, rest, updatePolicies } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(updatePolicies(policies_id_array, partial_policy_object));
type Mutation {
update_policies_items(ids: [ID!]!, data: update_directus_policies_input): [directus_policies]
}
{
"data": [
{
"id": "22640672-eef0-4ee9-ab04-591f3afb288",
"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"
]
}
],
"meta": {}
}
Create a Policy
Create a new policy.
Query Parameters
Control what fields are being returned in the object.
What metadata to return in the response.
Request Body
Primary key of the policy;
Name of the policy.
Icon for the policy. Displayed in the Data Studio.
Description for the policy. Displayed in the Data Studio.
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.
Whether or not Two-Factor Authentication is required for users that have this policy.
If this policy grants the user admin access. This means that users with this policy have full permissions to everything.
Whether or not users with this policy have access to use the Data Studio.
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.
The roles this policy is assigned to. It expects and returns data from the directus_access collection. Many-to-many to roles via access.
The permissions assigned to this policy. One-to-many to permissions.
Responses
Primary key of the policy;
Name of the policy.
Icon for the policy. Displayed in the Data Studio.
Description for the policy. Displayed in the Data Studio.
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.
Whether or not Two-Factor Authentication is required for users that have this policy.
If this policy grants the user admin access. This means that users with this policy have full permissions to everything.
Whether or not users with this policy have access to use the Data Studio.
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.
The roles this policy is assigned to. It expects and returns data from the directus_access collection. Many-to-many to roles via access.
The permissions assigned to this policy. One-to-many to permissions.
POST /policies
import { createDirectus, rest, createPolicy } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(createPolicy(policy_object));
type Mutation {
create_policies_item(data: create_directus_policies_input!): directus_policies
}
{
"data": {
"id": "22640672-eef0-4ee9-ab04-591f3afb288",
"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"
]
}
}
Retrieve a Policy
List an existing policy by primary key.
Query Parameters
Unique identifier of the Policy.
Control what fields are being returned in the object.
What metadata to return in the response.
Responses
Primary key of the policy;
Name of the policy.
Icon for the policy. Displayed in the Data Studio.
Description for the policy. Displayed in the Data Studio.
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.
Whether or not Two-Factor Authentication is required for users that have this policy.
If this policy grants the user admin access. This means that users with this policy have full permissions to everything.
Whether or not users with this policy have access to use the Data Studio.
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.
The roles this policy is assigned to. It expects and returns data from the directus_access collection. Many-to-many to roles via access.
The permissions assigned to this policy. One-to-many to permissions.
GET /policies/{id}
import { createDirectus, rest, readPolicy } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(readPolicy(policy_id, query_object));
type Query {
policies_by_id(id: ID!): directus_policies
}
{
"data": {
"id": "22640672-eef0-4ee9-ab04-591f3afb288",
"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"
]
}
}
Delete a Policy
Delete an existing policy.
Query Parameters
Unique identifier of the policy.
Responses
DELETE /policies/{id}
import { createDirectus, rest, deletePolicy } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(deletePolicy(policy_id));
type Mutation {
delete_policies_item(id: ID!): delete_one
}
Update a Policy
Update an existing policy.
Query Parameters
Unique identifier of the policy.
Control what fields are being returned in the object.
What metadata to return in the response.
Request Body
Primary key of the policy;
Name of the policy.
Icon for the policy. Displayed in the Data Studio.
Description for the policy. Displayed in the Data Studio.
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.
Whether or not Two-Factor Authentication is required for users that have this policy.
If this policy grants the user admin access. This means that users with this policy have full permissions to everything.
Whether or not users with this policy have access to use the Data Studio.
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.
The roles this policy is assigned to. It expects and returns data from the directus_access collection. Many-to-many to roles via access.
The permissions assigned to this policy. One-to-many to permissions.
Responses
Primary key of the policy;
Name of the policy.
Icon for the policy. Displayed in the Data Studio.
Description for the policy. Displayed in the Data Studio.
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.
Whether or not Two-Factor Authentication is required for users that have this policy.
If this policy grants the user admin access. This means that users with this policy have full permissions to everything.
Whether or not users with this policy have access to use the Data Studio.
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.
The roles this policy is assigned to. It expects and returns data from the directus_access collection. Many-to-many to roles via access.
The permissions assigned to this policy. One-to-many to permissions.
PATCH /policies/{id}
import { createDirectus, rest, updatePolicy } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(updatePolicy(policy_id, partial_policy_object));
type Mutation {
update_policies_item(id: ID!, data: update_directus_policys_input): directus_policies
}
{
"data": {
"id": "22640672-eef0-4ee9-ab04-591f3afb288",
"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"
]
}
}