> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs.rightbrain.ai/v-1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.rightbrain.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.rightbrain.ai/_mcp/server.

# IAM - Update Document Member

POST https://app.rightbrain.ai/api/v1/org/{org_id}/project/{project_id}/document/{document_id}/iam/members/{member}
Content-Type: application/json

Update the roles that a member holds on the document.

Reference: https://docs.rightbrain.ai/api-reference/api-reference/knowledge/documents/document-iam-org-org-id-project-project-id-document-document-id-iam-update-member-roles

## Authentication

- `Authorization` header (bearer token, required) — API key or access token, sent as `Authorization: Bearer <token>`. The simplest option: create an API key in your dashboard under Settings, then paste it here.

## Servers

- `https://app.rightbrain.ai/api/v1` (Production, default)
- `https://app.rightbrain.ai/api/v1` (Staging API)
- `https://app.rblocal.dev/api/v1` (Local development)

## Request

### Path parameters

- `document_id` (string, required)
- `member` (string, required)
- `org_id` (string, required) — The org id
- `project_id` (string, required) — The project id

### Body (application/json)

This endpoint expects a DocumentIAMMemberRoleUpdate.

- `add` (list of enum, optional) — A list of document roles to grant to the member. Roles in this list are applied to the member AFTER any removals specified in `remove`. This may be combined with `remove_all` to replace the member's entire role list.
  - Allowed values: `editor`, `owner`, `viewer`
- `remove` (list of enum, optional) — A list of document roles to revoke from the member.
  - Allowed values: `editor`, `owner`, `viewer`
- `remove_all` (boolean, optional, nullable, default: false) — Removes all existing roles from the member. This may be combined with `add` to replace all existing roles that the member holds.

## Response

### 200

Document member updated successfully

- `member` (string, required) — The member identifier string, the format of which is '\<subject\_type>:\<subject\_id>'
- `roles` (list of string, optional, default: []) — A list of roles that the member holds on an entity. Some entities, such as Organizations, may contain members that exist without any roles.
- `name` (string, optional, nullable) — The name of the member.
- `avatar_url` (string, optional, nullable) — If avatar of the member, if it is supported by their subject type.
- `total_subjects` (integer, optional, default: 1) — The total number of subjects that the member represents, which may be a value other than `1` if the member is not a User.

## Errors

### 400 Bad Request Error

Bad Request

- `Document_iam_org_org_id_project_project_id_document_document_id_iam_update_member_rolesRequestBadRequestError`
  - InvalidMemberErrorResponse: InvalidMemberErrorResponse
  - InvalidRoleErrorResponse: InvalidRoleErrorResponse
  - InvalidSubjectTypeErrorResponse: InvalidSubjectTypeErrorResponse
  - MultipleRolesNotAllowedErrorResponse: MultipleRolesNotAllowedErrorResponse
  - MalformedResourceIdentifierErrorResponse: MalformedResourceIdentifierErrorResponse

### 403 Forbidden Error

Forbidden

- `Document_iam_org_org_id_project_project_id_document_document_id_iam_update_member_rolesRequestForbiddenError`
  - PermissionCheckFailedErrorResponse: PermissionCheckFailedErrorResponse
  - MissingAuthenticationErrorResponse: MissingAuthenticationErrorResponse

### 404 Not Found Error

Not Found

- `detail` (InvalidMemberErrorPayload, required) — The error payload.

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### InvalidMemberErrorResponse

- `detail` (InvalidMemberErrorPayload, required) — The error payload.

### InvalidRoleErrorResponse

- `detail` (InvalidRoleErrorPayload, required) — The error payload.

### InvalidSubjectTypeErrorResponse

- `detail` (InvalidSubjectTypeErrorPayload, required) — The error payload.

### MultipleRolesNotAllowedErrorResponse

- `detail` (MultipleRolesNotAllowedErrorPayload, required) — The error payload.

### MalformedResourceIdentifierErrorResponse

- `detail` (MalformedResourceIdentifierErrorPayload, required) — The error payload.

### PermissionCheckFailedErrorResponse

- `detail` (PermissionCheckFailedErrorPayload, required) — The error payload.

### MissingAuthenticationErrorResponse

- `detail` (MissingAuthenticationErrorPayload, required) — The error payload.

### InvalidMemberErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `INVALID_MEMBER`
- `invalidMemberError` (InvalidMemberErrorDetails, required) — Metadata detailing more information about the error.

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (ValidationErrorCtx, optional)

### InvalidRoleErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `INVALID_ROLE`
- `invalidRoleError` (InvalidRoleErrorDetails, required) — Metadata detailing more information about the error.

### InvalidSubjectTypeErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `INVALID_SUBJECT_TYPE`
- `invalidSubjectTypeError` (InvalidSubjectTypeErrorDetails, required) — Metadata detailing more information about the error.

### MultipleRolesNotAllowedErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `MULTIPLE_ROLES_NOT_ALLOWED`
- `multipleRolesNotAllowedError` (MultipleRolesNotAllowedErrorDetails, required) — Metadata detailing more information about the error.

### MalformedResourceIdentifierErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `MALFORMED_RESOURCE_IDENTIFIER`
- `malformedResourceIdentifierError` (MalformedResourceIdentifierErrorDetails, required) — Metadata detailing more information about the error.

### PermissionCheckFailedErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `PERMISSION_CHECK_FAILED`
- `permissionCheckFailedError` (PermissionCheckFailedErrorDetails, required) — Metadata detailing more information about the error.

### MissingAuthenticationErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `MISSING_AUTHENTICATION`
- `missingAuthenticationError` (EmptyErrorDetails, required) — Metadata detailing more information about the error.

### InvalidMemberErrorDetails

- `resource` (IAMObjectErrorDetails, optional, nullable)
- `subject` (IAMObjectErrorDetails, optional, nullable)

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

### InvalidRoleErrorDetails

- `role` (string, required)
- `resource` (IAMObjectErrorDetails, optional, nullable)

### InvalidSubjectTypeErrorDetails

- `subject` (IAMObjectErrorDetails, optional, nullable)

### MultipleRolesNotAllowedErrorDetails

- `roles` (list of string, required)
- `resource` (IAMObjectErrorDetails, optional, nullable)

### MalformedResourceIdentifierErrorDetails

- `field` (string, required)
- `value` (any, required)
- `expected_format` (string, required)

### PermissionCheckFailedErrorDetails

- `permission` (string, required)
- `subject` (IAMObjectErrorDetails, optional, nullable)
- `resource` (IAMObjectErrorDetails, optional, nullable)

### EmptyErrorDetails

### IAMObjectErrorDetails

- `type` (string, required)
- `id` (string, optional, nullable)

## Examples

**Request**

```json
{
  "add": [
    "owner"
  ],
  "remove_all": true
}
```

**Response**

```json
{
  "member": "user:0190c234-1111-2222-3333-444444444444",
  "roles": [
    "owner"
  ],
  "name": "Carlos Reyes",
  "avatar_url": null,
  "total_subjects": 1
}
```

**SDK Code**

```python Replace the member's roles
import requests

url = "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/document/document_id/iam/members/member"

payload = {
    "add": ["owner"],
    "remove_all": True
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Replace the member's roles
const url = 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/document/document_id/iam/members/member';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"add":["owner"],"remove_all":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Replace the member's roles
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/document/document_id/iam/members/member"

	payload := strings.NewReader("{\n  \"add\": [\n    \"owner\"\n  ],\n  \"remove_all\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Replace the member's roles
require 'uri'
require 'net/http'

url = URI("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/document/document_id/iam/members/member")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"add\": [\n    \"owner\"\n  ],\n  \"remove_all\": true\n}"

response = http.request(request)
puts response.read_body
```

```java Replace the member's roles
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/document/document_id/iam/members/member")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"add\": [\n    \"owner\"\n  ],\n  \"remove_all\": true\n}")
  .asString();
```

```php Replace the member's roles
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/document/document_id/iam/members/member', [
  'body' => '{
  "add": [
    "owner"
  ],
  "remove_all": true
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Replace the member's roles
using RestSharp;

var client = new RestClient("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/document/document_id/iam/members/member");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"add\": [\n    \"owner\"\n  ],\n  \"remove_all\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Replace the member's roles
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "add": ["owner"],
  "remove_all": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/document/document_id/iam/members/member")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```