Skip to content

Delete



POST /api/v1/role/{role_uuid}/delete

Overview

Delete a custom role and permission relationships in the current workspace, and clean up related menu references.

Prerequisites and Usage Steps

Select a workspace custom role from Role List. Before deletion, first migrate members/API Keys, SAML or login mappings, and SSO configurations that use this role. System reserved roles and built-in roles of admin console applications cannot be deleted through this API. There is no request body. A successful call returns content={}, not true. If no workspace custom role is found, the same empty object may also be returned, so you need to query the list again to confirm. Deleting a role does not delete accounts. If the above direct member/API Key, SAML/login mapping, and SSO references are detected, remove them first before retrying. Inherited role mappings such as managed account groups need to be checked separately. This API does not guarantee validation or automatic removal of all inheritance relationships.

Path Parameters

Parameter Type Required Description
role_uuid string Y UUID of the workspace custom role. Do not use a name or the UUID of an admin console built-in role template as a substitute.
Example: role_example
How to obtain or enter: Obtain the target workspace custom role from content.data[].uuid in Role List, and verify it with Role Details.

Request Headers

Parameter Type Required Description
DF-API-KEY string Y OpenAPI authentication credential for the workspace.
Example: <DF-API-KEY>
How to obtain or enter: Obtain an OpenAPI Key with permission for this operation from API Key Management in the target workspace.

Additional Parameter Notes

The deletion result of this API only indicates that the processing flow has ended. It does not provide an item-by-item reference list or replace business roles required by other principals.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/role/role_example/delete' \
  -H 'DF-API-KEY: <DF-API-KEY>'

Response

HTTP 200, application/json. The example below shows the main fields that can be read directly.

Field Type Description
content object Deletion processing returns an empty object {}. This result also covers cases where no deletable role is found, and no declaration is appended.
{
  "code": 200,
  "content": {},
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Responses

For authentication, rate limiting, and common request errors, see Common Error Definitions.

HTTP Status errorCode Trigger Condition Message or Response Description Resolution
400 ft.InvalidAction Deleting a system reserved role or a built-in role of an admin console application Invalid operation Preserve protected roles; operate only on target workspace custom roles.
400 ft.InvalidActionRoleExistsRefAccount The role is still directly referenced by a member account or API Key The current role is associated with member accounts/API KEYs. Clear the association before deletion. Migrate the role bindings of these principals first, then delete.
400 ft.InvalidActionRoleExistsRefSAMLMapping The role is still referenced by SAML or a custom login mapping The current role is associated with SAML Mapping. Clear the association before deletion. Adjust the corresponding mapping rules first.
400 ft.InvalidActionRoleExistsRefSSOSetting The role is still referenced by SSO configuration The current role is associated with SSO configuration. Update the SSO configuration before deleting the role. First replace the default role in the SSO configuration.
500 ft.InternalServerError Deletion, menu reference cleanup, or other internal processing failed Internal error Check whether the role still exists and its reference status first, then decide whether to retry. If the failure persists, provide the traceId.
401 ft.WKSPNotExistOrReleased The workspace was deleted or released when cleaning up menu references Workspace does not exist or has been released Check whether the workspace corresponding to the API Key is still valid, and select an available workspace again.

Feedback

Is this page helpful?