Yjs

Send a binary Yjs update

Changed on

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.

put/rooms/{roomId}/ydoc

Request

  • Base URL: https://api.liveblocks.io/v2
  • URL: https://api.liveblocks.io/v2/rooms/{roomId}/ydoc
  • Auth: none declared

Path parameters

roomIdstring required

ID of the room

Example:my-room-id

Query parameters

guidstring

ID of the subdocument

Example:subdoc-guid-123

Response

Success. The given room’s Yjs doc has been updated.

Changes

    • breaking

      request body became required

    • breaking

      removed the media type application/json for the response with the status

    • info

      api operation id put-rooms-roomId-ydoc removed and replaced with send-yjs-binary-update

    • info

      the request's body type was generalized from array to string