Permissions
List Permission Rules
List all permission rules 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.
GET /permissions
{
"data": [
{
"id": 1,
"collection": "customers",
"action": "create",
"permissions": {},
"validation": {},
"presets": {},
"fields": []
}
],
"meta": {}
}
Create Multiple Permission Rules
Create multiple new permission rules.
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.
Request Body
POST /permissions
{
"data": [
{
"id": 1,
"collection": "customers",
"action": "create",
"permissions": {},
"validation": {},
"presets": {},
"fields": []
}
],
"meta": {}
}
Delete Multiple Permission Rules
Delete multiple existing permission rules.
DELETE /permissions
Update Multiple Permission Rules
Update multiple permissions 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 /permissions
{
"data": [
{
"id": 1,
"collection": "customers",
"action": "create",
"permissions": {},
"validation": {},
"presets": {},
"fields": []
}
],
"meta": {}
}
Create a Permission Rule
Create a new permission rule.
Query Parameters
What metadata to return in the response.
Request Body
What collection this permission applies to.
If the user can post comments.
If the user can create items.
If the user can update items.
If the user is required to leave a comment explaining what was changed.
If the user can read items.
Unique identifier of the role this permission applies to.
Explicitly denies read access for specific fields.
What status this permission applies to.
Explicitly denies specific statuses to be used.
If the user can update items.
Explicitly denies write access for specific fields.
POST /permissions
{
"data": {
"id": 1,
"collection": "customers",
"action": "create",
"permissions": {},
"validation": {},
"presets": {},
"fields": []
}
}
Retrieve a Permission Rule
Retrieve a single permission rules object by unique identifier.
Query Parameters
Identifier for the object.
Control what fields are being returned in the object.
What metadata to return in the response.
GET /permissions/{id}
{
"data": {
"id": 1,
"collection": "customers",
"action": "create",
"permissions": {},
"validation": {},
"presets": {},
"fields": []
}
}
Delete a Permission Rule
Delete an existing permission rule.
Query Parameters
Identifier for the object.
DELETE /permissions/{id}
Update a Permission Rule
Update an existing permission rule.
Query Parameters
Identifier for the object.
What metadata to return in the response.
Request Body
What collection this permission applies to.
If the user can post comments. full.
If the user can create items.
If the user can update items.
If the user is required to leave a comment explaining what was changed.
If the user can read items.
Explicitly denies read access for specific fields.
Unique identifier of the role this permission applies to.
What status this permission applies to.
Explicitly denies specific statuses to be used.
If the user can update items.
Explicitly denies write access for specific fields.
PATCH /permissions/{id}
{
"data": {
"id": 1,
"collection": "customers",
"action": "create",
"permissions": {},
"validation": {},
"presets": {},
"fields": []
}
}
Get Current User Permissions
Check the current user's permissions across all collections. The response is an object that contains one entry for every collection with at least one permission. Each collection has entries corresponding to the actions the user is able to perform on the collection. The `access` property indicates the level of access the user has for an action for a collection. `"none"` means the user has no access, `"partial"` means the user has access to some items, but may not have access to all items, and `"full"` means the user has access to all items.
GET /permissions/me
Check Permissions for a Specific Item
Check the current user's permissions on a specific item. For a singleton where update access is given, the presets and fields properties from the corresponding update permission are additionally returned. The response structure is maintained in any case, even if the collection or item does not exist. To check for the existence of an item, use the get items endpoint instead.
Query Parameters
Collection of which you want to retrieve the items from.
Identifier for the object.
GET /permissions/me/{collection}/{id}