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

# Set User Admin Access

<Info>
  **Required permission:** Admin (`admin`).
</Info>

Admin access is membership in the **Admin** group, so this endpoint adds the user to that group or removes them from it.

<Note>
  This endpoint applies to Onyx **v4.7 and later**. It replaces `PATCH /manage/set-user-role`,
  which was removed with the role model in v4.7. For older versions,
  see [Set User Role](/developers/api_reference/user_management/set_user_role). To grant any other permission,
  add the user to a group that grants it.
</Note>

Onyx rejects the request when it would lock you out of the admin panel or when the account cannot hold admin access:

* You cannot remove yourself from the Admin group. Ask another admin to do it.
* You cannot remove the last admin. Grant another user admin access first.
* This endpoint cannot change admin access for service accounts, bot accounts, external permission accounts,
  or anonymous accounts. To grant an API key admin access, assign its service account to the Admin group.


## OpenAPI

````yaml PATCH /manage/admin/users/admin-access
openapi: 3.1.0
info:
  title: Onyx API
  description: Onyx API for AI-powered enterprise search and chat
  version: Development
servers:
  - url: https://cloud.onyx.app/api
security: []
paths:
  /manage/admin/users/admin-access:
    patch:
      tags:
        - public
      summary: Set User Admin Access Endpoint
      operationId: set_user_admin_access_endpoint
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserAdminAccessUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    UserAdminAccessUpdateRequest:
      properties:
        user_email:
          type: string
          title: User Email
        is_admin:
          type: boolean
          title: Is Admin
      type: object
      required:
        - user_email
        - is_admin
      title: UserAdminAccessUpdateRequest
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Authorization header with Bearer token

````