---
title: "List the grants (shares) on a resource"
---

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

# List the grants (shares) on a resource

Path: CloudRaker Workspace API › Authorization

`GET /authorization/grants/resource`

Lists the role grants on a single resource — who it is shared with. Authorization: org admin, or the caller holds the resource’s share permission on the target (`space:share`/`spacetype:share`/`work_session:manage`; `settings` is admin-only); otherwise 403 `forbidden`. Query: `resourceType` (`space` | `spacetype` | `settings` | `work_session`) and `externalId` (required); optional `assignment` = `direct` | `indirect` filters to directly-assigned vs inherited grants. Returns the resource’s grants. `work_session` is readable here but NOT writable: the Workspace routes mint session grants, so `POST`/`DELETE /grants` still take only the three shareable types.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Query parameters

- `resourceType` (`listResourceGrants.query.resourceType`; string, required)
  - one of `"space"`, `"spacetype"`, `"settings"`, `"work_session"`
- `externalId` (`listResourceGrants.query.externalId`; string, required)
  - minLength 1
- `assignment` (`listResourceGrants.query.assignment`; string, optional)
  - one of `"direct"`, `"indirect"`

## Code samples

### cURL

```bash
curl --request GET \
  --url 'https://api.cloudraker.com/authorization/grants/resource?resourceType=space&externalId=string' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/authorization/grants/resource?resourceType=space&externalId=string';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/authorization/grants/resource?resourceType=space&externalId=string"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

The subjects and roles granted on the resource.

#### Example

```json
{
  "assignment": "direct",
  "roleAssignments": [
    {
      "id": "string",
      "organizationMembershipId": "string",
      "role": {
        "slug": "space-member"
      },
      "resource": {
        "id": "string",
        "externalId": "string",
        "resourceTypeSlug": "space"
      }
    }
  ],
  "memberships": [
    {
      "property1": null,
      "property2": null
    }
  ]
}
```

- `assignment` (`listResourceGrants.response.200.assignment`; string, required)
  - one of `"direct"`, `"indirect"`
- `roleAssignments` (`listResourceGrants.response.200.roleAssignments`; array<object>, optional)
  - `id` (`listResourceGrants.response.200.roleAssignments.id`; string, required)
  - `role` (`listResourceGrants.response.200.roleAssignments.role`; object, required)
    - `slug` (`listResourceGrants.response.200.roleAssignments.role.slug`; string, required)
      - example `"space-member"`
  - `resource` (`listResourceGrants.response.200.roleAssignments.resource`; object, required)
    - `id` (`listResourceGrants.response.200.roleAssignments.resource.id`; string, required)
    - `externalId` (`listResourceGrants.response.200.roleAssignments.resource.externalId`; string, required)
    - `resourceTypeSlug` (`listResourceGrants.response.200.roleAssignments.resource.resourceTypeSlug`; string, required)
      - example `"space"`
  - `organizationMembershipId` (`listResourceGrants.response.200.roleAssignments.organizationMembershipId`; string, optional)
- `memberships` (`listResourceGrants.response.200.memberships`; array<map<unknown>>, optional) — The memberships behind the assignments, for rendering a share list.

### 400

Validation Error

#### Example

```json
{
  "success": false,
  "error": [
    null
  ],
  "data": null
}
```

- `success` (`listResourceGrants.response.400.success`; boolean, required)
  - one of `false`
- `error` (`listResourceGrants.response.400.error`; array<unknown>, required)
- `data` (`listResourceGrants.response.400.data`; unknown, required)

### 403

Caller is not an admin and lacks the resource’s share permission


Source: https://docs.cloudraker.com/workspace/api/authorization/list-resource-grants/index.md
