Introducing a new way to review your PRs.

Read the announcement

karakeep-app / karakeep

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

View on GitHub

21 documents · Updated Nov 23, 2026

docs / bookmark-organization-apis

Bookmark and organization APIs

The bookmark and organization APIs provide the main user-facing model for saving knowledge and finding it later. They let clients create and update link, text, and asset bookmarks. They also connect bookmarks to tags, lists, highlights, feeds, rules, prompts, and search. See API and tRPC for the shared API entry points.

Bookmark model

The bookmark is the central record for saved knowledge. It keeps user state such as archive and favourite flags, notes, summaries, processing status, and one typed content value.

TypePurposeMain content
LinkSave a web address for later readingURL plus fetched page details and optional saved previews
TextSave a note or copied textText and an optional source URL
AssetSave an image or PDFAsset reference, file name, and optional extracted content

Bookmark responses can include tags and related assets. Link content can be absent while crawling is in progress. Clients should use the crawl state to understand readiness. includeContent controls whether larger stored content is returned. References: packages/…/bookmarks.ts• L167-257

Bookmark creation and enrichment

Bookmark creation stores the user request before it starts work that fetches, extracts, embeds, tags, or otherwise enriches the record. A link is deduplicated by URL for the same user. RSS and bulk imports leave an existing bookmark unchanged. A normal re-save restores an existing bookmark and updates only the fields supplied by the caller.

The follow-up work depends on the content type. Link bookmarks enter crawling. Text bookmarks enter tagging or embedding work. Asset bookmarks enter asset processing. Low-priority requests can use lower-priority work queues so that bulk activity does not block normal work. Creation also starts rule evaluation and search indexing. A successful create response therefore confirms that the bookmark exists. It does not confirm that derived data is ready. References: packages/…/bookmarks.ts• L208-214, packages/…/bookmarks.ts• L240-329, packages/…/bookmarks.ts• L349-565

The main bookmark lifecycle is shown below.

flowchart LR
    A[Create bookmark] --> B[Store typed bookmark]
    B --> C{Content type}
    C -->|Link| D[Crawl and extract]
    C -->|Text| E[Tag or embed]
    C -->|Asset| F[Process asset]
    D --> G[Update derived content]
    E --> G
    F --> G
    B --> H[Evaluate rules]
    B --> I[Index for search]
    G --> I

Bookmark access and content views

Bookmark reads have two access levels. The owner can manage the bookmark. A collaborator can read it when it belongs to a list that the collaborator can view. Shared readers do not receive owner-only state such as favourites, archive state, or personal notes. References: packages/…/bookmarks.ts• L116-155, packages/…/bookmarks.ts• L808-821

The normal bookmark view suits cards and lists. The readable-content view suits agents and clients that need the page body. It returns normalized Markdown or plain text with a content version and bounded chunks. A continuation cursor is valid only for the same bookmark, format, and content version. References: packages/…/bookmarks.ts• L823-862, packages/…/bookmarks.ts• L216-301

Bookmark updates are partial. Common fields apply to all types. Link fields apply only to links. Text and asset content fields apply only to their matching type. Tag changes can attach or detach tags by ID or name. A new tag name is created when needed. Changes to bookmark state or tags update search and can trigger rules or webhooks. References: packages/…/bookmarks.ts• L569-758, packages/…/bookmarks.ts• L1236-1437

The HTTP API exposes bookmark collection and item operations. It also provides URL checks, readable content, asset membership, tag changes, highlights, summarization, deletion, and a SingleFile upload path. The SingleFile path can skip, replace, or append an archive for an existing link and can request a recrawl. References: packages/…/bookmarks.ts• L35-213, packages/…/bookmarks.ts• L304-442

Bookmark maintenance operations

Maintenance operations keep saved content usable after creation. Owners can request a recrawl or on-demand video preservation for link bookmarks. These requests enter background work, so acceptance does not mean that the new archive or video is ready.

