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

# Get Resource Access

> See who can access a resource and why

```
GET /openapi/memorylake/admin/v1/access/{resource_type}/{resource_id}
```

Lists every member and access group that can access the resource and why — their role, an access scope, an access group, the parent workspace or a permission level — plus the members who cannot, and the permission levels you may set here. You must also be able to view the resource yourself.

| `resource_type` | `resource_id` is | Permission |
| - | - | - |
| `workspaces` | `workspace_id` | `workspace:assign` on `workspace_id` or `access_group:view`<br />Also required: `workspace:read` on `workspace_id` |
| `projects` | `project_id` | `project:assign` on `project_id` or `access_group:view`<br />Also required: `project:read` on `project_id` |
| `actors` | `actor_id` | `actor:assign` on `actor_id` or `access_group:view`<br />Also required: `actor:read` on `actor_id` |
| `agents` | `agent_id` | `agent:assign` on `agent_id` or `access_group:view`<br />Also required: `agent:read` on `agent_id` |
| `skills` | `skill_id` | `skill:assign` on `skill_id` or `access_group:view`<br />Also required: `skill:read` on `skill_id` |
| `boundaries` | `boundary_id` | `boundary:assign` on `boundary_id` or `access_group:view`<br />Also required: `boundary:read` on `boundary_id` |
| `workspaces/{workspace_id}/actors` | `actor_id` | `workspace_actor:assign` on `workspace_id}/{actor_id` or `access_group:view`<br />Also required: `workspace_actor:read` on `workspace_id}/{actor_id` |
| `workspaces/{workspace_id}/agents` | `agent_id` | `workspace_agent:assign` on `workspace_id}/{agent_id` or `access_group:view`<br />Also required: `workspace_agent:read` on `workspace_id}/{agent_id` |

### Path Parameters

<ParamField path="resource_type" type="string" required>
  Resource type — one of the values in the table above
</ParamField>

