RoomsMetadata

You can assign custom metadata to your room. For example, if you have different types of room experiences, you can store that type as metadata. This would then come handy when building an overview page listing all the rooms where the type metadata could be used as a filter, making it easy for people to find what they’re looking for.

One way to edit metadata is to use the create room API. In this example we’re creating a new room with a custom roomType property, and setting it to "whiteboard":

fetch("https://api.liveblocks.io/v2/rooms", {  method: "POST",  body: JSON.stringify({    id: "my-room-name",    defaultAccesses: [],    metadata: {      roomType: "whiteboard",    },  }),});

We can then use the get rooms API to retrieve a list of rooms containing the "whiteboard" roomType:

const metadata = "metadata.roomType=whiteboard";const url = `https://api.liveblocks.io/v2/rooms?${metadata}`;const response = await fetch(url);const rooms = await response.json();

Metadata can be also be used within a number of our other APIs.

We use cookies to collect data to improve your experience on our site. Read our Privacy Policy to learn more.