Reading progress is a per-user view of a readable link. Any user who can read the bookmark can save and retrieve that user's offset, anchor, and percentage. The service also exposes an owner-facing view of broken links so clients can find crawl failures and non-success HTTP results. Bookmark summaries use readable link content and the user's summary prompts, then update the bookmark and its search record. References: packages/…/bookmarks.ts• L820-955, packages/…/bookmarks.ts• L1486-1668

Tags

Tags are user-owned labels that connect bookmarks to a shared naming space. A tag view includes its name and usage counts split by whether an AI process or a person added the tag. This lets clients separate machine-generated labels from deliberate user labels. References: packages/…/tags.ts• L30-57, packages/…/tags.ts• L84-181

Tag operations support name filtering, ID filtering, attachment-source filtering, and sorting by name, use, or match relevance. The source filters have distinct meanings:

  • ai returns tags used only by AI attachments.
  • human returns tags with at least one human attachment. These tags can also have AI attachments.
  • none returns tags with no bookmark attachments.

Tags can be renamed, deleted, removed when unused, or merged into a destination tag. These changes update affected bookmarks and their search records. References: packages/…/tags.ts• L184-199, packages/…/tags.ts• L201-387

Bookmarks can be read through a tag with a paged bookmark query. The tag view is a membership view over the bookmarks. It is not a second bookmark store. References: packages/…/tags.ts• L84-181

Lists

Lists provide named bookmark collections and can form a parent-child hierarchy. A manual list stores explicit membership. A smart list stores a search qualifier query and computes its membership when a client asks for its bookmarks or size. Smart lists can refer to other lists, but they do not accept direct add or remove operations. References: packages/…/lists.ts• L38-83, packages/…/lists.ts• L261-302, packages/…/lists.ts• L1024-1127

List records describe the current user's role. Owners manage metadata and collaborators. Editors can change bookmark membership. Viewers can read the list. Public access is a separate read view. Shared and public views hide private list details. References: packages/…/lists.ts• L48-71, packages/…/lists.ts• L427-498, packages/…/lists.ts• L161-253

List operations cover creation, edits, deletion, bookmark membership, sizes, merges, membership lookup, collaboration, and RSS access. Parent validation prevents new hierarchy cycles, while recursive deletion can remove a list tree without deleting the bookmarks. Manual membership changes also emit list events for rules. A merge moves the owner's bookmarks and keeps collaborator-added membership tied to the source list. Deleting a list removes or edits rules that refer to that list. References: packages/…/lists.ts• L261-302, packages/…/lists.ts• L558-654, packages/…/lists.ts• L1170-1305

Smart-list qualifiers use the same bookmark conditions as search. This includes user-specific conditions such as notes and highlights, so a smart list evaluates those fields for its owner rather than treating another user's data as a match. Nested smart lists are bounded and circular references produce no matches. References: packages/…/lists.ts• L1024-1127, packages/…/search.ts• L56-63, packages/…/search.ts• L209-223

Highlights

Highlights are user-owned text selections anchored to a bookmark by character offsets. They carry the selected text, a color, and an optional note. Clients can create, read, list, search, update, and delete highlights. The bookmark must be readable for highlight access. The highlight owner controls the highlight itself. References: packages/…/highlights.ts• L53-134, packages/…/highlights.repo.ts• L45-129

RSS feeds

An RSS feed is a user-owned subscription that turns matching feed items into bookmarks over time. It records its name, URL, enabled state, tag handling, and the status and time of its last fetch. Creating or editing a feed changes the subscription. It does not create a bookmark in the request path.

The feed API supports listing, creation, update, deletion, and an immediate fetch request. Immediate fetch is queued for later work. Its response confirms that the request was accepted, not that new bookmarks already exist. Removing a feed does not remove its imported bookmarks. References: packages/…/feeds.service.ts• L25-73

Rules and prompts

