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

# permissioned

# `pdsx._internal.permissioned`

experimental permissioned-data helpers (`com.atproto.space.*`).

The permissioned-data proposal is still moving and most PDS implementations do
not serve the namespace at all. Everything here is built to degrade cleanly on
those hosts rather than surface a raw HTTP error, so callers can offer the
commands unconditionally.

Detection is necessarily authenticated: PDS implementations run auth middleware
before method dispatch, so an anonymous probe returns 401 on a host that
supports permissioned data and 401 on one that does not. The distinguishing
signal only appears once a request carries credentials.

Proposal: [https://github.com/bluesky-social/proposals/tree/main/0016-permissioned-data](https://github.com/bluesky-social/proposals/tree/main/0016-permissioned-data)

## Functions

### `access_jwt` <sup><a href="https://github.com/zzstoatzz/pdsx/blob/main/src/pdsx/_internal/permissioned.py#L57" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
access_jwt(client: AsyncClient) -> str
```

pull the session JWT off an authenticated client.

The token lives on `client._session`; `client.me` is a profile view and
has no `access_jwt`, so reading it from there fails *after* a successful
login and looks like missing credentials.

### `_is_unsupported` <sup><a href="https://github.com/zzstoatzz/pdsx/blob/main/src/pdsx/_internal/permissioned.py#L71" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
_is_unsupported(exc: httpx.HTTPStatusError) -> bool
```

does this response mean "this PDS doesn't do permissioned data"?

### `space_query` <sup><a href="https://github.com/zzstoatzz/pdsx/blob/main/src/pdsx/_internal/permissioned.py#L84" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
space_query(client: AsyncClient, nsid: str, pds_url: str, params: dict[str, Any] | None = None) -> dict[str, Any]
```

issue an authenticated permissioned-data query.

**Raises:**

* `NotAuthenticated`: if the client has no session
* `PermissionedDataUnsupported`: if the PDS does not serve the namespace

### `_describe_error` <sup><a href="https://github.com/zzstoatzz/pdsx/blob/main/src/pdsx/_internal/permissioned.py#L108" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
_describe_error(exc: httpx.HTTPStatusError) -> str
```

render an atproto error body as one readable line.

The raw httpx message is a URL dump with the actual reason buried in it.

### `supports_permissioned_data` <sup><a href="https://github.com/zzstoatzz/pdsx/blob/main/src/pdsx/_internal/permissioned.py#L122" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
supports_permissioned_data(client: AsyncClient, pds_url: str) -> bool
```

probe whether a PDS serves the permissioned-data namespace.

Uses listSpaces, which is read-only and scoped to the authenticated actor.

### `list_spaces` <sup><a href="https://github.com/zzstoatzz/pdsx/blob/main/src/pdsx/_internal/permissioned.py#L134" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
list_spaces(client: AsyncClient, pds_url: str) -> dict[str, Any]
```

list spaces the authenticated actor owns or holds a writer repo in.

Being named in a space's member list does not put it here — that is
management policy state, not actor-local space state.

### `list_space_records` <sup><a href="https://github.com/zzstoatzz/pdsx/blob/main/src/pdsx/_internal/permissioned.py#L158" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
list_space_records(client: AsyncClient, pds_url: str) -> dict[str, Any]
```

list records in a permissioned space.

Values are returned by default, per the proposal; pass exclude\_values to
get just collection/rkey/cid without materializing record JSON.

### `get_space_record` <sup><a href="https://github.com/zzstoatzz/pdsx/blob/main/src/pdsx/_internal/permissioned.py#L184" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
get_space_record(client: AsyncClient, pds_url: str) -> dict[str, Any]
```

get a single record from a permissioned space.

## Classes

### `PermissionedDataUnsupported` <sup><a href="https://github.com/zzstoatzz/pdsx/blob/main/src/pdsx/_internal/permissioned.py#L37" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

the target PDS does not serve `com.atproto.space.*`.

Either the implementation lacks permissioned data entirely or an operator
has disabled it. Both are reported the same way upstream.

### `NotAuthenticated` <sup><a href="https://github.com/zzstoatzz/pdsx/blob/main/src/pdsx/_internal/permissioned.py#L45" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

permissioned-data reads require an authenticated session.

### `SpaceQueryError` <sup><a href="https://github.com/zzstoatzz/pdsx/blob/main/src/pdsx/_internal/permissioned.py#L49" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

the PDS served the method and rejected the request.

Distinct from PermissionedDataUnsupported: the namespace works, this
particular call did not (missing space, missing record, no access).
