cloneRole
Requires permission settings:role:create.
Clone an existing role into a new one (permissions copied by default, user assignments on request)
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation CloneRole($input: CloneRoleInput!) {
cloneRole(input: $input) {
id
name
displayName
createdAt
deletedAt
deletedBy
permissions {
id
name
createdAt
action
description
direct
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation CloneRole($input: CloneRoleInput!) {\n cloneRole(input: $input) {\n id\n name\n displayName\n createdAt\n deletedAt\n deletedBy\n permissions {\n id\n name\n createdAt\n action\n description\n direct\n }\n }\n}",
"variables": {
"input": {
"newRoleDisplayName": "string",
"newRoleName": "string",
"sourceRoleId": "string"
}
}
}
EOF
Variables:
{
"input": {
"newRoleDisplayName": "string",
"newRoleName": "string",
"sourceRoleId": "string"
}
}
Response:
{
"data": {
"cloneRole": {
"id": "id",
"name": "string",
"displayName": "string",
"createdAt": "2025-01-15T00:00:00Z",
"deletedAt": "2025-01-15T00:00:00Z",
"deletedBy": "string",
"permissions": [
{
"id": "id",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"action": "string",
"description": "string",
"direct": true
}
]
}
}
}
cloneRole(
input: CloneRoleInput!
): Role!
Arguments
cloneRole.input ● CloneRoleInput! non-null input
The details of the clone role request.
Type
Role object
A role: a named set of permissions that can be given to users.