Rules turn bookmark and organization events into repeatable actions. A rule has an event, a condition, and actions. Events can represent bookmark creation, tag changes, list changes, favouriting, or archiving. Conditions inspect bookmark and organization state. Actions can change tags or lists, archive or favourite a bookmark, or request a full-page archive.

Rules are user-owned. Their referenced tags and lists must be available to the current user. Conditions can combine with and and or, with a limit on nesting depth. References: packages/…/rules.ts• L35-83, packages/…/rules.ts• L85-218

Custom prompts shape inference work. A prompt is user-owned text with an enabled flag and a target such as tagging, text, images, or summaries. Clients can create, list, update, enable or disable, and delete prompts. Bookmark summarization uses prompts targeted at summaries together with the bookmark's readable details. References: packages/…/bookmarks.ts• L1486-1614

Search-facing access

Search is the common read path across bookmarks and their organization fields. A search request accepts free text and qualifiers. It returns bookmark records with a cursor. Full-text mode uses the search index. Semantic mode uses embeddings and relevance. Hybrid mode combines both result sources and falls back to full-text when semantic work cannot run. See search and vector retrieval for the wider retrieval system.

The query language supports qualifiers for tags, lists, feeds, URLs, titles, dates, age, source, bookmark type, archive state, favourite state, tagged state, list membership, and broken links. Qualifiers resolve to bookmark IDs before they filter search results. A list-name qualifier matches all lists with that name and can include manual or smart membership. and intersects matches. or joins them. Smart lists use the same qualifier view but must contain qualifier-only queries. References: packages/…/bookmarks.ts• L938-1174, packages/…/search.ts• L56-129, packages/…/lists.ts• L1043-1076

Semantic search needs enabled semantic features, embedding support, and a non-empty text query. A query with only qualifiers has no text to embed, so semantic mode rejects it. Hybrid mode serves that request through full-text search and can fall back to full-text when semantic infrastructure fails. Semantic and hybrid results use relevance sorting. Full-text results can also sort by date. References: packages/…/bookmarks.ts• L986-1123, packages/…/bookmarks.search.test.ts• L351-435

Search keeps retrieval separate from record loading. It first gets ranked bookmark IDs. The bookmark model then loads the full typed records and restores the selected result order. Relevance sorting applies to semantic and hybrid results when semantic search runs. Full-text results can also sort by date. References: packages/…/bookmarks.ts• L969-1174, packages/…/bookmarks.ts• L429-805

API access patterns

The tRPC routers provide the service operation layer. The HTTP routes validate request data and map path and query values into those operations. They also adapt cursors and status codes for REST clients. Shared schemas define the main request and response contracts.

Most reads and writes are scoped to the authenticated user. Bookmark reads have an additional list-sharing path. List operations use role checks. Tags, feeds, highlights, rules, and prompts reject records owned by another user. Inaccessible bookmark reads appear as not found. Clients should not use an authorization result to infer that a hidden bookmark exists. References: packages/…/bookmarks.ts• L94-128, packages/…/bookmarks.ts• L116-155, packages/…/lists.ts• L85-159, packages/…/tags.ts• L36-57, packages/…/rules.ts• L61-83

The main HTTP resource paths are:

ResourceMain pathsResult pattern
Bookmarks/bookmarks, /bookmarks/search, /bookmarks/{bookmarkId}Bookmark objects or paged bookmark results
Tags/tags, /tags/{tagId}, /tags/{tagId}/bookmarksTag records, usage data, or paged bookmarks
Lists/lists, /lists/{listId}, /lists/{listId}/bookmarksList records or paged bookmarks
Highlights/highlights, /highlights/{highlightId}Highlight records or paged highlights
Feeds/feeds, /feeds/{feedId}, /feeds/{feedId}/fetchFeed records or an accepted fetch request

