API7 Docs

Delete Custom Role

DELETE /roles/{role_name}

DELETE /roles/{role_name}

Interactive request editor loads with JavaScript.

Authorization

BearerAdminToken
AuthorizationBearer <token>

Organization-scoped admin token. Read operations require a valid token, and write operations require a token with write permission.

In: header

Path Parameters

role_name*string

Custom role name.

Match^[a-z][a-z0-9_-]{1,63}$
Length2 <= length <= 64

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X DELETE "$AISIX_CP/roles/$ROLE_NAME" \  -H "Authorization: Bearer $AISIX_TOKEN"

Deleted

{
  "deleted": true,
  "name": "string"
}
Complete operation details and schema variants

DELETE /roles/{role_name}

Delete Custom Role

Delete a custom role. Built-in roles cannot be deleted. A custom role must first be removed from members, pending invitations, directory-sync settings, and environment role bindings. Member assignments and environment bindings can be cleared through this API. Pending invitations and directory-sync role settings must currently be cleared in the dashboard before retrying.

Parameters

  • role_name (path, string, required): Custom role name.

Responses

  • 200: Deleted

  • deleted (boolean, required): Always true on success.

  • name (string, required): Deleted custom role name.

  • 400: Request body or parameters failed validation.

  • error (object, required): Error details.

  • error.code (string, required): Machine-readable identifier. Examples: UNAUTHENTICATED, INVALID_REQUEST, MASTER_KEY_UNSET, INTERNAL.

  • error.message (string, required): Human-readable explanation; safe to surface to operators.

  • 401: Missing or invalid bearer. Response fields (application/json): identical to DELETE /roles/{role_name}, response 400 above.

  • 403: Authenticated request is not permitted. Response fields (application/json): identical to DELETE /roles/{role_name}, response 400 above.

  • 404: Resource not found. Response fields (application/json): identical to DELETE /roles/{role_name}, response 400 above.

  • 409: The role is still referenced. Response fields (application/json): identical to DELETE /roles/{role_name}, response 400 above.

cURL

curl -X DELETE '$AISIX_CP/roles/{role_name}' -H 'Authorization: Bearer $AISIX_TOKEN'