Bookmarks

This guide explain how to create Account's private bookmarks.


The bookmarks feature allows a user to save references to posts. The list is private to the authenticated Account, hence the owner and ANY Account Manager can access the list.

This feature is provided by the Lens API as a convenience to the user. The bookmarks are stored off-chain, so they are instant and do not require signatures or gas to use.

Add to Bookmarks

Use the bookmarkPost mutation to add a post to the Account's bookmarks list.

You MUST be authenticated as Account Owner or Account Manager to make this request.

AddBookmark.graphql
mutation {  bookmarkPost(request: { postId: "42" })}

That's it—the post is now saved to the Account's bookmarks list.

List Bookmarks

Use the paginated postBookmarks query to list the Account's bookmarks.

You MUST be authenticated as Account Owner or Account Manager to make this request.

query {  postBookmarks(    request: {      # optional      filter: {        # optional, filter by metadata        metadata: {          mainContentFocus: [IMAGE]
          # optional, filter by tags          # tags: PostMetadataTagsFilter
          # optional, filter by content warning          # contentWarning: PostMetadataContentWarningFilter        }      }
      # optional, defaults to the Global Feed      # forFeeds: [EvmAddress!]! = ["0xa27Cc2AaE6E5571C2E496bDD937bf894800c6f5F"]    }  ) {    items {      ... on Post {        ...Post      }
      ... on Repost {        ...Repost      }    }    pageInfo {      prev      next    }  }}

See the Pagination guide for more information on how to handle paginated results.

Remove from Bookmarks

Use the undoBookmarkPost mutation to remove a post from the Account's bookmarks list.

You MUST be authenticated as Account Owner or Account Manager to make this request.

RemoveBookmark.graphql
mutation {  undoBookmarkPost(request: { postId: "42" })}

That's it—the post is now removed from the Account's bookmarks list.