Skip to main content

get-role

dci get-role <id>

Returns a single role by ID. Preset roles are visible to every customer; a custom role is returned only to the customer that owns it. A service account of a parent tenant can read a descendant tenant's role by setting X-Tenant-Id to that tenant's customer ID.

  • id — Role ID or name as shown by dci list-roles. Names resolve (exact, unique substring, or close typo); pass --id to force a literal ID.

Preset roles are visible to every customer; a custom role is returned only to the customer that owns it, and an unknown ID or another customer's role returns 404.

Examples​

# Show one role, by name.
dci get-role "FinOps Analyst"
# The full record as JSON, including the permission IDs.
dci get-role <role-id> --output json
# Only the permission IDs, for example to copy into another role.
dci get-role <role-id> --fields permissions --output json

Output​

OK - Role returned.

By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.

FieldTypeDescription
idstringThe unique ID of the role.
namestringThe name of the role.
typestringThe type of the role (preset or custom). One of: "preset", "custom".
descriptionstringThe description of the role. An empty string when no description is set.
customerstringThe customer ID if this is a custom role. An empty string for a preset role.
permissionsarray of stringPermission IDs in stored order. An empty array when no permissions are assigned.
childTenantEligiblebooleanWhether the owning tenant made this role available as a child tenant role.
Raw JSON schema
{
"type": "object",
"description": "Definition and permissions assigned to a role.",
"required": [
"id",
"name",
"type",
"description",
"customer",
"permissions",
"childTenantEligible"
],
"properties": {
"id": {
"type": "string",
"description": "The unique ID of the role."
},
"name": {
"type": "string",
"description": "The name of the role."
},
"type": {
"type": "string",
"enum": [
"preset",
"custom"
],
"description": "The type of the role (preset or custom)."
},
"description": {
"type": "string",
"description": "The description of the role. An empty string when no description is set."
},
"customer": {
"type": "string",
"description": "The customer ID if this is a custom role. An empty string for a preset role."
},
"permissions": {
"type": "array",
"description": "Permission IDs in stored order. An empty array when no permissions are assigned.",
"items": {
"type": "string"
}
},
"childTenantEligible": {
"type": "boolean",
"description": "Whether the owning tenant made this role available as a child tenant role."
}
}
}

Errors​

On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.

HTTP status to exit code mapping
HTTP statusExit codeError codeMeaning
40110AUTHENTICATION_FAILEDNot signed in, or the API token is invalid. Run dci login or check DCI_API_KEY.
40311PERMISSION_DENIEDThe DoiT user or the active customer context does not have access.
40420RESOURCE_NOT_FOUNDThe requested resource does not exist. Check the identifier argument.
50040API_SERVER_ERRORThe API failed to process the request. Retryable; contact DoiT support if it persists.

Aliases: getrole