# List roles

Read workspace roles by role ID, including their labels, origins, assignment rules and number of active members using each base role.

POST https://api.brigg.app/v1/operations/workspace.ListRoles

## Access & visibility

Allow `workspace.ListRoles` on your API key.

**Workspace access by default.** Private member data requires [approved member delegation](https://developer.brigg.app/authentication#member-delegation) through `Brigg-Act-As`; the key supplies permissions while private ownership and project boundaries remain enforced.

[Set up authentication](https://developer.brigg.app/authentication) · [Choose permissions](https://developer.brigg.app/permissions)

## Request

No parameters. Send an empty JSON object (`{}`).

## Response

Returns **200 OK** with a JSON body.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `roles` | map of [WorkspaceRole](#workspacerole-response-roles) | Yes | Workspace role definitions keyed by role identifier. Use the key, not the label, when interpreting a member's role. |

### WorkspaceRole · response.roles.*

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `label` | string | No | Human-readable name of this role. |
| `description` | string | No | Descriptive text. |
| `chatOnly` | boolean | No | Whether this role limits the member to chat-based access. Allowed: `false`, `true`. |
| `system` | boolean | Yes | Whether Brigg supplies this role as a built-in role. Allowed: `false`, `true`. |
| `origin` | string | No | Where this role was defined: a bundled app, a custom definition or Brigg itself. Allowed: `"bundle"`, `"custom"`, `"system"`. |
| `assignable` | boolean | Yes | Whether this role can be assigned to workspace members. Allowed: `false`, `true`. |
| `memberCount` | number | Yes | Number of workspace members assigned to this role. |

## Errors & retries

This operation reads data. It needs no idempotency key and can be retried after a transient failure.

For rate limits, follow the server’s retry guidance and back off. See [HTTP errors](https://developer.brigg.app/http#errors) and [safe retries and limits](https://developer.brigg.app/reliability).

| HTTP status | Code | What to do |
| --- | --- | --- |
| 400 | `invalid_json` | Send a JSON object with Content-Type: application/json. |
| 400 | `invalid_input` | Check the request fields and types. |
| 401 | `invalid_key` | The workspace API key is missing, invalid or revoked. |
| 403 | `forbidden` | Check the key’s operation and resource grants. If Brigg-Act-As is supplied, the key must be authorized to delegate to that member. |
| 404 | `not_found` | The requested operation or resource is not available to this credential. |
| 429 | `rate_limited` | Wait for Retry-After before retrying. |

## Next steps

[Download OpenAPI](https://developer.brigg.app/openapi.json) · [Versioning & retirement](https://developer.brigg.app/versioning)

## Examples

### Example request

Fictional values. Replace IDs and business details with values from your workspace.
#### cURL


```sh
curl 'https://api.brigg.app/v1/operations/workspace.ListRoles' \
  -H "Authorization: Bearer $BRIGG_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{}'
```

#### TypeScript


```typescript
const response = await fetch("https://api.brigg.app/v1/operations/workspace.ListRoles", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({}),
});
const result = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${result.error} — ${result.message}`);
console.log(result);
```

#### Python


```python
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError

payload = {}
request = Request(
    "https://api.brigg.app/v1/operations/workspace.ListRoles",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['BRIGG_API_KEY']}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urlopen(request) as response:
        print(json.load(response))
except HTTPError as error:
    print(error.code, json.load(error))
    raise
```

#### Response example


```json
{
  "roles": {
    "member": {
      "label": "Member",
      "system": true,
      "origin": "system",
      "assignable": true,
      "memberCount": 8
    },
    "admin": {
      "label": "Administrator",
      "system": true,
      "origin": "system",
      "assignable": true,
      "memberCount": 2
    }
  }
}
```

## JSON schemas


```json-schema-request
{
  "type": "object",
  "properties": {},
  "additionalProperties": false,
  "examples": [
    {}
  ]
}
```


```json-schema-response
{
  "type": "object",
  "properties": {
    "roles": {
      "type": "object",
      "description": "Workspace role definitions keyed by role identifier. Use the key, not the label, when interpreting a member's role.",
      "additionalProperties": {
        "title": "WorkspaceRole",
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "Human-readable name of this role."
          },
          "description": {
            "type": "string",
            "description": "Descriptive text."
          },
          "chatOnly": {
            "type": "boolean",
            "enum": [
              false,
              true
            ],
            "description": "Whether this role limits the member to chat-based access."
          },
          "system": {
            "type": "boolean",
            "enum": [
              false,
              true
            ],
            "description": "Whether Brigg supplies this role as a built-in role."
          },
          "origin": {
            "type": "string",
            "enum": [
              "bundle",
              "custom",
              "system"
            ],
            "description": "Where this role was defined: a bundled app, a custom definition or Brigg itself."
          },
          "assignable": {
            "type": "boolean",
            "enum": [
              false,
              true
            ],
            "description": "Whether this role can be assigned to workspace members."
          },
          "memberCount": {
            "type": "number",
            "description": "Number of workspace members assigned to this role."
          }
        },
        "required": [
          "system",
          "assignable",
          "memberCount"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "roles"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "roles": {
        "member": {
          "label": "Member",
          "system": true,
          "origin": "system",
          "assignable": true,
          "memberCount": 8
        },
        "admin": {
          "label": "Administrator",
          "system": true,
          "origin": "system",
          "assignable": true,
          "memberCount": 2
        }
      }
    }
  ]
}
```

