Skip to content

Bookmarks Router

The /bookmarks router provides full Create / Read / Update / Delete access to the bookmark store — a lightweight SQLite database managed by SQLModel and Alembic.

A bookmark is a named snapshot of a waveform view: it captures the channel list, time window, and display units so the user can jump straight back to any interesting event from the web UI.


ColumnTypeNotes
idTEXT (PK)UUID v4, generated server-side
labelTEXTUser-defined name, e.g. "possible M2.1"
channelsTEXTComma-separated SEED codes: "EHZ,EHN"
startDATETIMEUTC start of the bookmarked window
endDATETIMEUTC end of the bookmarked window
unitsTEXTCOUNTS | VEL | DISP | ACC
saved_atDATETIMEServer-side creation timestamp (UTC)

Return all bookmarks ordered newest-first (saved_at DESC).

No parameters.

Response: BookmarkPublic[]


Create a new bookmark.

Request body (BookmarkCreate):

{
"label": "teleseismic P-wave",
"channels": ["EHZ"],
"start": "2026-04-01T10:23:00",
"end": "2026-04-01T10:28:00",
"units": "VEL"
}
FieldRequiredNotes
labelFalls back to "{start}" if blank
channelsstring[] — at least one SEED code
startISO-8601 datetime
endISO-8601 datetime
unitsMust match one of the four valid unit strings

Response: BookmarkPublic (201 Created)


Partial update — any combination of fields may be omitted. Useful for renaming a bookmark from the inline editor in the web UI.

Path param: bookmark_id — UUID string

Request body (BookmarkUpdate, all optional):

{ "label": "confirmed M2.1 — udine" }

Response: Updated BookmarkPublic

Error: 404 if bookmark_id not found.


Permanently delete a single bookmark.

Path param: bookmark_id — UUID string

Response:

{ "deleted": "a1b2c3d4-…" }

Error: 404 if not found.


The database file is created automatically on first run. Run Alembic migrations whenever you pull a new version:

Terminal window
cd app
alembic upgrade head

Current migration chain:

RevisionDescription
8cd7b1d2eb13Initial bookmark table
0697a8162520Remove date column (redundant with start)

The DB_PATH environment variable overrides the default ./data/database.db, which is required when running the API inside Docker with a volume-mounted data directory:

Terminal window
export DB_PATH=/data/database.db