younifyd
Menu

Create Role

Create a Role

POST/roles‎

Use it in a workflow

  1. Add a step and choose the Directus connector.
  2. Pick the Create Role action (under Roles).
  3. Fill in the fields below, then reference the result from later steps as {{createRole.response.data}}.

Request

Query parameters

fieldsarray<string>

Control what fields are being returned in the object.

metastring

What metadata to return in the response.

Request body

Enter the body as JSON in the step's Body field.

descriptionstring

Description of the role.

enforce_tfaboolean

Whether or not this role enforces the use of 2FA.

external_idstring

ID used with external services in SCIM.

ip_accessarray<string>

Array of IP addresses that are allowed to connect to the API as a user of this role.

module_listingstring

Custom override for the admin app module bar navigation.

namestring

Name of the role.

json
{
  "description": "string",
  "enforce_tfa": false,
  "external_id": "string",
  "ip_access": [
    "string"
  ],
  "module_listing": "string",
  "name": "Interns"
}

Response

Returns 200 with an object. Read it in later steps with {{createRole.response.data.<field>}}.

dataobject
idstring (uuid)

Unique identifier for the role.

namestring

Name of the role.

iconstring

The role's icon.

descriptionstring

Description of the role.

parentstring (uuid)

Optional parent role that this role inherits permissions from. Many-to-one to roles.

childrenarray<oneOf>

Nested child roles that inherit this roles permissions. One-to-many to roles. One-to-many to roles.

policiesarray<oneOf>

The policies in this role. Many-to-many to roles.

usersarray<oneOf>

The users in this role. One-to-many to users.

json
{
  "data": {
    "id": "2f24211d-d928-469a-aea3-3c8f53d4e426",
    "name": "Administrator",
    "icon": "verified_user",
    "description": "Admins have access to all managed data within the system by default",
    "parent": "00000000-0000-0000-0000-000000000000",
    "children": [
      null
    ],
    "policies": [
      null
    ],
    "users": [
      null
    ]
  }
}

Need more? See the Directus guide for connection setup and behaviour shared by every action.

Was this page helpful?