<ParamField path="resource_id" type="string" required>
  Identifier of the resource, as listed in the table above
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET 'https://app.memorylake.ai/openapi/memorylake/admin/v1/access/workspaces/69e585312c30a734cd7727316b1918bd' \
    -H 'Authorization: Bearer sk_xxxxxx'
  ```
</RequestExample>

### Response

<ResponseField name="data" type="object">
  <Expandable title="Resource Access View object">
    <ResponseField name="allowed" type="array">
      Members and access groups that reach the instance

      <Expandable title="Resource Access Entry object">
        <ResponseField name="name" type="string">Display name</ResponseField>
        <ResponseField name="subject_id" type="string">principal\_id, or access group id</ResponseField>
        <ResponseField name="subject_type" type="string">member or access\_group</ResponseField>
        <ResponseField name="actions" type="array">Actions the explicit sources allow</ResponseField>
        <ResponseField name="blocked_by" type="string">For blocked entries: scope = limited to other instances; permission = their role cannot view this resource type at all</ResponseField>

        <ResponseField name="level_options" type="object">
          Members: the levels the caller may set them to here

          <Expandable title="Permission Level Options object">
            <ResponseField name="can_set_none" type="boolean">Whether the caller may remove the member's level (level none)</ResponseField>
            <ResponseField name="settable_levels" type="array">Levels the caller may set this member to (excluding the current one)</ResponseField>
            <ResponseField name="blocked_reason" type="string">Why the current level cannot be lowered or removed: outranked = the member's level is not below the caller's; last\_manager = the member is the last one who can manage the resource; no\_permission = the caller cannot share this resource</ResponseField>
            <ResponseField name="current_level" type="string">The member's level set on this instance; omitted when none is set. One of: `read`, `write`, `manage`.</ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="member_count" type="integer">Access groups: number of members</ResponseField>
        <ResponseField name="permission_level" type="string">What the member can do on this instance, from every source combined. One of: `read`, `write`, `manage`.</ResponseField>
        <ResponseField name="role" type="string">Members: their role</ResponseField>
        <ResponseField name="scope_grant_count" type="integer">How many instances of this resource type are in the subject's access scope</ResponseField>
        <ResponseField name="scope_mode" type="string">Members: all = not limited by an access scope for this resource type; instances = limited to the instances in their scope</ResponseField>

        <ResponseField name="sources" type="array">
          How the subject reaches the instance

          <Expandable title="Resource Access Source object">
            <ResponseField name="type" type="string">role: the member's role reaches every instance. scope\_grant: the instance is in the subject's access scope. access\_group: an access group's instance list. parent: granted on the parent workspace. permission\_level: a permission level set on this instance.</ResponseField>
            <ResponseField name="access_group_id" type="string">For access\_group: the group</ResponseField>
            <ResponseField name="access_group_name" type="string">For access\_group: its name</ResponseField>
            <ResponseField name="actions" type="array">Actions this source allows; \["\*"] = all the subject's permissions allow</ResponseField>
            <ResponseField name="parent_id" type="string">For parent: the parent workspace id</ResponseField>
            <ResponseField name="permission_levels" type="array">For permission\_level: the levels held on this instance</ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="allowed_count" type="integer">Members who can access the instance</ResponseField>

    <ResponseField name="blocked" type="array">
      Members who cannot

      <Expandable title="Resource Access Entry object">
        <ResponseField name="name" type="string">Display name</ResponseField>
        <ResponseField name="subject_id" type="string">principal\_id, or access group id</ResponseField>
        <ResponseField name="subject_type" type="string">member or access\_group</ResponseField>
        <ResponseField name="actions" type="array">Actions the explicit sources allow</ResponseField>
        <ResponseField name="blocked_by" type="string">For blocked entries: scope = limited to other instances; permission = their role cannot view this resource type at all</ResponseField>

        <ResponseField name="level_options" type="object">
          Members: the levels the caller may set them to here

          <Expandable title="Permission Level Options object">
            <ResponseField name="can_set_none" type="boolean">Whether the caller may remove the member's level (level none)</ResponseField>
            <ResponseField name="settable_levels" type="array">Levels the caller may set this member to (excluding the current one)</ResponseField>
            <ResponseField name="blocked_reason" type="string">Why the current level cannot be lowered or removed: outranked = the member's level is not below the caller's; last\_manager = the member is the last one who can manage the resource; no\_permission = the caller cannot share this resource</ResponseField>
            <ResponseField name="current_level" type="string">The member's level set on this instance; omitted when none is set. One of: `read`, `write`, `manage`.</ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="member_count" type="integer">Access groups: number of members</ResponseField>
        <ResponseField name="permission_level" type="string">What the member can do on this instance, from every source combined. One of: `read`, `write`, `manage`.</ResponseField>
        <ResponseField name="role" type="string">Members: their role</ResponseField>
        <ResponseField name="scope_grant_count" type="integer">How many instances of this resource type are in the subject's access scope</ResponseField>
        <ResponseField name="scope_mode" type="string">Members: all = not limited by an access scope for this resource type; instances = limited to the instances in their scope</ResponseField>

        <ResponseField name="sources" type="array">
          How the subject reaches the instance

          <Expandable title="Resource Access Source object">
            <ResponseField name="type" type="string">role: the member's role reaches every instance. scope\_grant: the instance is in the subject's access scope. access\_group: an access group's instance list. parent: granted on the parent workspace. permission\_level: a permission level set on this instance.</ResponseField>
            <ResponseField name="access_group_id" type="string">For access\_group: the group</ResponseField>
            <ResponseField name="access_group_name" type="string">For access\_group: its name</ResponseField>
            <ResponseField name="actions" type="array">Actions this source allows; \["\*"] = all the subject's permissions allow</ResponseField>
            <ResponseField name="parent_id" type="string">For parent: the parent workspace id</ResponseField>
            <ResponseField name="permission_levels" type="array">For permission\_level: the levels held on this instance</ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="grantable_levels" type="array">Permission levels the caller may set on this instance; empty when the caller cannot share it</ResponseField>
    <ResponseField name="instance_id" type="string">Instance id; \<workspace\_id>/\<id> for workspace actors and agents</ResponseField>
    <ResponseField name="resource_type" type="string">Resource type</ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json Success (200) theme={null}
  {
    "success": true,
    "message": "Operation completed successfully",
    "data": {
      "allowed": [
        {
          "name": "Example name",
          "subject_id": "e9225468996bae25743a2b64eeb19cc7",
          "subject_type": "member",
          "actions": [
            "example"
          ],
          "blocked_by": "scope",
          "level_options": {
            "can_set_none": true,
            "settable_levels": [
              "example"
            ],
            "blocked_reason": "outranked",
            "current_level": "read"
          },
          "member_count": 1,
          "permission_level": "read",
          "role": "tenant_member",
          "scope_grant_count": 1,
          "scope_mode": "all",
          "sources": [
            {
              "type": "role",
              "access_group_id": "21b69c2e4fc3734ad8c25bf8b5224366",
              "access_group_name": "Example access group",
              "actions": [],
              "parent_id": "ba8581988563142580f3237fbf400514",
              "permission_levels": []
            }
          ]
        }
      ],
      "allowed_count": 1,
      "blocked": [
        {
          "name": "Example name",
          "subject_id": "e9225468996bae25743a2b64eeb19cc7",
          "subject_type": "member",
          "actions": [
            "example"
          ],
          "blocked_by": "scope",
          "level_options": {
            "can_set_none": true,
            "settable_levels": [
              "example"
            ],
            "blocked_reason": "outranked",
            "current_level": "read"
          },
          "member_count": 1,
          "permission_level": "read",
          "role": "tenant_member",
          "scope_grant_count": 1,
          "scope_mode": "all",
          "sources": [
            {
              "type": "role",
              "access_group_id": "21b69c2e4fc3734ad8c25bf8b5224366",
              "access_group_name": "Example access group",
              "actions": [],
              "parent_id": "ba8581988563142580f3237fbf400514",
              "permission_levels": []
            }
          ]
        }
      ],
      "grantable_levels": [
        "example"
      ],
      "instance_id": "a88bb6c846106e751d8cf36bdeb592fe",
      "resource_type": "example"
    }
  }
  ```
</ResponseExample>

### Errors

Errors answer with `success: false`, a `message` and an `error_code`. See [Error Codes](/features/memorylake/api-reference/errors) for every code.

| Status | Meaning |
| - | - |
| `401` | The API key is missing, invalid, disabled or expired |
| `403` | The key is not allowed to do this |
| `404` | The resource does not exist |
| `429` | Too many requests. Wait for the time in `Retry-After` |
| `500` | Server-side error |
| `503` | Temporarily unavailable. Retry later |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.