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

# Update User Role

> Change a user's role in the workspace.

## Authentication & Scope

Requires the `workspace-users-write` ability.

## Request

```http theme={null}
PUT /workspaces/1/users/5/update-role HTTP/1.1
Host: api.raydocs.com
Authorization: Bearer <token>
Content-Type: application/json

{
  "role": "admin"
}
```

### Path Parameters

| Parameter     | Type    | Required | Description           |
| ------------- | ------- | -------- | --------------------- |
| `workspaceId` | integer | Yes      | The workspace ID      |
| `userId`      | integer | Yes      | The user ID to update |

### Body Parameters

| Parameter | Type   | Required | Description                              |
| --------- | ------ | -------- | ---------------------------------------- |
| `role`    | string | Yes      | New role: `admin`, `user`, or `readonly` |

## Response

`200 OK` – Role updated successfully.

```json theme={null}
{
  "message": "Role updated successfully"
}
```

`404 Not Found` – User is not a member of this workspace.


## OpenAPI

````yaml put /workspaces/{workspaceId}/users/{userId}/update-role
openapi: 3.0.1
info:
  title: Raydocs API
  description: REST API for document extraction with AI-powered data parsing
  version: 1.0.0
servers:
  - url: https://api.raydocs.com
security:
  - bearerAuth: []
tags:
  - name: Workspaces
    description: Create and manage workspaces.
  - name: Workspace Users
    description: Manage users within a workspace.
  - name: Extraction Templates
    description: Define extraction schemas and settings.
  - name: Extraction Sessions
    description: Manage extraction jobs and documents.
  - name: Batch Operations
    description: Bulk operations on sessions.
  - name: Documents
    description: Upload and manage source documents.
  - name: Workflows
    description: Discover workflow runs and read their public outputs.
  - name: Results
    description: Access extraction results.
paths:
  /workspaces/{workspaceId}/users/{userId}/update-role:
    put:
      tags:
        - Workspace Users
      summary: Update User Role
      description: >-
        Update a member's role in the workspace. Requires
        `workspace-users-write`.
      operationId: updateWorkspaceUserRole
      parameters:
        - name: workspaceId
          in: path
          required: true
          schema:
            type: integer
        - name: userId
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - role
              properties:
                role:
                  type: string
                  enum:
                    - admin
                    - user
                    - readonly
      responses:
        '200':
          description: Role updated
        '403':
          description: Forbidden
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Personal Access Token created from the Raydocs dashboard.

        Include in the Authorization header: `Bearer <your_token>`

        See [API Keys](/api-reference/api-keys) for token creation and
        management.

````