Sign in

API Reference - Python SDK

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.

$pip install liveblocks

Quickstart

All API calls require a Liveblocks client configured with your secret key, found in the Liveblocks Dashboard. Methods can be called synchronously or asynchronously.

Synchronous
from liveblocks import Liveblocks
client = Liveblocks(secret="")
with client: rooms = client.get_rooms() print(rooms)
Asynchronous
from liveblocks import AsyncLiveblocks
client = AsyncLiveblocks(secret="")
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.

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.

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)
Parameters
  • limitint | 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)

  • starting_afterstr | Unset

    A cursor used for pagination. Get the value from the nextCursor response of the previous page.

  • organization_idstr | Unset

    A filter on organization ID.

  • querystr | 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.

  • user_idstr | Unset

    A filter on users accesses.

  • group_idsstr | Unset

    A filter on groups accesses. Multiple groups can be used.

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, or to liveblocks.getOrCreateRoom 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.
from liveblocks.models import CreateRoomRequestBody
result = client.create_room( body=CreateRoomRequestBody( id="...", default_accesses=[], # organization_id="...", # users_accesses=..., # groups_accesses=..., ), # idempotent=True,)print(result)
Parameters
  • idempotentbool | 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.

  • bodyCreateRoomRequestBody

    Request body (application/json).

get_room

This endpoint returns a room by its ID. Corresponds to liveblocks.getRoom.

result = client.get_room(    room_id="my-room-id",)print(result)
Parameters
  • room_idstr

    ID of the room

update_room

This endpoint updates specific properties of a room. Corresponds to liveblocks.updateRoom.

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.
from liveblocks.models import UpdateRoomRequestBody
result = client.update_room( room_id="my-room-id", body=UpdateRoomRequestBody( # default_accesses=[], # users_accesses=..., # groups_accesses=..., ),)print(result)
Parameters
  • room_idstr

    ID of the room

  • bodyUpdateRoomRequestBody

    Request body (application/json).

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.

client.delete_room(    room_id="my-room-id",)
Parameters
  • room_idstr

    ID of the room

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 or enterRoom within 10 seconds, and the room will load quicker. Corresponds to liveblocks.prewarmRoom.

client.prewarm_room(    room_id="my-room-id",)
Parameters
  • room_idstr

    ID of the room

upsert_room

This endpoint updates specific properties of a room. Corresponds to liveblocks.upsertRoom.

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.
from liveblocks.models import UpsertRoomRequestBody
result = client.upsert_room( room_id="my-room-id", body=UpsertRoomRequestBody( update=..., # create=..., ),)print(result)
Parameters
  • room_idstr

    ID of the room

  • bodyUpsertRoomRequestBody

    Request body (application/json).

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.

result = client.update_room_id(    room_id="my-room-id",)print(result)
Parameters
  • room_idstr

    The new ID for the room

  • bodyUpdateRoomIdRequestBody | Unset

    Request body (application/json).

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.

result = client.update_room_organization_id(    room_id="my-room-id",)print(result)
Parameters
  • room_idstr

    The ID of the room

  • bodyUpdateRoomOrganizationIdRequestBody | Unset

    Request body (application/json).

get_active_users

This endpoint returns a list of users currently present in the requested room. Corresponds to liveblocks.getActiveUsers.

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.

result = client.get_active_users(    room_id="my-room-id",)print(result)
Parameters
  • room_idstr

    ID of the room

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.

from liveblocks.models import SetPresenceRequestBody
client.set_presence( room_id="my-room-id", body=SetPresenceRequestBody( user_id="...", data=..., # user_info=..., # ttl=0, ),)
Parameters
  • room_idstr

    ID of the room

  • bodySetPresenceRequestBody

    Request body (application/json).

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.

client.broadcast_event(    room_id="my-room-id",    body=...,)
Parameters
  • room_idstr

    ID of the room

  • bodyAny

    Request body (application/json).

Storage

get_storage_document

Returns the contents of the room’s Storage tree. Corresponds to liveblocks.getStorageDocument.

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:

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

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

result = client.get_storage_document(    room_id="my-room-id",    # format_=...,)print(result)
Parameters
  • room_idstr

    ID of the room

  • format_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.

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.

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.

result = client.initialize_storage_document(    room_id="my-room-id",)print(result)
Parameters
  • room_idstr

    ID of the room

  • bodyInitializeStorageDocumentBody | Unset

    Request body (application/json).

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.

client.delete_storage_document(    room_id="my-room-id",)
Parameters
  • room_idstr

    ID of the room

patch_storage_document

Applies a sequence of JSON Patch 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.

client.patch_storage_document(    room_id="my-room-id",    body=...,)
Parameters
  • room_idstr

    ID of the room

  • bodylist[AddJsonPatchOperation | CopyJsonPatchOperation | MoveJsonPatchOperation | RemoveJsonPatchOperation | ReplaceJsonPatchOperation | TestJsonPatchOperation]

    Request body (application/json).

Yjs

get_yjs_document

This endpoint returns a JSON representation of the room’s Yjs document. Corresponds to liveblocks.getYjsDocument.

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

    ID of the room

  • formattingbool | Unset

    If present, YText will return formatting.

  • keystr | Unset

    Returns only a single key’s value, e.g. doc.get(key).toJSON().

  • type_GetYjsDocumentType | Unset

    Used with key to override the inferred type, i.e. "ymap" will return doc.get(key, Y.Map).

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.

The update is typically obtained by calling Y.encodeStateAsUpdate(doc). See the Yjs documentation 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.

client.send_yjs_binary_update(    room_id="my-room-id",    body=...,    # guid="subdoc-guid-123",)
Parameters
  • room_idstr

    ID of the room

  • guidstr | Unset

    ID of the subdocument

  • bodyFile

    Request body (application/octet-stream).

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 for more information on working with updates. To return a subdocument instead of the main document, pass its guid. Corresponds to liveblocks.getYjsDocumentAsBinaryUpdate.

result = client.get_yjs_document_as_binary_update(    room_id="my-room-id",    # guid="subdoc-guid-123",)print(result)
Parameters
  • room_idstr

    ID of the room

  • guidstr | Unset

    ID of the subdocument

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.

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

    ID of the room

  • limitint | 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)

  • cursorstr | Unset

    A cursor used for pagination. Get the value from the nextCursor response of the previous page.

get_yjs_version

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

result = client.get_yjs_version(    room_id="my-room-id",    version_id="vh_abc123",)print(result)
Parameters
  • room_idstr

    ID of the room

  • version_idstr

    ID of the version

create_yjs_version

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

result = client.create_yjs_version(    room_id="my-room-id",)print(result)
Parameters
  • room_idstr

    ID of the room

Comments

get_threads

This endpoint returns the threads in the requested room. Corresponds to liveblocks.getThreads.

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

    ID of the room

  • querystr | 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.

create_thread

This endpoint creates a new thread and the first comment in the thread. Corresponds to liveblocks.createThread.

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.

{  "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.

from liveblocks.models import CreateThreadRequestBody
result = client.create_thread( room_id="my-room-id", body=CreateThreadRequestBody( comment=..., # metadata=..., ),)print(result)
Parameters
  • room_idstr

    ID of the room

  • bodyCreateThreadRequestBody

    Request body (application/json).

get_thread

This endpoint returns a thread by its ID. Corresponds to liveblocks.getThread.

result = client.get_thread(    room_id="my-room-id",    thread_id="th_abc123",)print(result)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

delete_thread

This endpoint deletes a thread by its ID. Corresponds to liveblocks.deleteThread.

client.delete_thread(    room_id="my-room-id",    thread_id="th_abc123",)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

get_thread_participants

Deprecated. Prefer using thread subscriptions instead.

This endpoint returns the list of thread participants. It is a list of unique user IDs representing all the thread comment authors and mentioned users in comments. Corresponds to liveblocks.getThreadParticipants.

result = client.get_thread_participants(    room_id="my-room-id",    thread_id="th_abc123",)print(result)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

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.

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.

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)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

  • bodyEditThreadMetadataRequestBody

    Request body (application/json).

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.

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)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

  • bodyMarkThreadAsResolvedRequestBody

    Request body (application/json).

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.

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)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

  • bodyMarkThreadAsUnresolvedRequestBody

    Request body (application/json).

subscribe_to_thread

This endpoint subscribes to a thread. Corresponds to liveblocks.subscribeToThread.

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)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

  • bodySubscribeToThreadRequestBody

    Request body (application/json).

unsubscribe_from_thread

This endpoint unsubscribes from a thread. Corresponds to liveblocks.unsubscribeFromThread.

from liveblocks.models import UnsubscribeFromThreadRequestBody
client.unsubscribe_from_thread( room_id="my-room-id", thread_id="th_abc123", body=UnsubscribeFromThreadRequestBody( user_id="...", ),)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

  • bodyUnsubscribeFromThreadRequestBody

    Request body (application/json).

get_thread_subscriptions

This endpoint gets the list of subscriptions to a thread. Corresponds to liveblocks.getThreadSubscriptions.

result = client.get_thread_subscriptions(    room_id="my-room-id",    thread_id="th_abc123",)print(result)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

create_comment

This endpoint creates a new comment, adding it as a reply to a thread. Corresponds to liveblocks.createComment.

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.

{  "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.

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)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

  • bodyCreateCommentRequestBody

    Request body (application/json).

get_comment

This endpoint returns a comment by its ID. Corresponds to liveblocks.getComment.

result = client.get_comment(    room_id="my-room-id",    thread_id="th_abc123",    comment_id="cm_abc123",)print(result)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

  • comment_idstr

    ID of the comment

edit_comment

This endpoint edits the specified comment. Corresponds to liveblocks.editComment.

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.

{  "version": 1,  "content": [    {      "type": "paragraph",      "children": [{ "text": "Hello " }, { "text": "world", "bold": true }]    }  ]}
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)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

  • comment_idstr

    ID of the comment

  • bodyEditCommentRequestBody

    Request body (application/json).

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.

client.delete_comment(    room_id="my-room-id",    thread_id="th_abc123",    comment_id="cm_abc123",)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

  • comment_idstr

    ID of the comment

add_comment_reaction

This endpoint adds a reaction to a comment. Corresponds to liveblocks.addCommentReaction.

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)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

  • comment_idstr

    ID of the comment

  • bodyAddCommentReactionRequestBody

    Request body (application/json).

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.

client.remove_comment_reaction(    room_id="my-room-id",    thread_id="th_abc123",    comment_id="cm_abc123",)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

  • comment_idstr

    ID of the comment

  • bodyRemoveCommentReactionRequestBody | Unset

    Request body (application/json).

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.

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.

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)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

  • comment_idstr

    ID of the comment

  • bodyEditCommentMetadataRequestBody

    Request body (application/json).

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.

result = client.get_thread_inbox_notifications(    room_id="my-room-id",    thread_id="th_abc123",)print(result)
Parameters
  • room_idstr

    ID of the room

  • thread_idstr

    ID of the thread

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 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 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.

from liveblocks.models import AuthorizeUserRequestBody
result = client.authorize_user( body=AuthorizeUserRequestBody( user_id="...", permissions=..., # user_info=..., # organization_id="...", ),)print(result)
Parameters
  • bodyAuthorizeUserRequestBody

    Request body (application/json).

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 section.

Important: The difference with an access token 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 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).

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.

from liveblocks.models import IdentifyUserRequestBody
result = client.identify_user( body=IdentifyUserRequestBody( user_id="...", # organization_id="...", # group_ids=[], # user_info=..., ),)print(result)
Parameters
  • bodyIdentifyUserRequestBody

    Request body (application/json).

Notifications

get_inbox_notification

This endpoint returns a user’s inbox notification by its ID. Corresponds to liveblocks.getInboxNotification.

result = client.get_inbox_notification(    user_id="user-123",    inbox_notification_id="in_abc123",)print(result)
Parameters
  • user_idstr

    ID of the user

  • inbox_notification_idstr

    ID of the inbox notification

delete_inbox_notification

This endpoint deletes a user’s inbox notification by its ID. Corresponds to liveblocks.deleteInboxNotification.

client.delete_inbox_notification(    user_id="user-123",    inbox_notification_id="in_abc123",)
Parameters
  • user_idstr

    ID of the user

  • inbox_notification_idstr

    ID of the inbox notification

get_inbox_notifications

This endpoint returns all the user’s inbox notifications. Corresponds to liveblocks.getInboxNotifications.

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

    ID of the user

  • organization_idstr | Unset

    The organization ID to filter notifications for.

  • querystr | Unset

    Query to filter notifications. You can filter by unread, for example, unread:true.

  • limitint | 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)

  • starting_afterstr | Unset

    A cursor used for pagination. Get the value from the nextCursor response of the previous page.

delete_all_inbox_notifications

This endpoint deletes all the user’s inbox notifications. Corresponds to liveblocks.deleteAllInboxNotifications.

client.delete_all_inbox_notifications(    user_id="user-123",)
Parameters
  • user_idstr

    ID of the user

get_notification_settings

This endpoint returns a user's notification settings for the project. Corresponds to liveblocks.getNotificationSettings.

result = client.get_notification_settings(    user_id="user-123",)print(result)
Parameters
  • user_idstr

    ID of the user

update_notification_settings

This endpoint updates a user's notification settings for the project. Corresponds to liveblocks.updateNotificationSettings.

from liveblocks.models import UpdateNotificationSettingsRequestBody
result = client.update_notification_settings( user_id="user-123", body=UpdateNotificationSettingsRequestBody( # email=..., # slack=..., # teams=..., ),)print(result)
Parameters
  • user_idstr

    ID of the user

  • bodyUpdateNotificationSettingsRequestBody

    Request body (application/json).

delete_notification_settings

This endpoint deletes a user's notification settings for the project. Corresponds to liveblocks.deleteNotificationSettings.

client.delete_notification_settings(    user_id="user-123",)
Parameters
  • user_idstr

    ID of the user

get_room_subscription_settings

This endpoint returns a user’s subscription settings for a specific room. Corresponds to liveblocks.getRoomSubscriptionSettings.

result = client.get_room_subscription_settings(    room_id="my-room-id",    user_id="user-123",)print(result)
Parameters
  • room_idstr

    ID of the room

  • user_idstr

    ID of the user

update_room_subscription_settings

This endpoint updates a user’s subscription settings for a specific room. Corresponds to liveblocks.updateRoomSubscriptionSettings.

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)
Parameters
  • room_idstr

    ID of the room

  • user_idstr

    ID of the user

  • bodyUpdateRoomSubscriptionSettingsRequestBody

    Request body (application/json).

delete_room_subscription_settings

This endpoint deletes a user’s subscription settings for a specific room. Corresponds to liveblocks.deleteRoomSubscriptionSettings.

client.delete_room_subscription_settings(    room_id="my-room-id",    user_id="user-123",)
Parameters
  • room_idstr

    ID of the room

  • user_idstr

    ID of the user

get_user_room_subscription_settings

This endpoint returns the list of a user's room subscription settings. Corresponds to liveblocks.getUserRoomSubscriptionSettings.

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

    ID of the user

  • starting_afterstr | Unset

    A cursor used for pagination. Get the value from the nextCursor response of the previous page.

  • limitint | 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)

  • organization_idstr | Unset

    The organization ID to filter room subscription settings for.

get_room_notification_settings

Deprecated. Renamed to /subscription-settings. Read more in our migration guide.

This endpoint returns a user’s subscription settings for a specific room. Corresponds to liveblocks.getRoomNotificationSettings.

result = client.get_room_notification_settings(    room_id="my-room-id",    user_id="user-123",)print(result)
Parameters
  • room_idstr

    ID of the room

  • user_idstr

    ID of the user

update_room_notification_settings

Deprecated. Renamed to /subscription-settings. Read more in our migration guide.

This endpoint updates a user’s notification settings for a specific room. Corresponds to liveblocks.updateRoomNotificationSettings.

result = client.update_room_notification_settings(    room_id="my-room-id",    user_id="user-123",)print(result)
Parameters
  • room_idstr

    ID of the room

  • user_idstr

    ID of the user

  • bodyUpdateRoomSubscriptionSettingsRequestBody | Unset

    Request body (application/json).

delete_room_notification_settings

Deprecated. Renamed to /subscription-settings. Read more in our migration guide.

This endpoint deletes a user’s notification settings for a specific room. Corresponds to liveblocks.deleteRoomNotificationSettings.

client.delete_room_notification_settings(    room_id="my-room-id",    user_id="user-123",)
Parameters
  • room_idstr

    ID of the room

  • user_idstr

    ID of the user

trigger_inbox_notification

This endpoint triggers an inbox notification. Corresponds to liveblocks.triggerInboxNotification.

client.trigger_inbox_notification()
Parameters
  • bodyTriggerInboxNotificationRequestBody | Unset

    Request body (application/json).

mark_inbox_notification_as_read

This endpoint marks a specific inbox notification as read.

client.mark_inbox_notification_as_read(    inbox_notification_id="in_abc123",)
Parameters
  • inbox_notification_idstr

    ID of the inbox notification

Groups

get_groups

This endpoint returns a list of all groups in your project. Corresponds to liveblocks.getGroups.

result = client.get_groups(    # limit=20,    # starting_after="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",)print(result)
Parameters
  • limitint | 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)

  • starting_afterstr | Unset

    A cursor used for pagination. Get the value from the nextCursor response of the previous page.

create_group

This endpoint creates a new group. Corresponds to liveblocks.createGroup.

result = client.create_group()print(result)
Parameters
  • bodyCreateGroupRequestBody | Unset

    Request body (application/json).

get_group

This endpoint returns a specific group by ID. Corresponds to liveblocks.getGroup.

result = client.get_group(    group_id="engineering",)print(result)
Parameters
  • group_idstr

    The ID of the group to retrieve.

delete_group

This endpoint deletes a group. Corresponds to liveblocks.deleteGroup.

client.delete_group(    group_id="engineering",)
Parameters
  • group_idstr

    The ID of the group to delete.

add_group_members

This endpoint adds new members to an existing group. Corresponds to liveblocks.addGroupMembers.

from liveblocks.models import AddGroupMembersRequestBody
result = client.add_group_members( group_id="engineering", body=AddGroupMembersRequestBody( member_ids=[], ),)print(result)
Parameters
  • group_idstr

    The ID of the group to add members to.

  • bodyAddGroupMembersRequestBody

    Request body (application/json).

remove_group_members

This endpoint removes members from an existing group. Corresponds to liveblocks.removeGroupMembers.

from liveblocks.models import RemoveGroupMembersRequestBody
result = client.remove_group_members( group_id="engineering", body=RemoveGroupMembersRequestBody( member_ids=[], ),)print(result)
Parameters
  • group_idstr

    The ID of the group to remove members from.

  • bodyRemoveGroupMembersRequestBody

    Request body (application/json).

get_user_groups

This endpoint returns all groups that a specific user is a member of. Corresponds to liveblocks.getUserGroups.

result = client.get_user_groups(    user_id="user-123",    # limit=20,    # starting_after="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",)print(result)
Parameters
  • user_idstr

    The ID of the user to get groups for.

  • limitint | 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)

  • starting_afterstr | Unset

    A cursor used for pagination. Get the value from the nextCursor response of the previous page.

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.

result = client.get_ai_copilots(    # limit=20,    # starting_after="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",)print(result)
Parameters
  • limitint | 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)

  • starting_afterstr | Unset

    A cursor used for pagination. Get the value from the nextCursor response of the previous page.

create_ai_copilot

This endpoint creates a new AI copilot with the given configuration. Corresponds to liveblocks.createAiCopilot.

result = client.create_ai_copilot(    body=...,)print(result)
Parameters
  • bodyCreateAiCopilotOptionsAnthropic | CreateAiCopilotOptionsGoogle | CreateAiCopilotOptionsOpenAi | CreateAiCopilotOptionsOpenAiCompatible

    Request body (application/json).

get_ai_copilot

This endpoint returns an AI copilot by its ID. Corresponds to liveblocks.getAiCopilot.

result = client.get_ai_copilot(    copilot_id="cp_abc123",)print(result)
Parameters
  • copilot_idstr

    ID of the AI copilot

update_ai_copilot

This endpoint updates an existing AI copilot's configuration. Corresponds to liveblocks.updateAiCopilot.

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.

from liveblocks.models import UpdateAiCopilotRequestBody
result = client.update_ai_copilot( copilot_id="cp_abc123", body=UpdateAiCopilotRequestBody( # name="...", # description="...", # system_prompt="...", ),)print(result)
Parameters
  • copilot_idstr

    ID of the AI copilot

  • bodyUpdateAiCopilotRequestBody

    Request body (application/json).

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.

client.delete_ai_copilot(    copilot_id="cp_abc123",)
Parameters
  • copilot_idstr

    ID of the AI copilot

get_knowledge_sources

This endpoint returns a paginated list of knowledge sources for a specific AI copilot. Corresponds to liveblocks.getKnowledgeSources.

result = client.get_knowledge_sources(    copilot_id="cp_abc123",    # limit=20,    # starting_after="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",)print(result)
Parameters
  • copilot_idstr

    ID of the AI copilot

  • limitint | 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)

  • starting_afterstr | Unset

    A cursor used for pagination. Get the value from the nextCursor response of the previous page.

get_knowledge_source

This endpoint returns a specific knowledge source by its ID. Corresponds to liveblocks.getKnowledgeSource.

result = client.get_knowledge_source(    copilot_id="cp_abc123",    knowledge_source_id="ks_abc123",)print(result)
Parameters
  • copilot_idstr

    ID of the AI copilot

  • knowledge_source_idstr

    ID of the knowledge source

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.

from liveblocks.models import CreateWebKnowledgeSourceRequestBody
result = client.create_web_knowledge_source( copilot_id="cp_abc123", body=CreateWebKnowledgeSourceRequestBody( copilot_id="...", url="...", type_=..., ),)print(result)
Parameters
  • copilot_idstr

    ID of the AI copilot

  • bodyCreateWebKnowledgeSourceRequestBody

    Request body (application/json).

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.

result = client.create_file_knowledge_source(    copilot_id="cp_abc123",    name="document.pdf",    body=...,)print(result)
Parameters
  • copilot_idstr

    ID of the AI copilot

  • namestr

    Name of the file

  • bodyFile

    Request body (application/octet-stream).

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.

result = client.get_file_knowledge_source_markdown(    copilot_id="cp_abc123",    knowledge_source_id="ks_abc123",)print(result)
Parameters
  • copilot_idstr

    ID of the AI copilot

  • knowledge_source_idstr

    ID of the knowledge source

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.

client.delete_file_knowledge_source(    copilot_id="cp_abc123",    knowledge_source_id="ks_abc123",)
Parameters
  • copilot_idstr

    ID of the AI copilot

  • knowledge_source_idstr

    ID of the knowledge source

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.

client.delete_web_knowledge_source(    copilot_id="cp_abc123",    knowledge_source_id="ks_abc123",)
Parameters
  • copilot_idstr

    ID of the AI copilot

  • knowledge_source_idstr

    ID of the knowledge source

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.

result = client.get_web_knowledge_source_links(    copilot_id="cp_abc123",    knowledge_source_id="ks_abc123",    # limit=20,    # starting_after="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",)print(result)
Parameters
  • copilot_idstr

    ID of the AI copilot

  • knowledge_source_idstr

    ID of the knowledge source

  • limitint | 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)

  • starting_afterstr | Unset

    A cursor used for pagination. Get the value from the nextCursor response of the previous page.

Management

get_management_projects

Returns a paginated list of projects. You can limit the number of projects returned per page and use the provided nextCursor for pagination. This endpoint requires the read:all scope.

result = client.get_management_projects(    # limit=20,    # cursor="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",)print(result)
Parameters
  • limitint | Unset

    A limit on the number of projects to return. The limit can range between 1 and 100, and defaults to 20. (default: 20)

  • cursorstr | Unset

    A cursor used for pagination. Get the value from the nextCursor response of the previous page.

create_management_project

Creates a new project within your account. This endpoint requires the write:all scope. You can specify the project type, name, and version creation timeout. Upon success, returns information about the newly created project, including its ID, keys, region, and settings.

from liveblocks.models import CreateManagementProjectRequestBody
result = client.create_management_project( body=CreateManagementProjectRequestBody( type_=..., # name="...", # version_creation_timeout=False, ),)print(result)
Parameters
  • bodyCreateManagementProjectRequestBody

    Request body (application/json).

get_management_project

Returns a single project specified by its ID. This endpoint requires the read:all scope. If the project cannot be found, a 404 error response is returned.

result = client.get_management_project(    project_id="683d49ed6b4d1cec5a597b13",)print(result)
Parameters
  • project_idstr

    ID of the project

update_management_project

Updates an existing project specified by its ID. This endpoint allows you to modify project details such as the project name and the version creation timeout. The versionCreationTimeout can be set to false to disable the timeout or to a number of seconds between 30 and 300. Fields omitted from the request body will not be updated. Requires the write:all scope.

If the project cannot be found, a 404 error response is returned.

from liveblocks.models import UpdateManagementProjectRequestBody
result = client.update_management_project( project_id="683d49ed6b4d1cec5a597b13", body=UpdateManagementProjectRequestBody( # name="...", # version_creation_timeout=False, ),)print(result)
Parameters
  • project_idstr

    ID of the project

  • bodyUpdateManagementProjectRequestBody

    Request body (application/json).

delete_management_project

Soft deletes the project specified by its ID. This endpoint requires the write:all scope. If the project cannot be found, a 404 error response is returned.

client.delete_management_project(    project_id="683d49ed6b4d1cec5a597b13",)
Parameters
  • project_idstr

    ID of the project

activate_project_public_api_key

Activates the public API key associated with the specified project. This endpoint requires the write:all scope. If the project cannot be found, a 404 error response is returned.

client.activate_project_public_api_key(    project_id="683d49ed6b4d1cec5a597b13",)
Parameters
  • project_idstr

    ID of the project

deactivate_project_public_api_key

Deactivates the public API key associated with the specified project. This endpoint requires the write:all scope. If the project cannot be found, a 404 error response is returned.

client.deactivate_project_public_api_key(    project_id="683d49ed6b4d1cec5a597b13",)
Parameters
  • project_idstr

    ID of the project

roll_project_public_api_key

Rolls (rotates) the public API key associated with the specified project, generating a new key value while deprecating the previous one. The new key becomes immediately active. This endpoint requires the write:all scope.

If the public key is not currently enabled for the project, a 403 error response is returned. If the project cannot be found, a 404 error response is returned. An optional expirationIn parameter can be provided in the request body to set when the previous key should expire.

result = client.roll_project_public_api_key(    project_id="683d49ed6b4d1cec5a597b13",)print(result)
Parameters
  • project_idstr

    ID of the project

  • bodyRollProjectPublicApiKeyRequestBody | Unset

    Request body (application/json).

roll_project_secret_api_key

Rolls (rotates) the secret API key associated with the specified project, generating a new key value while deprecating the previous one. The new key becomes immediately active. This endpoint requires the write:all scope.

If the project cannot be found, a 404 error response is returned. An optional expirationIn parameter can be provided in the request body to set when the previous key should expire.

result = client.roll_project_secret_api_key(    project_id="683d49ed6b4d1cec5a597b13",)print(result)
Parameters
  • project_idstr

    ID of the project

  • bodyRollProjectSecretApiKeyRequestBody | Unset

    Request body (application/json).

get_management_webhooks

Returns a paginated list of webhooks for a project. This endpoint requires the read:all scope. The response includes an array of webhook objects associated with the specified project, as well as a nextCursor property for pagination. Use the limit query parameter to specify the maximum number of webhooks to return (1-100, default 20). If the result is paginated, use the cursor parameter from the nextCursor value in the previous response to fetch subsequent pages. If the project cannot be found, a 404 error response is returned.

result = client.get_management_webhooks(    project_id="683d49ed6b4d1cec5a597b13",    # limit=20,    # cursor="eyJjcmVhdGVkQXQiOjE2NjAwMDA5ODgxMzd9",)print(result)
Parameters
  • project_idstr

    ID of the project

  • limitint | Unset

    A limit on the number of webhooks to return. The limit can range between 1 and 100, and defaults to 20. (default: 20)

  • cursorstr | Unset

    A cursor used for pagination. Get the value from the nextCursor response of the previous page.

create_management_webhook

Creates a new webhook for a project. This endpoint requires the write:all scope. If the project cannot be found, a 404 error response is returned.

from liveblocks.models import CreateManagementWebhookRequestBody
result = client.create_management_webhook( project_id="683d49ed6b4d1cec5a597b13", body=CreateManagementWebhookRequestBody( url="...", subscribed_events=[], # rate_limit=0, # additional_headers=..., # storage_updated_throttle_seconds=0, ),)print(result)
Parameters
  • project_idstr

    ID of the project

  • bodyCreateManagementWebhookRequestBody

    Request body (application/json).

get_management_webhook

Get one webhook by webhookId for a project. Returns webhook settings such as URL, subscribed events, disabled state, throttling, and additional headers. Returns 404 if the project or webhook does not exist. This endpoint requires the read:all scope.

result = client.get_management_webhook(    project_id="683d49ed6b4d1cec5a597b13",    webhook_id="wh_abc123",)print(result)
Parameters
  • project_idstr

    ID of the project

  • webhook_idstr

    ID of the webhook

update_management_webhook

Update one webhook by webhookId for a project. Send only fields you want to change; omitted fields stay unchanged. Returns 404 if the project or webhook does not exist and 422 for validation errors. This endpoint requires the write:all scope.

from liveblocks.models import UpdateManagementWebhookRequestBody
result = client.update_management_webhook( project_id="683d49ed6b4d1cec5a597b13", webhook_id="wh_abc123", body=UpdateManagementWebhookRequestBody( # url="...", # subscribed_events=[], # rate_limit=0, ),)print(result)
Parameters
  • project_idstr

    ID of the project

  • webhook_idstr

    ID of the webhook

  • bodyUpdateManagementWebhookRequestBody

    Request body (application/json).

delete_management_webhook

Delete one webhook by webhookId for a project. Returns 200 with an empty body on success, or 404 if the project or webhook does not exist. Requires write:all.

client.delete_management_webhook(    project_id="683d49ed6b4d1cec5a597b13",    webhook_id="wh_abc123",)
Parameters
  • project_idstr

    ID of the project

  • webhook_idstr

    ID of the webhook

roll_management_webhook_secret

Rotate a webhook signing secret and return the new secret. The previous secret remains valid for 24 hours. Returns 404 if the project or webhook does not exist. This endpoint requires the write:all scope.

result = client.roll_management_webhook_secret(    project_id="683d49ed6b4d1cec5a597b13",    webhook_id="wh_abc123",)print(result)
Parameters
  • project_idstr

    ID of the project

  • webhook_idstr

    ID of the webhook

get_management_webhook_additional_headers

Get a webhook's additional headers. Returns 404 if the project or webhook does not exist. Requires read:all.

result = client.get_management_webhook_additional_headers(    project_id="683d49ed6b4d1cec5a597b13",    webhook_id="wh_abc123",)print(result)
Parameters
  • project_idstr

    ID of the project

  • webhook_idstr

    ID of the webhook

upsert_management_webhook_additional_headers

Upsert additional headers for a webhook. Provided headers are merged with existing headers, and existing values are overwritten when names match. Returns updated headers, or 404 if the project or webhook does not exist. This endpoint requires the write:all scope.

from liveblocks.models import UpsertManagementWebhookHeadersRequestBody
result = client.upsert_management_webhook_additional_headers( project_id="683d49ed6b4d1cec5a597b13", webhook_id="wh_abc123", body=UpsertManagementWebhookHeadersRequestBody( headers=..., ),)print(result)
Parameters
  • project_idstr

    ID of the project

  • webhook_idstr

    ID of the webhook

  • bodyUpsertManagementWebhookHeadersRequestBody

    Request body (application/json).

delete_management_webhook_additional_headers

Remove selected additional headers from a webhook. Send header names in headers field; other headers are unchanged. Returns updated headers, or 404 if the project or webhook does not exist. This endpoint requires the write:all scope. At least one header name must be provided; otherwise, a 422 error response is returned.

from liveblocks.models import DeleteManagementWebhookHeadersRequestBody
result = client.delete_management_webhook_additional_headers( project_id="683d49ed6b4d1cec5a597b13", webhook_id="wh_abc123", body=DeleteManagementWebhookHeadersRequestBody( headers=[], ),)print(result)
Parameters
  • project_idstr

    ID of the project

  • webhook_idstr

    ID of the webhook

  • bodyDeleteManagementWebhookHeadersRequestBody

    Request body (application/json).

recover_failed_webhook_messages

Requeue failed deliveries for a webhook from the given since timestamp. Returns 200 with an empty body when recovery starts, an 404 if the project or webhook does not exist. This endpoint requires the write:all scope.

from liveblocks.models import RecoverManagementWebhookFailedMessagesRequestBody
client.recover_failed_webhook_messages( project_id="683d49ed6b4d1cec5a597b13", webhook_id="wh_abc123", body=RecoverManagementWebhookFailedMessagesRequestBody( since=..., ),)
Parameters
  • project_idstr

    ID of the project

  • webhook_idstr

    ID of the webhook

  • bodyRecoverManagementWebhookFailedMessagesRequestBody

    Request body (application/json).

send_test_webhook

Send a test event to a webhook and return the created message metadata. subscribedEvent must be one of the webhook's subscribed events, otherwise the endpoint returns 422. Returns 404 if the project or webhook does not exist. This endpoint requires the write:all scope.

from liveblocks.models import TestManagementWebhookRequestBody
result = client.send_test_webhook( project_id="683d49ed6b4d1cec5a597b13", webhook_id="wh_abc123", body=TestManagementWebhookRequestBody( subscribed_event=..., ),)print(result)
Parameters
  • project_idstr

    ID of the project

  • webhook_idstr

    ID of the webhook

  • bodyTestManagementWebhookRequestBody

    Request body (application/json).

Error Handling

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

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.