Bookmarks

Overview

The API includes built-in support for bookmarking activities. Here's a quick example of how to use the bookmark API.

Adding Bookmarks

var response = await _feedsV3Client.AddBookmarkAsync(
    activityId,
    new AddBookmarkRequest
    {
        UserID = _testUserId,
        NewFolder = new AddFolderRequest { Name = "test-bookmarks1" }
    }
);

Removing Bookmarks

var response = await _feedsV3Client.UpdateBookmarkAsync(
    activityId,
    new UpdateBookmarkRequest
    {
        UserID = _testUserId,
        FolderID = folderId  // Use existing folder ID, not create new folder
    }
);

Querying Bookmarks

var response = await _feedsV3Client.QueryBookmarksAsync(
    new QueryBookmarksRequest
    {
        Limit = 10,
        Filter = new Dictionary<string, object> { ["user_id"] = _testUserId }
    }
);

Bookmarks Queryable Built-In Fields

name type description supported operations example
user_id string or list of strings The ID of the user who owns the bookmark $in, $eq { user_id: { $eq: 'user_123' } }
activity_id string or list of strings The ID of the activity that was bookmarked $in, $eq { activity_id: { $eq: 'activity_123' } }
folder_id string or list of strings The ID of the folder containing the bookmark $eq, $in, $exists { folder_id: { $exists: true } }
created_at string, must be formatted as an RFC3339 timestamp The time the bookmark was created $eq, $gt, $gte, $lt, $lte { created_at: { $gte: '2023-12-04T09:30:20.45Z' } }
updated_at string, must be formatted as an RFC3339 timestamp The time the bookmark was last updated $eq, $gt, $gte, $lt, $lte { updated_at: { $gte: '2023-12-04T09:30:20.45Z' } }

Querying Bookmark Folders

var response = await _feedsV3Client.QueryBookmarksAsync(
    new QueryBookmarksRequest
    {
        Limit = 10,
        Filter = new Dictionary<string, object> { ["user_id"] = _testUserId }
    }
);

Bookmark Folders Queryable Built-In Fields

name type description supported operations example
user_id string or list of strings The ID of the user who owns the folder $in, $eq { user_id: { $eq: 'user_123' } }
folder_name string or list of strings The name of the bookmark folder $eq, $in, $contains { folder_name: { $contains: 'work' } }
created_at string, must be formatted as an RFC3339 timestamp The time the folder was created $eq, $gt, $gte, $lt, $lte { created_at: { $gte: '2023-12-04T09:30:20.45Z' } }
updated_at string, must be formatted as an RFC3339 timestamp The time the folder was last updated $eq, $gt, $gte, $lt, $lte { updated_at: { $gte: '2023-12-04T09:30:20.45Z' } }

Managing Bookmark Folders

Update bookmark folder

The endpoint performs a partial update: only the fields you include in the request are changed, and each of those fields is completely overwritten.

Updating a bookmark folder sends feeds.bookmark_folder.updated event to the clients of the user who owns the folder. There are no default client-side SDK handlers for this event, but you can add a custom handler if your UI needs to be updated.

Delete bookmark folder

Use the delete bookmark folder endpoint to remove a folder by ID. All bookmarks in that folder are removed.

Deleting a bookmark folder sends feeds.bookmark_folder.deleted event to the clients of the user who owns the folder. There are no default client-side SDK handlers for this event, but you can add a custom handler if your UI needs to be updated.

// Add a bookmark with a new folder
var addResponse = await _feedsV3Client.AddBookmarkAsync(
    activityId,
    new AddBookmarkRequest
    {
        UserID = _testUserId,
        NewFolder = new AddFolderRequest
        {
            Name = "Breakfast recipes",
            Custom = new Dictionary<string, object> { ["icon"] = "🍳" }
        }
    }
);
var folderId = addResponse.Bookmark.Folder.Id;

// Update the folder
var updateResponse = await _feedsV3Client.UpdateBookmarkFolderAsync(
    folderId,
    new UpdateBookmarkFolderRequest
    {
        Name = "Sweet Breakfast Recipes",
        Custom = new Dictionary<string, object> { ["icon"] = "🥞" }
    }
);

// Delete the folder (and all bookmarks in it)
await _feedsV3Client.DeleteBookmarkFolderAsync(updateResponse.BookmarkFolder.Id);
Add Chat to my app: getstream.io/SKILL.md

The fastest way to build with Stream. Start a new project or improve an existing one. Full CLI and documentation integration out of the box.


Ask your agent:

/stream Build me a Social App with Feeds and Moderation.
/stream Any livestream calls running?
/stream Feeds .NET v3: <Your Question>