Bookmark API architecture

Model the life of a link before you multiply endpoints.

A dependable bookmark API needs stable identity, careful URL normalization, folders and tags, explicit permissions, change feeds, conflicts, bulk migration, and inspectable exports.

REST resourcesSync cursorsOptimistic concurrencyImport & export
Bookmark API Blueprint card with connected nodes and code brackets.

Core resource

Separate stable identity from mutable URL metadata

Do not use the URL itself as the primary key. Redirects, edits, intentional duplicates, and shared context require a stable record ID.

FieldPurposeDesign note
idStable identityServer-generated and unchanged across title or URL edits.
urlOriginal destinationPreserve submitted value; store a separate normalized comparison value.
titleUser-facing retrievalEditable; do not overwrite automatically after the user changes it.
noteReason and contextTreat as potentially sensitive and searchable within permission scope.
folder_idPrimary locationTree semantics differ from many-to-many tags.
revisionConcurrency and syncUse a server revision or entity tag to prevent silent overwrites.

System behaviors

Design the difficult edges explicitly

The API becomes trustworthy when clients can predict what happens during duplicates, moves, deletes, offline edits, and partial imports.

URL normalization

Keep the original URL, normalize conservatively, and make tracking-parameter removal transparent and configurable.

Folders and tags

Model ordered folder trees separately from reusable many-to-many tag relationships.

Search

Document indexed fields, ranking, filters, permission boundaries, and whether page content is actually stored.

Sync

Use an opaque cursor or revision sequence, return tombstones, and define field-level conflict rules.

Bulk migration

Stage imports, report per-item warnings, accept idempotency keys, and provide complete structured exports.

Permissions

Use narrow scopes, workspace roles, revocation, and minimal webhook payloads for sensitive link data.

Small first version

Ship predictable semantics before advanced extraction.

A focused API can support create, retrieve, patch, archive, list and filter, folders, tags, a change cursor, import, and export. Add snapshots, full-text page indexing, semantic search, sharing, and webhooks after the core is reliable.

Acceptance scenarios

  • Same URL with different notes
  • Concurrent title and tag updates
  • Folder move while offline
  • Deleted parent folder
  • Large import with partial failures
  • Revoked workspace access
  • Export and clean re-import