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

# Permissions & Sharing

> Share collections with users, organizations, and the public

Control who can access your collections. Sharing requires admin permission on the collection.

## Check Permissions

```python theme={null}
from docent import Docent

client = Docent()

has_write = client.has_collection_permission("my-collection-id", "write")
print(f"Has write access: {has_write}")
```

### Parameters

<ParamField body="collection_id" type="str" required>
  ID of the collection.
</ParamField>

<ParamField body="permission" type="str" default="write">
  Permission level to check: `"read"`, `"write"`, or `"admin"`.
</ParamField>

***

## Share with the Public

```python theme={null}
# Make publicly readable
client.share_collection_with_public("my-collection-id", permission="read")

# Remove public access
client.unshare_collection_with_public("my-collection-id")
```

### Parameters

<ParamField body="collection_id" type="str" required>
  ID of the collection.
</ParamField>

<ParamField body="permission" type="Literal['read', 'write']" default="read">
  Public permission level.
</ParamField>

***

## Share with a User

### By Email

```python theme={null}
client.share_collection_with_email("my-collection-id", "alice@example.com")
```

### By User ID

```python theme={null}
# Grant read access
client.share_collection_with_user("my-collection-id", "user-456", permission="read")

# Grant write access
client.share_collection_with_user("my-collection-id", "user-456", permission="write")

# Remove access
client.unshare_collection_with_user("my-collection-id", "user-456")
```

### Parameters

<ParamField body="collection_id" type="str" required>
  ID of the collection.
</ParamField>

<ParamField body="user_id" type="str" required>
  ID of the user.
</ParamField>

<ParamField body="permission" type="Literal['read', 'write', 'admin']" default="read">
  Permission level.
</ParamField>

***

## Share with an Organization

```python theme={null}
client.share_collection_with_organization(
    "my-collection-id",
    "org-789",
    permission="read",
)

# Remove organization access
client.unshare_collection_with_organization("my-collection-id", "org-789")
```

### Parameters

<ParamField body="collection_id" type="str" required>
  ID of the collection.
</ParamField>

<ParamField body="organization_id" type="str" required>
  ID of the organization.
</ParamField>

<ParamField body="permission" type="Literal['read', 'write', 'admin']" default="read">
  Permission level.
</ParamField>

***

## Organizations

### List Your Organizations

```python theme={null}
orgs = client.get_my_organizations()
for org in orgs:
    print(f"{org['id']}: {org['name']}")
```

### List Organization Users

```python theme={null}
users = client.get_organization_users("org-789")
for user in users:
    print(f"{user['id']}: {user.get('email')}")
```

### List Collection Collaborators

```python theme={null}
collaborators = client.get_collection_collaborators("my-collection-id")
for c in collaborators:
    print(f"{c['subject_type']}/{c['subject_id']}: {c['permission_level']}")
```
