> 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 - Test Project Permissions

POST https://app.rightbrain.ai/api/v1/org/{org_id}/project/{project_id}/oauth_client/{oauth_client_id}/iam/test
Content-Type: application/json

Test the permissions that the caller (or another subject) holds on the project.

Reference: https://docs.rightbrain.ai/api-reference/api-reference/platform/o-auth-clients/project-iam-org-org-id-project-project-id-oauth-client-oauth-client-id-iam-test-permissions

## 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

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

### Body (application/json)

This endpoint expects a ProjectIAMPermissionTest.

- `permissions` (list of enum, required) — A list of permissions to test on the project.
  - Allowed values: `add_editor`, `add_member`, `add_owner`, `collections_edit`, `collections_view`, `create_chat`, `create_collection`, `create_compose`, `create_datasource_connection`, `create_document`, `create_mcp_server`, `create_oauth_client`, `create_project_integration`, `create_skill`, `create_task`, `create_task_agent`, `create_task_forwarder`, `create_task_mcp_server`, `datasource_connections_edit`, `datasource_connections_view`, `documents_edit`, `documents_view`, `edit`, `edit_data`, `list_documents`, `query_data`, `remove_editor`, `remove_member`, `remove_owner`, `run_task`, `run_task_agent`, `view`, `view_data`, `view_members`
- `member` (string, optional, nullable)

## Response

### 200

Project permissions tested successfully

- `permissions` (list of string, required)
- `member` (string, optional, nullable)

## Errors

### 400 Bad Request Error

Bad Request

- `Project_iam_org_org_id_project_project_id_oauth_client_oauth_client_id_iam_test_permissionsRequestBadRequestError`
  - InvalidMemberErrorResponse: InvalidMemberErrorResponse
  - InvalidRoleErrorResponse: InvalidRoleErrorResponse
  - InvalidSubjectTypeErrorResponse: InvalidSubjectTypeErrorResponse
  - MalformedResourceIdentifierErrorResponse: MalformedResourceIdentifierErrorResponse

### 403 Forbidden Error

Forbidden

- `Project_iam_org_org_id_project_project_id_oauth_client_oauth_client_id_iam_test_permissionsRequestForbiddenError`
  - 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.

### 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.

### 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)

### 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
{
  "permissions": [
    "view",
    "edit",
    "view_members"
  ]
}
```

**Response**

```json
{
  "permissions": [
    "edit",
    "view",
    "view_members"
  ],
  "member": "user:0190c234-1111-2222-3333-444444444444"
}
```

**SDK Code**

```python Test the caller's own permissions
import requests

url = "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/oauth_client/oauth_client_id/iam/test"

payload = { "permissions": ["view", "edit", "view_members"] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Test the caller's own permissions
const url = 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/oauth_client/oauth_client_id/iam/test';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"permissions":["view","edit","view_members"]}'
};

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

```go Test the caller's own permissions
package main

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

func main() {

	url := "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/oauth_client/oauth_client_id/iam/test"

	payload := strings.NewReader("{\n  \"permissions\": [\n    \"view\",\n    \"edit\",\n    \"view_members\"\n  ]\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 Test the caller's own permissions
require 'uri'
require 'net/http'

url = URI("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/oauth_client/oauth_client_id/iam/test")

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  \"permissions\": [\n    \"view\",\n    \"edit\",\n    \"view_members\"\n  ]\n}"

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

```java Test the caller's own permissions
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/oauth_client/oauth_client_id/iam/test")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"permissions\": [\n    \"view\",\n    \"edit\",\n    \"view_members\"\n  ]\n}")
  .asString();
```

```php Test the caller's own permissions
<?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/oauth_client/oauth_client_id/iam/test', [
  'body' => '{
  "permissions": [
    "view",
    "edit",
    "view_members"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Test the caller's own permissions
using RestSharp;

var client = new RestClient("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/oauth_client/oauth_client_id/iam/test");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"permissions\": [\n    \"view\",\n    \"edit\",\n    \"view_members\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Test the caller's own permissions
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["permissions": ["view", "edit", "view_members"]] 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/oauth_client/oauth_client_id/iam/test")! 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()
```