Skip to main content
The collections namespace provides CRUD operations on collections, including default tag management.

collections.list

Returns all collections for the current user’s space.
query
string
Search text to filter collections by name.
visibility
'public' | 'private'
Filter by collection visibility.
collections
Collection[]
Array of collections, each with:
const collections = useQuery(api.collections.list, {
  visibility: "public",
});

collections.get

Returns a single collection with its default tags.
id
Id<'collections'>
required
The collection ID.

collections.create

Creates a new collection.
name
string
required
Collection name.
visibility
'public' | 'private'
Collection visibility. Defaults to 'private'.
defaultTagIds
Id<'tags'>[]
Tags to automatically apply when saves are added to this collection.
const createCollection = useMutation(api.collections.create);

await createCollection({
  name: "Design Inspiration",
  visibility: "public",
  defaultTagIds: [designTagId, inspirationTagId],
});

collections.update

Updates a collection’s name, visibility, or default tags.
id
Id<'collections'>
required
The collection ID.
name
string
New collection name.
visibility
'public' | 'private'
New visibility setting.
defaultTagIds
Id<'tags'>[]
Updated default tags (replaces existing).

collections.remove

Deletes a collection. Saves in the collection are not deleted — they remain in the library.
id
Id<'collections'>
required
The collection ID to delete.
Deleting a collection only removes the grouping. All saves that were in the collection continue to exist in your library.