> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aion.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Revoke Role Assignment from a User

> Remove a specific role assignment from a user.

**Restrictions:**
- Organization admins cannot remove their own admin role
- The last organization admin in an account cannot be removed




## OpenAPI

````yaml DELETE /api/v1/accounts/{accountId}/roles/{roleId}/assignments/{assigneeId}
openapi: 3.1.0
info:
  title: AuthZ Service API
  description: Authorization service for managing roles and user permissions
  version: 1.1.0
servers:
  - url: https://api.aion.xyz
    description: Production server
  - url: https://api.dev.internal.aion.xyz
    description: Staging server
security:
  - BearerAuth: []
tags:
  - name: Authorization
    description: Authorization check operations
  - name: Roles
    description: Operations related to role management
  - name: User Roles
    description: Operations related to user role queries
  - name: Role Assignments
    description: Operations for assigning, updating, and revoking roles
paths:
  /api/v1/accounts/{accountId}/roles/{roleId}/assignments/{assigneeId}:
    delete:
      tags:
        - Role Assignments
      summary: Revoke role assignment from a user
      description: |
        Remove a specific role assignment from a user.

        **Restrictions:**
        - Organization admins cannot remove their own admin role
        - The last organization admin in an account cannot be removed
      operationId: deleteRoleAssignment
      parameters:
        - name: accountId
          in: path
          required: true
          description: The account identifier (external account ID)
          schema:
            type: string
            example: my-company-account
        - name: roleId
          in: path
          required: true
          description: The role identifier to revoke
          schema:
            type: string
            example: project_reader
        - name: assigneeId
          in: path
          required: true
          description: The assignee identifier (external user ID)
          schema:
            type: string
            example: john.doe
        - name: assigneeType
          in: query
          required: false
          description: The type of assignee (defaults to USER)
          schema:
            $ref: '#/components/schemas/AssigneeType'
            default: USER
        - name: projectId
          in: query
          required: false
          description: Project identifier for project-scoped role assignments
          schema:
            type: string
            example: project-alpha
      responses:
        '200':
          description: Role assignment successfully revoked
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Assignment deleted successfully
        '400':
          description: Bad request - validation failed or org admin restriction violated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_error:
                  summary: Validation Error
                  value:
                    error:
                      code: BAD_REQUEST
                      message: Invalid request parameters
                      details:
                        - projectId is required for PROJECT scoped roles
                self_removal:
                  summary: Self Removal Blocked
                  value:
                    error:
                      code: BAD_REQUEST
                      message: Cannot remove yourself
                      details:
                        - Organization admins cannot remove their own admin role
                last_admin:
                  summary: Last Admin Protection
                  value:
                    error:
                      code: BAD_REQUEST
                      message: Cannot remove last admin
                      details:
                        - >-
                          Cannot remove the last organization admin from the
                          account
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    AssigneeType:
      type: string
      enum:
        - USER
        - IAMGROUP
      description: The type of assignee
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Error code
              example: BAD_REQUEST
            message:
              type: string
              description: Error message
              example: Invalid request parameters
            details:
              type: array
              items:
                type: string
              description: Additional error details
              example:
                - projectId is required for PROJECT scoped roles
          required:
            - code
            - message
      required:
        - error
  responses:
    Unauthorized:
      description: Unauthorized - Authentication required
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: UNAUTHORIZED
              message: Authentication required
    Forbidden:
      description: Forbidden - Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: FORBIDDEN
              message: Insufficient permissions to access this resource
    NotFound:
      description: Not found - Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: NOT_FOUND
              message: Resource not found
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT Bearer token authentication

````