Skip to main content
The collections module organizes the logged-in user’s saved content. Every user has a single root collection, under which they can nest sub-collections and into which they can save entities.

fetchRootCollection

Fetches the logged-in user’s root collection.
Returns — Promise<Collection>

fetchSubCollections

Fetches the immediate sub-collections of a collection.
string
required
The parent collection ID.
Returns — Promise<Collection[]>

createNewCollection

Creates a sub-collection under a parent collection.
string
required
The parent collection under which to create the sub-collection.
string
required
The name of the new collection.
Returns — Promise<Collection>

fetchCollectionEntities

Fetches the entities within a collection, paginated.
string
required
The collection ID.
number
The page number to fetch.
number
The number of entities to return per page.
"new" | "added" | "top" | "hot"
Sort order: "new" (creation date), "added" (when saved), "top" (reaction count), or "hot" (engagement score).
string
Which reaction top ranks by: "upvote", "downvote", "like", "love", "wow", "sad", "angry", or "funny". Defaults to "upvote". Only valid with sortBy: "top" — the server rejects it with any other sort.
"asc" | "desc"
Sort direction.
CollectionEntityIncludeParam
Associations to populate: "user", "space", "topComments", "files", "grants" (a single value or an array). "saved" isn’t accepted — every returned entity already has isSaved: true. On an entity whose author has blocked the user, topComments is [].
number
With include containing "topComments": how many top comments per entity. Server default 1, maximum 5. Rejected (400) without "topComments" in include.
ReactionType
With include containing "topComments": the reaction whose raw count ranks the top comments. Server default "upvote". Rejected (400) without "topComments" in include.
Returns — Promise<PaginatedResponse<Entity>>

addEntityToCollection

Adds an entity to a collection.
string
required
The collection ID.
string
required
The ID of the entity to add.
Returns — Promise<{ success: boolean; collection: { id: string; entityCount: number } }>

removeEntityFromCollection

Removes an entity from a collection.
string
required
The collection ID.
string
required
The ID of the entity to remove.
Returns — Promise<{ success: boolean; collection: { id: string; entityCount: number } }>

updateCollection

Renames a collection.
string
required
The collection ID.
string
required
The new collection name. Must be a non-empty string.
Returns — Promise<Collection>

deleteCollection

Deletes a collection.
string
required
The collection ID.
Returns — Promise<void>