For detailed HTTP contracts, use the OpenAPI definitions for each resource. For cross-system API placement, see API and tRPC and integration operations APIs. Background work for crawl, tagging, and embedding belongs with content ingestion and enrichment jobs. Rule execution belongs with automation operations jobs.

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep bookmark response behavior aligned between the tRPC procedures and the HTTP routes. Changes to typed content or readable content can affect search results, list views, exports, and agents.
  • Preserve the difference between bookmark owner access and list-based read access. Shared views must not expose owner-only bookmark state.
  • When changing tag, list, feed, archive, favourite, or source fields, check search qualifiers, smart-list queries, and rule conditions together.
  • When changing bookmark creation or update side effects, check enrichment queues, search indexing, rule events, and webhooks as one contract.
  • When changing cursor fields or paging order, check the HTTP cursor adapter and each shared cursor consumer.
  • When changing tag or list removal, check affected search records and rules that reference the removed organization object.
  • When changing list names, smart-list traversal, or list hierarchy rules, check list qualifiers, nested-list limits, inverse matches, and cycle handling together.
  • When changing search modes or provider checks, preserve the difference between semantic errors and hybrid fallback behavior.
  • When changing bookmark maintenance operations, preserve the owner boundary for recrawls and summaries and the per-user boundary for reading progress.

Important failure modes

TriggerConsequenceGuard
A client sends link fields for a text or asset bookmarkThe update is rejected instead of changing the wrong content recordMatch type-specific fields to the bookmark content type
A client tries to add a bookmark to a smart listThe operation fails because smart membership comes from its queryChange the smart-list query or use a manual list
A smart list refers to itself, a cycle, or too many nested listsThe affected smart-list condition returns no matchesKeep list references acyclic and within the supported traversal depth
A list-name qualifier matches no listThe positive query returns no bookmarks and its inverse also returns no bookmarksCheck the list name and user scope before relying on a negative list filter
Semantic search has no enabled feature, embedding provider, vector support, or text querySemantic mode fails; hybrid mode falls back to full-text searchCheck search mode and provider readiness before requesting semantic results
A readable-content cursor uses another bookmark, format, or content versionThe request is rejected and the client must restartKeep the cursor opaque and use it only with its original content
A rule refers to a tag or list outside the user's scopeRule creation or update is rejectedResolve referenced resources as the current user
A feed fetch is accepted before background work runsThe feed still shows old fetch state and no new bookmark may existTreat fetch as queued work and read the feed or bookmark view later
A shared reader requests owner-only bookmark stateThe response hides favourites, archive state, and personal notesUse the access-aware bookmark projection
A client saves reading progress for a non-link bookmarkThe operation is rejected because progress needs readable link contentCheck the bookmark type before saving progress
A client requests a video preservation or summary operation without the required link or service supportThe request is rejected and no derived content is changedCheck bookmark type and server or inference readiness

Key files

FileWhy to read it
packages/…/bookmarks.tsShows bookmark operations and their links to queues, rules, indexing, inference, access checks, and search modes.
packages/…/bookmarks.tsShows how typed bookmark records become access-aware views and readable content.
packages/…/bookmarks.tsShows the HTTP bookmark paths, upload path, cursor handling, and REST result shapes.
packages/…/lists.tsShows manual and smart membership, nested-list evaluation, hierarchy, roles, public views, collaboration, and list events.
packages/…/tags.tsShows tag ownership, usage views, attachment-source filters, merge behavior, and search reindex effects.
packages/…/rules.tsShows rule ownership and the service model for rule events, conditions, and actions.
packages/…/highlights.ts and packages/…/highlights.service.tsShow the highlight lifecycle and its bookmark access boundary.
packages/…/feeds.ts and packages/…/feeds.service.tsShow feed subscription operations and queued fetch behavior.
packages/…/prompts.tsShows custom prompt ownership and lifecycle operations.
packages/…/search.ts and packages/…/bookmarks.tsShow how organization qualifiers become search filters and ranked bookmark results.