---
meta:
  title: "Python SDK"
  parentTitle: "API Reference"
  description: "API Reference for the Liveblocks Python package"
alwaysShowAllNavigationLevels: false
---

The Python SDK for Liveblocks provides you with a client for accessing Liveblocks APIs. This library is only intended for use in your Python back end.

## Installation

Install the Liveblocks package to get started.

```bash
pip install liveblocks
```

## Quickstart

All API calls require a Liveblocks client configured with your secret key, found in the [Liveblocks Dashboard](https://liveblocks.io/dashboard/apikeys). Methods can be called synchronously or asynchronously.

```python title="Synchronous"
from liveblocks import Liveblocks

client = Liveblocks(secret="{{SECRET_KEY}}")

with client:
    rooms = client.get_rooms()
    print(rooms)
```

```python title="Asynchronous"
from liveblocks import AsyncLiveblocks

client = AsyncLiveblocks(secret="{{SECRET_KEY}}")

async with client:
    rooms = await client.get_rooms()
    print(rooms)
```

## Room

### get_rooms

This endpoint returns a list of your rooms. The rooms are returned sorted by creation date, from newest to oldest. You can filter rooms by room ID prefixes, metadata, users accesses, and groups accesses. Corresponds to [`liveblocks.getRooms`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms).

There is a pagination system where the cursor to the next page is returned in the response as `nextCursor`, which can be combined with `startingAfter`.
You can also limit the number of rooms by query.

Filtering by metadata works by giving key values like `metadata.color=red`. Of course you can combine multiple metadata clauses to refine the response like `metadata.color=red&metadata.type=text`. Notice here the operator AND is applied between each clauses.

Filtering by groups or userId works by giving a list of groups like `groupIds=marketing,GZo7tQ,product` or/and a userId like `userId=user1`.
Notice here the operator OR is applied between each `groupIds` and the `userId`.


```python
result = client.get_rooms(
    # limit=20,
    # starting_after="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",
    # organization_id="org_123456789",
    # query="metadata[\"color\"]:\"blue\"",
    # user_id="user-123",
    # group_ids="group1,group2",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="limit"
    type="int | Unset"
  >
    A limit on the number of rooms to be returned. The limit can range between 1 and 100, and defaults to 20. *(default: `20`)*
  </PropertiesListItem>
  <PropertiesListItem
    name="starting_after"
    type="str | Unset"
  >
    A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
  </PropertiesListItem>
  <PropertiesListItem
    name="organization_id"
    type="str | Unset"
  >
    A filter on organization ID.
  </PropertiesListItem>
  <PropertiesListItem
    name="query"
    type="str | Unset"
  >
    Query to filter rooms. You can filter by `roomId` and `metadata`, for example, `metadata["roomType"]:"whiteboard" AND roomId^"liveblocks:engineering"`. Learn more about [filtering rooms with query language](https://liveblocks.io/docs/guides/how-to-filter-rooms-using-query-language).
  </PropertiesListItem>
  <PropertiesListItem
    name="user_id"
    type="str | Unset"
  >
    A filter on users accesses.
  </PropertiesListItem>
  <PropertiesListItem
    name="group_ids"
    type="str | Unset"
  >
    A filter on groups accesses. Multiple groups can be used.
  </PropertiesListItem>
</PropertiesList>


### create_room

This endpoint creates a new room. `id` and `defaultAccesses` are required. When provided with a `?idempotent` query argument, will not return a 409 when the room already exists, but instead return the existing room as-is. Corresponds to [`liveblocks.createRoom`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms), or to [`liveblocks.getOrCreateRoom`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-or-create-rooms-roomId) when `?idempotent` is provided. 
- `defaultAccesses` could be `[]` or `["room:write"]` (private or public). 
- `metadata` could be key/value as `string` or `string[]`. `metadata` supports maximum 50 entries. Key length has a limit of 40 characters maximum. Value length has a limit of 256 characters maximum. `metadata` is optional field.
- `usersAccesses` could be `[]` or `["room:write"]` for every records. `usersAccesses` can contain 1000 ids maximum. Id length has a limit of 256 characters. `usersAccesses` is optional field.
- `groupsAccesses` are optional fields.


```python
from liveblocks.models import CreateRoomRequestBody

result = client.create_room(
    body=CreateRoomRequestBody(
        id="...",
        default_accesses=[],
        # organization_id="...",
        # users_accesses=...,
        # groups_accesses=...,
    ),
    # idempotent=True,
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="idempotent"
    type="bool | Unset"
  >
    When provided, will not return a 409 when the room already exists, but instead return the existing room as-is. Corresponds to [`liveblocks.getOrCreateRoom`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-or-create-rooms-roomId).
  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="CreateRoomRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### get_room

This endpoint returns a room by its ID. Corresponds to [`liveblocks.getRoom`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomid).

```python
result = client.get_room(
    room_id="my-room-id",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
</PropertiesList>


### update_room

This endpoint updates specific properties of a room. Corresponds to [`liveblocks.updateRoom`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomid). 

It’s not necessary to provide the entire room’s information. 
Setting a property to `null` means to delete this property. For example, if you want to remove access to a specific user without losing other users: 
``{
    "usersAccesses": {
        "john": null
    }
}``
`defaultAccesses`, `metadata`, `usersAccesses`, `groupsAccesses` can be updated.

- `defaultAccesses` could be `[]` or `["room:write"]` (private or public). 
- `metadata` could be key/value as `string` or `string[]`. `metadata` supports maximum 50 entries. Key length has a limit of 40 characters maximum. Value length has a limit of 256 characters maximum. `metadata` is optional field.
- `usersAccesses` could be `[]` or `["room:write"]` for every records. `usersAccesses` can contain 1000 ids maximum. Id length has a limit of 256 characters. `usersAccesses` is optional field.
- `groupsAccesses` could be `[]` or `["room:write"]` for every records. `groupsAccesses` can contain 1000 ids maximum. Id length has a limit of 256 characters. `groupsAccesses` is optional field.

```python
from liveblocks.models import UpdateRoomRequestBody

result = client.update_room(
    room_id="my-room-id",
    body=UpdateRoomRequestBody(
        # default_accesses=[],
        # users_accesses=...,
        # groups_accesses=...,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="UpdateRoomRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### delete_room

This endpoint deletes a room. A deleted room is no longer accessible from the API or the dashboard and it cannot be restored. Corresponds to [`liveblocks.deleteRoom`](https://liveblocks.io/docs/api-reference/liveblocks-node#delete-rooms-roomid).

```python
client.delete_room(
    room_id="my-room-id",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
</PropertiesList>


### prewarm_room

Speeds up connecting to a room for the next 10 seconds. Use this when you know a user will be connecting to a room with [`RoomProvider`](https://liveblocks.io/docs/api-reference/liveblocks-react#RoomProvider) or [`enterRoom`](https://liveblocks.io/docs/api-reference/liveblocks-client#Client.enterRoom) within 10 seconds, and the room will load quicker. Corresponds to [`liveblocks.prewarmRoom`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomid-prewarm).

```python
client.prewarm_room(
    room_id="my-room-id",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
</PropertiesList>


### upsert_room

This endpoint updates specific properties of a room. Corresponds to [`liveblocks.upsertRoom`](https://liveblocks.io/docs/api-reference/liveblocks-node#upsert-rooms-roomId). 

It’s not necessary to provide the entire room’s information. 
Setting a property to `null` means to delete this property. For example, if you want to remove access to a specific user without losing other users: 
``{
    "usersAccesses": {
        "john": null
    }
}``
`defaultAccesses`, `metadata`, `usersAccesses`, `groupsAccesses` can be updated.

- `defaultAccesses` could be `[]` or `["room:write"]` (private or public). 
- `metadata` could be key/value as `string` or `string[]`. `metadata` supports maximum 50 entries. Key length has a limit of 40 characters maximum. Value length has a limit of 256 characters maximum. `metadata` is optional field.
- `usersAccesses` could be `[]` or `["room:write"]` for every records. `usersAccesses` can contain 1000 ids maximum. Id length has a limit of 256 characters. `usersAccesses` is optional field.
- `groupsAccesses` could be `[]` or `["room:write"]` for every records. `groupsAccesses` can contain 1000 ids maximum. Id length has a limit of 256 characters. `groupsAccesses` is optional field.

```python
from liveblocks.models import UpsertRoomRequestBody

result = client.upsert_room(
    room_id="my-room-id",
    body=UpsertRoomRequestBody(
        update=...,
        # create=...,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="UpsertRoomRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### update_room_id

This endpoint permanently updates the room’s ID. All existing references to the old room ID will need to be updated. Returns the updated room. Corresponds to [`liveblocks.updateRoomId`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomid-update-room-id).

```python
from liveblocks.models import UpdateRoomIdRequestBody

result = client.update_room_id(
    room_id="my-room-id",
    body=UpdateRoomIdRequestBody(
        new_room_id="...",
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    The new ID for the room

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="UpdateRoomIdRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### update_room_organization_id

This endpoint updates the room's organization ID. The `fromOrganizationId` must match the room's current organization ID. Returns the updated room.

```python
from liveblocks.models import UpdateRoomOrganizationIdRequestBody

result = client.update_room_organization_id(
    room_id="my-room-id",
    body=UpdateRoomOrganizationIdRequestBody(
        from_organization_id="...",
        to_organization_id="...",
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    The ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="UpdateRoomOrganizationIdRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### get_active_users

This endpoint returns a list of users currently present in the requested room. Corresponds to [`liveblocks.getActiveUsers`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomid-active-users). 

For optimal performance, we recommend calling this endpoint no more than once every 10 seconds. 
Duplicates can occur if a user is in the requested room with multiple browser tabs opened.

```python
result = client.get_active_users(
    room_id="my-room-id",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
</PropertiesList>


### set_presence

This endpoint sets ephemeral presence for a user in a room without requiring a WebSocket connection. The presence data will automatically expire after the specified TTL (time-to-live). This is useful for scenarios like showing an AI agent's presence in a room. The presence will be broadcast to all connected users in the room. Corresponds to [`liveblocks.setPresence`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-presence).

```python
from liveblocks.models import SetPresenceRequestBody

client.set_presence(
    room_id="my-room-id",
    body=SetPresenceRequestBody(
        user_id="...",
        data=...,
        user_info=...,
        # ttl=0,
    ),
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="SetPresenceRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### broadcast_event

This endpoint enables the broadcast of an event to a room without having to connect to it via the `client` from `@liveblocks/client`. It takes any valid JSON as a request body. The `connectionId` passed to event listeners is `-1` when using this API. Corresponds to [`liveblocks.broadcastEvent`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-broadcast-event).

```python
client.broadcast_event(
    room_id="my-room-id",
    body=...,
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="Any"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


## Storage

### get_storage_document

Returns the contents of the room’s Storage tree. Corresponds to [`liveblocks.getStorageDocument`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomId-storage). 

The default outputted format is called “plain LSON”, which includes information on the Live data structures in the tree. These nodes show up in the output as objects with two properties, for example:

```json
{
  "liveblocksType": "LiveObject",
  "data": ...
}
```

If you’re not interested in this information, you can use the simpler `?format=json` query param, see below.

```python
result = client.get_storage_document(
    room_id="my-room-id",
    # format_=...,
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="format_"
    type="GetStorageDocumentFormat | Unset"
  >
    Use the `json` format to output a simplified JSON representation of the Storage tree. In that format, each LiveObject and LiveMap will be formatted as a simple JSON object, and each LiveList will be formatted as a simple JSON array. This is a lossy format because information about the original data structures is not retained, but it may be easier to work with.
  </PropertiesListItem>
</PropertiesList>


### initialize_storage_document

This endpoint initializes or reinitializes a room’s Storage. The room must already exist. Calling this endpoint will disconnect all users from the room if there are any, triggering a reconnect. Corresponds to [`liveblocks.initializeStorageDocument`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-storage).

The format of the request body is the same as what’s returned by the get Storage endpoint.

For each Liveblocks data structure that you want to create, you need a JSON element having two properties:
- `"liveblocksType"` => `"LiveObject" | "LiveList" | "LiveMap"`
- `"data"` => contains the nested data structures (children) and data.

The root’s type can only be LiveObject.

A utility function, `toPlainLson` is included in `@liveblocks/client` from `1.0.9` to help convert `LiveObject`, `LiveList`, and `LiveMap` to the structure expected by the endpoint.

```python
from liveblocks.models import InitializeStorageDocumentBody

result = client.initialize_storage_document(
    room_id="my-room-id",
    body=InitializeStorageDocumentBody(
        liveblocks_type=...,
        data=...,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="InitializeStorageDocumentBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### delete_storage_document

This endpoint deletes all of the room’s Storage data. Calling this endpoint will disconnect all users from the room if there are any. Corresponds to [`liveblocks.deleteStorageDocument`](https://liveblocks.io/docs/api-reference/liveblocks-node#delete-rooms-roomId-storage).


```python
client.delete_storage_document(
    room_id="my-room-id",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
</PropertiesList>


### patch_storage_document

Applies a sequence of [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) operations to the room's Storage document, useful for modifying Storage. Operations are applied in order; if any operation fails, the document is not changed and a 422 response with a helpful message is returned.

**Paths and data types:** Be as specific as possible with your target path. Every parent in the chain of path segments must be a LiveObject, LiveList, or LiveMap. Complex nested objects passed in `add` or `replace` operations are automatically converted to LiveObjects and LiveLists.

**Performance:** For large Storage documents, applying a patch can be expensive because the full state is reconstructed on the server to apply the operations. Very large documents may not be suitable for this endpoint.

For a **full guide with examples**, see [Modifying storage via REST API with JSON Patch](https://liveblocks.io/docs/guides/modifying-storage-via-rest-api-with-json-patch).

```python
client.patch_storage_document(
    room_id="my-room-id",
    body=...,
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="list[AddJsonPatchOperation | CopyJsonPatchOperation | MoveJsonPatchOperation | RemoveJsonPatchOperation | ReplaceJsonPatchOperation | TestJsonPatchOperation]"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


## Yjs

### get_yjs_document

This endpoint returns a JSON representation of the room’s Yjs document. Corresponds to [`liveblocks.getYjsDocument`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomId-ydoc).

```python
result = client.get_yjs_document(
    room_id="my-room-id",
    # formatting=True,
    # key="root",
    # type_=...,
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="formatting"
    type="bool | Unset"
  >
    If present, YText will return formatting.
  </PropertiesListItem>
  <PropertiesListItem
    name="key"
    type="str | Unset"
  >
    Returns only a single key’s value, e.g. `doc.get(key).toJSON()`.
  </PropertiesListItem>
  <PropertiesListItem
    name="type_"
    type="GetYjsDocumentType | Unset"
  >
    Used with key to override the inferred type, i.e. `"ymap"` will return `doc.get(key, Y.Map)`.
  </PropertiesListItem>
</PropertiesList>


### send_yjs_binary_update

This endpoint is used to send a Yjs binary update to the room’s Yjs document. You can use this endpoint to initialize Yjs data for the room or to update the room’s Yjs document. To send an update to a subdocument instead of the main document, pass its `guid`. Corresponds to [`liveblocks.sendYjsBinaryUpdate`](https://liveblocks.io/docs/api-reference/liveblocks-node#put-rooms-roomId-ydoc).

The update is typically obtained by calling `Y.encodeStateAsUpdate(doc)`. See the [Yjs documentation](https://docs.yjs.dev/api/document-updates) for more details. When manually making this HTTP call, set the HTTP header `Content-Type` to `application/octet-stream`, and send the binary update (a `Uint8Array`) in the body of the HTTP request. This endpoint does not accept JSON, unlike most other endpoints.

```python
client.send_yjs_binary_update(
    room_id="my-room-id",
    body=...,
    # guid="subdoc-guid-123",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="guid"
    type="str | Unset"
  >
    ID of the subdocument
  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="File"
  >
    Request body (application/octet-stream).

  </PropertiesListItem>
</PropertiesList>


### get_yjs_document_as_binary_update

This endpoint returns the room's Yjs document encoded as a single binary update. This can be used by `Y.applyUpdate(responseBody)` to get a copy of the document in your back end. See [Yjs documentation](https://docs.yjs.dev/api/document-updates) for more information on working with updates. To return a subdocument instead of the main document, pass its `guid`. Corresponds to [`liveblocks.getYjsDocumentAsBinaryUpdate`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomId-ydoc-binary).

```python
result = client.get_yjs_document_as_binary_update(
    room_id="my-room-id",
    # guid="subdoc-guid-123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="guid"
    type="str | Unset"
  >
    ID of the subdocument
  </PropertiesListItem>
</PropertiesList>


### get_yjs_versions

This endpoint returns a list of version history snapshots for the room's Yjs document. The versions are returned sorted by creation date, from newest to oldest.

```python
result = client.get_yjs_versions(
    room_id="my-room-id",
    # limit=20,
    # cursor="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="limit"
    type="int | Unset"
  >
    A limit on the number of versions to be returned. The limit can range between 1 and 100, and defaults to 20. *(default: `20`)*
  </PropertiesListItem>
  <PropertiesListItem
    name="cursor"
    type="str | Unset"
  >
    A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
  </PropertiesListItem>
</PropertiesList>


### get_yjs_version

This endpoint returns a specific version of the room's Yjs document encoded as a binary Yjs update.

```python
result = client.get_yjs_version(
    room_id="my-room-id",
    version_id="vh_abc123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="version_id"
    type="str"
  >
    ID of the version

  </PropertiesListItem>
</PropertiesList>


### create_yjs_version

This endpoint creates a new version history snapshot for the room's Yjs document.

```python
result = client.create_yjs_version(
    room_id="my-room-id",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
</PropertiesList>


## Comments

### get_threads

This endpoint returns the threads in the requested room. Corresponds to [`liveblocks.getThreads`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomId-threads).

```python
result = client.get_threads(
    room_id="my-room-id",
    # query="metadata[\"color\"]:\"blue\"",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="query"
    type="str | Unset"
  >
    Query to filter threads. You can filter by `metadata` and `resolved`, for example, `metadata["status"]:"open" AND metadata["color"]:"red" AND resolved:true`. Learn more about [filtering threads with query language](https://liveblocks.io/docs/guides/how-to-filter-threads-using-query-language).
  </PropertiesListItem>
</PropertiesList>


### create_thread

This endpoint creates a new thread and the first comment in the thread. Corresponds to [`liveblocks.createThread`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-threads).

A comment’s body is an array of paragraphs, each containing child nodes. Here’s an example of how to construct a comment’s body, which can be submitted under `comment.body`.

```json
{
  "version": 1,
  "content": [
    {
      "type": "paragraph",
      "children": [{ "text": "Hello " }, { "text": "world", "bold": true }]
    }
  ]
}
```

`metadata` supports maximum 50 entries. Key length has a limit of 40 characters maximum. Value length has a limit of 4000 characters maximum for strings.

```python
from liveblocks.models import CreateThreadRequestBody

result = client.create_thread(
    room_id="my-room-id",
    body=CreateThreadRequestBody(
        comment=...,
        # metadata=...,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="CreateThreadRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### get_thread

This endpoint returns a thread by its ID. Corresponds to [`liveblocks.getThread`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomId-threads-threadId).

```python
result = client.get_thread(
    room_id="my-room-id",
    thread_id="th_abc123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
</PropertiesList>


### delete_thread

This endpoint deletes a thread by its ID. Corresponds to [`liveblocks.deleteThread`](https://liveblocks.io/docs/api-reference/liveblocks-node#delete-rooms-roomId-threads-threadId).

```python
client.delete_thread(
    room_id="my-room-id",
    thread_id="th_abc123",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
</PropertiesList>


### edit_thread_metadata

This endpoint edits the metadata of a thread. The metadata is a JSON object that can be used to store any information you want about the thread, in `string`, `number`, or `boolean` form. Set a property to `null` to remove it. Corresponds to [`liveblocks.editThreadMetadata`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-threads-threadId-metadata).

`metadata` supports maximum 50 entries. Key length has a limit of 40 characters maximum. Value length has a limit of 4000 characters maximum for strings.

```python
from liveblocks.models import EditThreadMetadataRequestBody

result = client.edit_thread_metadata(
    room_id="my-room-id",
    thread_id="th_abc123",
    body=EditThreadMetadataRequestBody(
        metadata=...,
        user_id="...",
        # updated_at=...,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="EditThreadMetadataRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### mark_thread_as_resolved

This endpoint marks a thread as resolved. The request body must include a `userId` to identify who resolved the thread. Returns the updated thread. Corresponds to [`liveblocks.markThreadAsResolved`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-threads-threadId-mark-as-resolved).

```python
from liveblocks.models import MarkThreadAsResolvedRequestBody

result = client.mark_thread_as_resolved(
    room_id="my-room-id",
    thread_id="th_abc123",
    body=MarkThreadAsResolvedRequestBody(
        user_id="...",
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="MarkThreadAsResolvedRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### mark_thread_as_unresolved

This endpoint marks a thread as unresolved. The request body must include a `userId` to identify who unresolved the thread. Returns the updated thread. Corresponds to [`liveblocks.markThreadAsUnresolved`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-threads-threadId-mark-as-unresolved).

```python
from liveblocks.models import MarkThreadAsUnresolvedRequestBody

result = client.mark_thread_as_unresolved(
    room_id="my-room-id",
    thread_id="th_abc123",
    body=MarkThreadAsUnresolvedRequestBody(
        user_id="...",
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="MarkThreadAsUnresolvedRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### subscribe_to_thread

This endpoint subscribes to a thread. Corresponds to [`liveblocks.subscribeToThread`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-threads-threadId-subscribe).

```python
from liveblocks.models import SubscribeToThreadRequestBody

result = client.subscribe_to_thread(
    room_id="my-room-id",
    thread_id="th_abc123",
    body=SubscribeToThreadRequestBody(
        user_id="...",
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="SubscribeToThreadRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### unsubscribe_from_thread

This endpoint unsubscribes from a thread. Corresponds to [`liveblocks.unsubscribeFromThread`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-threads-threadId-unsubscribe).

```python
from liveblocks.models import UnsubscribeFromThreadRequestBody

client.unsubscribe_from_thread(
    room_id="my-room-id",
    thread_id="th_abc123",
    body=UnsubscribeFromThreadRequestBody(
        user_id="...",
    ),
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="UnsubscribeFromThreadRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### get_thread_subscriptions

This endpoint gets the list of subscriptions to a thread. Corresponds to [`liveblocks.getThreadSubscriptions`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomId-threads-threadId-subscriptions).

```python
result = client.get_thread_subscriptions(
    room_id="my-room-id",
    thread_id="th_abc123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
</PropertiesList>


### create_comment

This endpoint creates a new comment, adding it as a reply to a thread. Corresponds to [`liveblocks.createComment`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-threads-threadId-comments).

A comment’s body is an array of paragraphs, each containing child nodes. Here’s an example of how to construct a comment’s body, which can be submitted under `body`.

```json
{
  "version": 1,
  "content": [
    {
      "type": "paragraph",
      "children": [{ "text": "Hello " }, { "text": "world", "bold": true }]
    }
  ]
}
```

`metadata` supports maximum 50 entries. Key length has a limit of 40 characters maximum. Value length has a limit of 4000 characters maximum for strings.

```python
from liveblocks.models import CreateCommentRequestBody

result = client.create_comment(
    room_id="my-room-id",
    thread_id="th_abc123",
    body=CreateCommentRequestBody(
        user_id="...",
        body=...,
        # created_at=...,
        # metadata=...,
        # attachment_ids=[],
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="CreateCommentRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### get_comment

This endpoint returns a comment by its ID. Corresponds to [`liveblocks.getComment`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomId-threads-threadId-comments-commentId).

```python
result = client.get_comment(
    room_id="my-room-id",
    thread_id="th_abc123",
    comment_id="cm_abc123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
  <PropertiesListItem
    name="comment_id"
    type="str"
  >
    ID of the comment

  </PropertiesListItem>
</PropertiesList>


### edit_comment

This endpoint edits the specified comment. Corresponds to [`liveblocks.editComment`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-threads-threadId-comments-commentId).

A comment’s body is an array of paragraphs, each containing child nodes. Here’s an example of how to construct a comment’s body, which can be submitted under `body`.

```json
{
  "version": 1,
  "content": [
    {
      "type": "paragraph",
      "children": [{ "text": "Hello " }, { "text": "world", "bold": true }]
    }
  ]
}
```

```python
from liveblocks.models import EditCommentRequestBody

result = client.edit_comment(
    room_id="my-room-id",
    thread_id="th_abc123",
    comment_id="cm_abc123",
    body=EditCommentRequestBody(
        body=...,
        # edited_at=...,
        # metadata=...,
        # attachment_ids=[],
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
  <PropertiesListItem
    name="comment_id"
    type="str"
  >
    ID of the comment

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="EditCommentRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### delete_comment

This endpoint deletes a comment. A deleted comment is no longer accessible from the API or the dashboard and it cannot be restored. Corresponds to [`liveblocks.deleteComment`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-threads-threadId-comments-commentId).

```python
client.delete_comment(
    room_id="my-room-id",
    thread_id="th_abc123",
    comment_id="cm_abc123",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
  <PropertiesListItem
    name="comment_id"
    type="str"
  >
    ID of the comment

  </PropertiesListItem>
</PropertiesList>


### add_comment_reaction

This endpoint adds a reaction to a comment. Corresponds to [`liveblocks.addCommentReaction`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-threads-threadId-comments-commentId-add-reaction).

```python
from liveblocks.models import AddCommentReactionRequestBody

result = client.add_comment_reaction(
    room_id="my-room-id",
    thread_id="th_abc123",
    comment_id="cm_abc123",
    body=AddCommentReactionRequestBody(
        user_id="...",
        emoji="...",
        # created_at=...,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
  <PropertiesListItem
    name="comment_id"
    type="str"
  >
    ID of the comment

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="AddCommentReactionRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### remove_comment_reaction

This endpoint removes a comment reaction. A deleted comment reaction is no longer accessible from the API or the dashboard and it cannot be restored. Corresponds to [`liveblocks.removeCommentReaction`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-threads-threadId-comments-commentId-add-reaction).

```python
from liveblocks.models import RemoveCommentReactionRequestBody

client.remove_comment_reaction(
    room_id="my-room-id",
    thread_id="th_abc123",
    comment_id="cm_abc123",
    body=RemoveCommentReactionRequestBody(
        user_id="...",
        emoji="...",
        # removed_at=...,
    ),
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
  <PropertiesListItem
    name="comment_id"
    type="str"
  >
    ID of the comment

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="RemoveCommentReactionRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### get_attachment

Gets an attachment's metadata and a presigned download URL. The URL expires after 1 hour.

```python
result = client.get_attachment(
    room_id="my-room-id",
    attachment_id="at_abc123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="attachment_id"
    type="str"
  >
    ID of the attachment

  </PropertiesListItem>
</PropertiesList>


### edit_comment_metadata

This endpoint edits the metadata of a comment. The metadata is a JSON object that can be used to store any information you want about the comment, in `string`, `number`, or `boolean` form. Set a property to `null` to remove it. Corresponds to [`liveblocks.editCommentMetadata`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-threads-threadId-comments-commentId-metadata).

`metadata` supports maximum 50 entries. Key length has a limit of 40 characters maximum. Value length has a limit of 4000 characters maximum for strings.

```python
from liveblocks.models import EditCommentMetadataRequestBody

result = client.edit_comment_metadata(
    room_id="my-room-id",
    thread_id="th_abc123",
    comment_id="cm_abc123",
    body=EditCommentMetadataRequestBody(
        metadata=...,
        user_id="...",
        # updated_at=...,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
  <PropertiesListItem
    name="comment_id"
    type="str"
  >
    ID of the comment

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="EditCommentMetadataRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### get_thread_inbox_notifications

This endpoint returns the inbox notifications associated with a specific thread. Because this endpoint is not user-scoped, each notification includes a `userId` field identifying which user the notification belongs to. Only thread-kind notifications are returned.

```python
result = client.get_thread_inbox_notifications(
    room_id="my-room-id",
    thread_id="th_abc123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="thread_id"
    type="str"
  >
    ID of the thread

  </PropertiesListItem>
</PropertiesList>


## Feeds

### get_feeds

This endpoint returns the feeds in the requested room. Corresponds to [`liveblocks.getFeeds`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomId-feeds).

```python
result = client.get_feeds(
    room_id="my-room-id",
    # cursor="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",
    # since=1660000988137,
    # limit=20,
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="cursor"
    type="str | Unset"
  >
    A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
  </PropertiesListItem>
  <PropertiesListItem
    name="since"
    type="int | Unset"
  >
    Only return feeds with `createdAt` greater than this Unix timestamp in milliseconds.
  </PropertiesListItem>
  <PropertiesListItem
    name="limit"
    type="int | Unset"
  >
    A limit on the number of feeds to be returned. The limit can range between 1 and 100, and defaults to 20. *(default: `20`)*
  </PropertiesListItem>
</PropertiesList>


### create_feed

This endpoint creates a new feed in a room. Corresponds to [`liveblocks.createFeed`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-feeds).

```python
from liveblocks.models import CreateFeedRequestBody

result = client.create_feed(
    room_id="my-room-id",
    body=CreateFeedRequestBody(
        feed_id="...",
        # metadata=...,
        # timestamp=0.0,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="CreateFeedRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### get_feed

This endpoint returns a feed by its ID. Corresponds to [`liveblocks.getFeed`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomId-feeds-feedId).

```python
result = client.get_feed(
    room_id="my-room-id",
    feed_id="fd_abc123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="feed_id"
    type="str"
  >
    ID of the feed

  </PropertiesListItem>
</PropertiesList>


### delete_feed

This endpoint deletes a feed. Corresponds to [`liveblocks.deleteFeed`](https://liveblocks.io/docs/api-reference/liveblocks-node#delete-rooms-roomId-feeds-feedId).

```python
client.delete_feed(
    room_id="my-room-id",
    feed_id="fd_abc123",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="feed_id"
    type="str"
  >
    ID of the feed

  </PropertiesListItem>
</PropertiesList>


### update_feed

This endpoint updates the metadata of a feed. Corresponds to [`liveblocks.updateFeed`](https://liveblocks.io/docs/api-reference/liveblocks-node#patch-rooms-roomId-feeds-feedId).

```python
from liveblocks.models import UpdateFeedRequestBody

result = client.update_feed(
    room_id="my-room-id",
    feed_id="fd_abc123",
    body=UpdateFeedRequestBody(
        metadata=...,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="feed_id"
    type="str"
  >
    ID of the feed

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="UpdateFeedRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### get_feed_messages

This endpoint returns the messages in a feed. Corresponds to [`liveblocks.getFeedMessages`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomId-feeds-feedId-messages).

```python
result = client.get_feed_messages(
    room_id="my-room-id",
    feed_id="fd_abc123",
    # cursor="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",
    # since=1660000988137,
    # limit=20,
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="feed_id"
    type="str"
  >
    ID of the feed

  </PropertiesListItem>
  <PropertiesListItem
    name="cursor"
    type="str | Unset"
  >
    A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
  </PropertiesListItem>
  <PropertiesListItem
    name="since"
    type="int | Unset"
  >
    Only return messages with `createdAt` greater than this Unix timestamp in milliseconds.
  </PropertiesListItem>
  <PropertiesListItem
    name="limit"
    type="int | Unset"
  >
    A limit on the number of messages to be returned. The limit can range between 1 and 100, and defaults to 20. *(default: `20`)*
  </PropertiesListItem>
</PropertiesList>


### create_feed_message

This endpoint creates a new message in a feed. Corresponds to [`liveblocks.createFeedMessage`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-feeds-feedId-messages).

```python
from liveblocks.models import CreateFeedMessageRequestBody

result = client.create_feed_message(
    room_id="my-room-id",
    feed_id="fd_abc123",
    body=CreateFeedMessageRequestBody(
        data=...,
        # id="...",
        # timestamp=0.0,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="feed_id"
    type="str"
  >
    ID of the feed

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="CreateFeedMessageRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### delete_feed_message

This endpoint deletes a feed message. Corresponds to [`liveblocks.deleteFeedMessage`](https://liveblocks.io/docs/api-reference/liveblocks-node#delete-rooms-roomId-feeds-feedId-messages-messageId).

```python
client.delete_feed_message(
    room_id="my-room-id",
    feed_id="fd_abc123",
    message_id="msg_xyz789",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="feed_id"
    type="str"
  >
    ID of the feed

  </PropertiesListItem>
  <PropertiesListItem
    name="message_id"
    type="str"
  >
    ID of the message

  </PropertiesListItem>
</PropertiesList>


### update_feed_message

This endpoint updates a feed message. Corresponds to [`liveblocks.updateFeedMessage`](https://liveblocks.io/docs/api-reference/liveblocks-node#patch-rooms-roomId-feeds-feedId-messages-messageId).

```python
from liveblocks.models import UpdateFeedMessageRequestBody

result = client.update_feed_message(
    room_id="my-room-id",
    feed_id="fd_abc123",
    message_id="msg_xyz789",
    body=UpdateFeedMessageRequestBody(
        data=...,
        # timestamp=0.0,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="feed_id"
    type="str"
  >
    ID of the feed

  </PropertiesListItem>
  <PropertiesListItem
    name="message_id"
    type="str"
  >
    ID of the message

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="UpdateFeedMessageRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


## Auth

### authorize_user

This endpoint lets your application server (your back end) obtain a token that one of its clients (your frontend) can use to enter a Liveblocks room. You use this endpoint to implement your own application’s custom authentication endpoint. When making this request, you’ll have to use your secret key.

**Important:** The difference with an [ID token](#post-identify-user) is that an access token holds all the permissions, and is the source of truth. With ID tokens, permissions are set in the Liveblocks back end (through REST API calls) and "checked at the door" every time they are used to enter a room.

**Note:** When using the `@liveblocks/node` package, you can use [`Liveblocks.prepareSession`](https://liveblocks.io/docs/api-reference/liveblocks-node#access-tokens) in your back end to build this request.

You can pass the property `userId` in the request’s body. This can be whatever internal identifier you use for your user accounts as long as it uniquely identifies an account. The property `userId` is used by Liveblocks to calculate your account’s Monthly Active Users. One unique `userId` corresponds to one MAU.

Additionally, you can set custom metadata to the token, which will be publicly accessible by other clients through the `user.info` property. This is useful for storing static data like avatar images or the user’s display name.

Lastly, you’ll specify the exact permissions to give to the user using the `permissions` field. This is done in an object where the keys are room names, or room name patterns (ending in a `*`), and a list of permissions to assign the user for any room that matches that name exactly (or starts with the pattern’s prefix). For tips, see [Manage permissions with access tokens](https://liveblocks.io/docs/authentication/access-token).

```python
from liveblocks.models import AuthorizeUserRequestBody

result = client.authorize_user(
    body=AuthorizeUserRequestBody(
        user_id="...",
        permissions=...,
        # user_info=...,
        # organization_id="...",
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="body"
    type="AuthorizeUserRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### identify_user

This endpoint lets your application server (your back end) obtain a token that one of its clients (your frontend) can use to enter a Liveblocks room. You use this endpoint to implement your own application’s custom authentication endpoint. When using this endpoint to obtain ID tokens, you should manage your permissions by assigning user and/or group permissions to rooms explicitly, see our [Manage permissions with ID tokens](https://liveblocks.io/docs/authentication/id-token) section.

**Important:** The difference with an [access token](#post-authorize-user) is that an ID token doesn’t hold any permissions itself. With ID tokens, permissions are set in the Liveblocks back end (through REST API calls) and "checked at the door" every time they are used to enter a room. With access tokens, all permissions are set in the token itself, and thus controlled from your back end entirely.

**Note:** When using the `@liveblocks/node` package, you can use [`Liveblocks.identifyUser`](https://liveblocks.io/docs/api-reference/liveblocks-node) in your back end to build this request.

You can pass the property `userId` in the request’s body. This can be whatever internal identifier you use for your user accounts as long as it uniquely identifies an account. The property `userId` is used by Liveblocks to calculate your account’s Monthly Active Users. One unique `userId` corresponds to one MAU.

If you want to use group permissions, you can also declare which `groupIds` this user belongs to. The group ID values are yours, but they will have to match the group IDs you assign permissions to when assigning permissions to rooms, see [Manage permissions with ID tokens](https://liveblocks.io/docs/authentication/id-token)).

Additionally, you can set custom metadata to the token, which will be publicly accessible by other clients through the `user.info` property. This is useful for storing static data like avatar images or the user’s display name.

```python
from liveblocks.models import IdentifyUserRequestBody

result = client.identify_user(
    body=IdentifyUserRequestBody(
        user_id="...",
        # organization_id="...",
        # group_ids=[],
        # user_info=...,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="body"
    type="IdentifyUserRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


## Notifications

### get_inbox_notification

This endpoint returns a user’s inbox notification by its ID. Corresponds to [`liveblocks.getInboxNotification`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-users-userId-inboxNotifications-inboxNotificationId).

```python
result = client.get_inbox_notification(
    user_id="user-123",
    inbox_notification_id="in_abc123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="user_id"
    type="str"
  >
    ID of the user

  </PropertiesListItem>
  <PropertiesListItem
    name="inbox_notification_id"
    type="str"
  >
    ID of the inbox notification

  </PropertiesListItem>
</PropertiesList>


### delete_inbox_notification

This endpoint deletes a user’s inbox notification by its ID. Corresponds to [`liveblocks.deleteInboxNotification`](https://liveblocks.io/docs/api-reference/liveblocks-node#delete-users-userId-inbox-notifications-inboxNotificationId).

```python
client.delete_inbox_notification(
    user_id="user-123",
    inbox_notification_id="in_abc123",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="user_id"
    type="str"
  >
    ID of the user

  </PropertiesListItem>
  <PropertiesListItem
    name="inbox_notification_id"
    type="str"
  >
    ID of the inbox notification

  </PropertiesListItem>
</PropertiesList>


### get_inbox_notifications

This endpoint returns all the user’s inbox notifications. Corresponds to [`liveblocks.getInboxNotifications`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-users-userId-inboxNotifications).

```python
result = client.get_inbox_notifications(
    user_id="user-123",
    # organization_id="org_123456789",
    # query="metadata[\"color\"]:\"blue\"",
    # limit=20,
    # starting_after="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="user_id"
    type="str"
  >
    ID of the user

  </PropertiesListItem>
  <PropertiesListItem
    name="organization_id"
    type="str | Unset"
  >
    The organization ID to filter notifications for.
  </PropertiesListItem>
  <PropertiesListItem
    name="query"
    type="str | Unset"
  >
    Query to filter notifications. You can filter by `unread`, for example, `unread:true`.
  </PropertiesListItem>
  <PropertiesListItem
    name="limit"
    type="int | Unset"
  >
    A limit on the number of inbox notifications to be returned. The limit can range between 1 and 50, and defaults to 50. *(default: `50`)*
  </PropertiesListItem>
  <PropertiesListItem
    name="starting_after"
    type="str | Unset"
  >
    A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
  </PropertiesListItem>
</PropertiesList>


### delete_all_inbox_notifications

This endpoint deletes all the user’s inbox notifications. Corresponds to [`liveblocks.deleteAllInboxNotifications`](https://liveblocks.io/docs/api-reference/liveblocks-node#delete-users-userId-inbox-notifications).

```python
client.delete_all_inbox_notifications(
    user_id="user-123",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="user_id"
    type="str"
  >
    ID of the user

  </PropertiesListItem>
</PropertiesList>


### get_notification_settings

This endpoint returns a user's notification settings for the project. Corresponds to [`liveblocks.getNotificationSettings`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-users-userId-notification-settings).

```python
result = client.get_notification_settings(
    user_id="user-123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="user_id"
    type="str"
  >
    ID of the user

  </PropertiesListItem>
</PropertiesList>


### update_notification_settings

This endpoint updates a user's notification settings for the project. Corresponds to [`liveblocks.updateNotificationSettings`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-users-userId-notification-settings).

```python
from liveblocks.models import UpdateNotificationSettingsRequestBody

result = client.update_notification_settings(
    user_id="user-123",
    body=UpdateNotificationSettingsRequestBody(
        # email=...,
        # slack=...,
        # teams=...,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="user_id"
    type="str"
  >
    ID of the user

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="UpdateNotificationSettingsRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### delete_notification_settings

This endpoint deletes a user's notification settings for the project. Corresponds to [`liveblocks.deleteNotificationSettings`](https://liveblocks.io/docs/api-reference/liveblocks-node#delete-users-userId-notification-settings).

```python
client.delete_notification_settings(
    user_id="user-123",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="user_id"
    type="str"
  >
    ID of the user

  </PropertiesListItem>
</PropertiesList>


### get_room_subscription_settings

This endpoint returns a user’s subscription settings for a specific room. Corresponds to [`liveblocks.getRoomSubscriptionSettings`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-rooms-roomId-users-userId-subscription-settings).

```python
result = client.get_room_subscription_settings(
    room_id="my-room-id",
    user_id="user-123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="user_id"
    type="str"
  >
    ID of the user

  </PropertiesListItem>
</PropertiesList>


### update_room_subscription_settings

This endpoint updates a user’s subscription settings for a specific room. Corresponds to [`liveblocks.updateRoomSubscriptionSettings`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-rooms-roomId-users-userId-subscription-settings).

```python
from liveblocks.models import UpdateRoomSubscriptionSettingsRequestBody

result = client.update_room_subscription_settings(
    room_id="my-room-id",
    user_id="user-123",
    body=UpdateRoomSubscriptionSettingsRequestBody(
        # threads=...,
        # text_mentions=...,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="user_id"
    type="str"
  >
    ID of the user

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="UpdateRoomSubscriptionSettingsRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### delete_room_subscription_settings

This endpoint deletes a user’s subscription settings for a specific room. Corresponds to [`liveblocks.deleteRoomSubscriptionSettings`](https://liveblocks.io/docs/api-reference/liveblocks-node#delete-rooms-roomId-users-userId-subscription-settings).

```python
client.delete_room_subscription_settings(
    room_id="my-room-id",
    user_id="user-123",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="room_id"
    type="str"
  >
    ID of the room

  </PropertiesListItem>
  <PropertiesListItem
    name="user_id"
    type="str"
  >
    ID of the user

  </PropertiesListItem>
</PropertiesList>


### get_user_room_subscription_settings

This endpoint returns the list of a user's room subscription settings. Corresponds to [`liveblocks.getUserRoomSubscriptionSettings`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-users-userId-room-subscription-settings).

```python
result = client.get_user_room_subscription_settings(
    user_id="user-123",
    # starting_after="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",
    # limit=20,
    # organization_id="org_123456789",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="user_id"
    type="str"
  >
    ID of the user

  </PropertiesListItem>
  <PropertiesListItem
    name="starting_after"
    type="str | Unset"
  >
    A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
  </PropertiesListItem>
  <PropertiesListItem
    name="limit"
    type="int | Unset"
  >
    A limit on the number of elements to be returned. The limit can range between 1 and 50, and defaults to 50. *(default: `50`)*
  </PropertiesListItem>
  <PropertiesListItem
    name="organization_id"
    type="str | Unset"
  >
    The organization ID to filter room subscription settings for.
  </PropertiesListItem>
</PropertiesList>


### trigger_inbox_notification

This endpoint triggers an inbox notification. Corresponds to [`liveblocks.triggerInboxNotification`](https://liveblocks.io/docs/api-reference/liveblocks-node#post-inbox-notifications-trigger).

```python
from liveblocks.models import TriggerInboxNotificationRequestBody

client.trigger_inbox_notification(
    body=TriggerInboxNotificationRequestBody(
        user_id="...",
        kind="...",
        subject_id="...",
        activity_data=...,
        # room_id="...",
        # organization_id="...",
    ),
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="body"
    type="TriggerInboxNotificationRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### mark_inbox_notification_as_read

This endpoint marks a specific inbox notification as read.

```python
client.mark_inbox_notification_as_read(
    inbox_notification_id="in_abc123",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="inbox_notification_id"
    type="str"
  >
    ID of the inbox notification

  </PropertiesListItem>
</PropertiesList>


## Groups

### get_groups

This endpoint returns a list of all groups in your project. Corresponds to [`liveblocks.getGroups`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-groups).

```python
result = client.get_groups(
    # limit=20,
    # starting_after="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="limit"
    type="int | Unset"
  >
    A limit on the number of groups to be returned. The limit can range between 1 and 100, and defaults to 20. *(default: `20`)*
  </PropertiesListItem>
  <PropertiesListItem
    name="starting_after"
    type="str | Unset"
  >
    A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
  </PropertiesListItem>
</PropertiesList>


### create_group

This endpoint creates a new group. Corresponds to [`liveblocks.createGroup`](https://liveblocks.io/docs/api-reference/liveblocks-node#create-group).

```python
from liveblocks.models import CreateGroupRequestBody

result = client.create_group(
    body=CreateGroupRequestBody(
        id="...",
        # member_ids=[],
        # organization_id="...",
        # scopes=...,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="body"
    type="CreateGroupRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### get_group

This endpoint returns a specific group by ID. Corresponds to [`liveblocks.getGroup`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-group).

```python
result = client.get_group(
    group_id="engineering",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="group_id"
    type="str"
  >
    The ID of the group to retrieve.

  </PropertiesListItem>
</PropertiesList>


### delete_group

This endpoint deletes a group. Corresponds to [`liveblocks.deleteGroup`](https://liveblocks.io/docs/api-reference/liveblocks-node#delete-group).

```python
client.delete_group(
    group_id="engineering",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="group_id"
    type="str"
  >
    The ID of the group to delete.

  </PropertiesListItem>
</PropertiesList>


### add_group_members

This endpoint adds new members to an existing group. Corresponds to [`liveblocks.addGroupMembers`](https://liveblocks.io/docs/api-reference/liveblocks-node#add-group-members).

```python
from liveblocks.models import AddGroupMembersRequestBody

result = client.add_group_members(
    group_id="engineering",
    body=AddGroupMembersRequestBody(
        member_ids=[],
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="group_id"
    type="str"
  >
    The ID of the group to add members to.

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="AddGroupMembersRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### remove_group_members

This endpoint removes members from an existing group. Corresponds to [`liveblocks.removeGroupMembers`](https://liveblocks.io/docs/api-reference/liveblocks-node#remove-group-members).

```python
from liveblocks.models import RemoveGroupMembersRequestBody

result = client.remove_group_members(
    group_id="engineering",
    body=RemoveGroupMembersRequestBody(
        member_ids=[],
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="group_id"
    type="str"
  >
    The ID of the group to remove members from.

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="RemoveGroupMembersRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### get_user_groups

This endpoint returns all groups that a specific user is a member of. Corresponds to [`liveblocks.getUserGroups`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-user-groups).

```python
result = client.get_user_groups(
    user_id="user-123",
    # limit=20,
    # starting_after="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="user_id"
    type="str"
  >
    The ID of the user to get groups for.

  </PropertiesListItem>
  <PropertiesListItem
    name="limit"
    type="int | Unset"
  >
    A limit on the number of groups to be returned. The limit can range between 1 and 100, and defaults to 20. *(default: `20`)*
  </PropertiesListItem>
  <PropertiesListItem
    name="starting_after"
    type="str | Unset"
  >
    A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
  </PropertiesListItem>
</PropertiesList>


## Ai

### get_ai_copilots

This endpoint returns a paginated list of AI copilots. The copilots are returned sorted by creation date, from newest to oldest. Corresponds to [`liveblocks.getAiCopilots`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-ai-copilots).

```python
result = client.get_ai_copilots(
    # limit=20,
    # starting_after="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="limit"
    type="int | Unset"
  >
    A limit on the number of copilots to be returned. The limit can range between 1 and 100, and defaults to 20. *(default: `20`)*
  </PropertiesListItem>
  <PropertiesListItem
    name="starting_after"
    type="str | Unset"
  >
    A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
  </PropertiesListItem>
</PropertiesList>


### create_ai_copilot

This endpoint creates a new AI copilot with the given configuration. Corresponds to [`liveblocks.createAiCopilot`](https://liveblocks.io/docs/api-reference/liveblocks-node#create-ai-copilot).

```python
result = client.create_ai_copilot(
    body=...,
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="body"
    type="CreateAiCopilotOptionsAnthropic | CreateAiCopilotOptionsGoogle | CreateAiCopilotOptionsOpenAi | CreateAiCopilotOptionsOpenAiCompatible"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### get_ai_copilot

This endpoint returns an AI copilot by its ID. Corresponds to [`liveblocks.getAiCopilot`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-ai-copilot).

```python
result = client.get_ai_copilot(
    copilot_id="cp_abc123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="copilot_id"
    type="str"
  >
    ID of the AI copilot

  </PropertiesListItem>
</PropertiesList>


### update_ai_copilot

This endpoint updates an existing AI copilot's configuration. Corresponds to [`liveblocks.updateAiCopilot`](https://liveblocks.io/docs/api-reference/liveblocks-node#update-ai-copilot).

This endpoint returns a 422 response if the update doesn't apply due to validation failures. For example, if the existing copilot uses the "openai" provider and you attempt to update the provider model to an incompatible value for the provider, like "gemini-2.5-pro", you'll receive a 422 response with an error message explaining where the validation failed.

```python
from liveblocks.models import UpdateAiCopilotRequestBody

result = client.update_ai_copilot(
    copilot_id="cp_abc123",
    body=UpdateAiCopilotRequestBody(
        # name="...",
        # description="...",
        # system_prompt="...",
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="copilot_id"
    type="str"
  >
    ID of the AI copilot

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="UpdateAiCopilotRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### delete_ai_copilot

This endpoint deletes an AI copilot by its ID. A deleted copilot is no longer accessible and cannot be restored. Corresponds to [`liveblocks.deleteAiCopilot`](https://liveblocks.io/docs/api-reference/liveblocks-node#delete-ai-copilot).

```python
client.delete_ai_copilot(
    copilot_id="cp_abc123",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="copilot_id"
    type="str"
  >
    ID of the AI copilot

  </PropertiesListItem>
</PropertiesList>


### get_knowledge_sources

This endpoint returns a paginated list of knowledge sources for a specific AI copilot. Corresponds to [`liveblocks.getKnowledgeSources`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-knowledge-sources).

```python
result = client.get_knowledge_sources(
    copilot_id="cp_abc123",
    # limit=20,
    # starting_after="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="copilot_id"
    type="str"
  >
    ID of the AI copilot

  </PropertiesListItem>
  <PropertiesListItem
    name="limit"
    type="int | Unset"
  >
    A limit on the number of knowledge sources to be returned. The limit can range between 1 and 100, and defaults to 20. *(default: `20`)*
  </PropertiesListItem>
  <PropertiesListItem
    name="starting_after"
    type="str | Unset"
  >
    A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
  </PropertiesListItem>
</PropertiesList>


### get_knowledge_source

This endpoint returns a specific knowledge source by its ID. Corresponds to [`liveblocks.getKnowledgeSource`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-knowledge-source).

```python
result = client.get_knowledge_source(
    copilot_id="cp_abc123",
    knowledge_source_id="ks_abc123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="copilot_id"
    type="str"
  >
    ID of the AI copilot

  </PropertiesListItem>
  <PropertiesListItem
    name="knowledge_source_id"
    type="str"
  >
    ID of the knowledge source

  </PropertiesListItem>
</PropertiesList>


### create_web_knowledge_source

This endpoint creates a web knowledge source for an AI copilot. This allows the copilot to access and learn from web content. Corresponds to [`liveblocks.createWebKnowledgeSource`](https://liveblocks.io/docs/api-reference/liveblocks-node#create-web-knowledge-source).

```python
from liveblocks.models import CreateWebKnowledgeSourceRequestBody

result = client.create_web_knowledge_source(
    copilot_id="cp_abc123",
    body=CreateWebKnowledgeSourceRequestBody(
        copilot_id="...",
        url="...",
        type_=...,
    ),
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="copilot_id"
    type="str"
  >
    ID of the AI copilot

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="CreateWebKnowledgeSourceRequestBody"
  >
    Request body (application/json).

  </PropertiesListItem>
</PropertiesList>


### create_file_knowledge_source

This endpoint creates a file knowledge source for an AI copilot by uploading a file. The copilot can then reference the content of the file when responding. Corresponds to [`liveblocks.createFileKnowledgeSource`](https://liveblocks.io/docs/api-reference/liveblocks-node#create-file-knowledge-source).

```python
result = client.create_file_knowledge_source(
    copilot_id="cp_abc123",
    name="document.pdf",
    body=...,
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="copilot_id"
    type="str"
  >
    ID of the AI copilot

  </PropertiesListItem>
  <PropertiesListItem
    name="name"
    type="str"
  >
    Name of the file

  </PropertiesListItem>
  <PropertiesListItem
    name="body"
    type="File"
  >
    Request body (application/octet-stream).

  </PropertiesListItem>
</PropertiesList>


### get_file_knowledge_source_markdown

This endpoint returns the content of a file knowledge source as markdown. This allows you to see what content the AI copilot has access to from uploaded files. Corresponds to [`liveblocks.getFileKnowledgeSourceMarkdown`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-file-knowledge-source-markdown).

```python
result = client.get_file_knowledge_source_markdown(
    copilot_id="cp_abc123",
    knowledge_source_id="ks_abc123",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="copilot_id"
    type="str"
  >
    ID of the AI copilot

  </PropertiesListItem>
  <PropertiesListItem
    name="knowledge_source_id"
    type="str"
  >
    ID of the knowledge source

  </PropertiesListItem>
</PropertiesList>


### delete_file_knowledge_source

This endpoint deletes a file knowledge source from an AI copilot. The copilot will no longer have access to the content from this file. Corresponds to [`liveblocks.deleteFileKnowledgeSource`](https://liveblocks.io/docs/api-reference/liveblocks-node#delete-file-knowledge-source).

```python
client.delete_file_knowledge_source(
    copilot_id="cp_abc123",
    knowledge_source_id="ks_abc123",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="copilot_id"
    type="str"
  >
    ID of the AI copilot

  </PropertiesListItem>
  <PropertiesListItem
    name="knowledge_source_id"
    type="str"
  >
    ID of the knowledge source

  </PropertiesListItem>
</PropertiesList>


### delete_web_knowledge_source

This endpoint deletes a web knowledge source from an AI copilot. The copilot will no longer have access to the content from this source. Corresponds to [`liveblocks.deleteWebKnowledgeSource`](https://liveblocks.io/docs/api-reference/liveblocks-node#delete-web-knowledge-source).

```python
client.delete_web_knowledge_source(
    copilot_id="cp_abc123",
    knowledge_source_id="ks_abc123",
)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="copilot_id"
    type="str"
  >
    ID of the AI copilot

  </PropertiesListItem>
  <PropertiesListItem
    name="knowledge_source_id"
    type="str"
  >
    ID of the knowledge source

  </PropertiesListItem>
</PropertiesList>


### get_web_knowledge_source_links

This endpoint returns a paginated list of links that were indexed from a web knowledge source. This is useful for understanding what content the AI copilot has access to from web sources. Corresponds to [`liveblocks.getWebKnowledgeSourceLinks`](https://liveblocks.io/docs/api-reference/liveblocks-node#get-web-knowledge-source-links).

```python
result = client.get_web_knowledge_source_links(
    copilot_id="cp_abc123",
    knowledge_source_id="ks_abc123",
    # limit=20,
    # starting_after="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",
)
print(result)
```

<PropertiesList title="Parameters">
  <PropertiesListItem
    name="copilot_id"
    type="str"
  >
    ID of the AI copilot

  </PropertiesListItem>
  <PropertiesListItem
    name="knowledge_source_id"
    type="str"
  >
    ID of the knowledge source

  </PropertiesListItem>
  <PropertiesListItem
    name="limit"
    type="int | Unset"
  >
    A limit on the number of links to be returned. The limit can range between 1 and 100, and defaults to 20. *(default: `20`)*
  </PropertiesListItem>
  <PropertiesListItem
    name="starting_after"
    type="str | Unset"
  >
    A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
  </PropertiesListItem>
</PropertiesList>



## Error Handling

All API methods raise `errors.LiveblocksError` when the server returns a non-2xx status code. You can catch and inspect these errors:

```python
from liveblocks import errors, Liveblocks

client = Liveblocks(secret="sk_your_secret_key")

with client:
    try:
        room = client.get_room(room_id="my-room")
    except errors.LiveblocksError as e:
        print(f"API error: {e}")
```

Methods also raise `httpx.TimeoutException` if the request exceeds the timeout.
---

For an overview of all available documentation, see [/llms.txt](/llms.txt).
