{"openapi":"3.1.0","info":{"title":"Almetia API","version":"0.1.0"},"paths":{"/space/me":{"get":{"operationId":"space_me","summary":"Get active Space","description":"Returns the authenticated caller's Space metadata and inbox slug.","x-almetia-scope":"space:read","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/space/rotate-inbox-slug":{"post":{"operationId":"space_rotate_inbox_slug","summary":"Rotate Space inbox slug","description":"Generates a new inbox.almetia.com slug for the caller's Space and invalidates the previous address.","x-almetia-scope":"space:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/space/tokens":{"get":{"operationId":"space_list_tokens","summary":"List Personal Access Tokens","description":"Lists Personal Access Token metadata for the active Space.","x-almetia-scope":"space:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}},"post":{"operationId":"space_create_token","summary":"Create Personal Access Token","description":"Creates a scoped alm_pat_ Personal Access Token and returns the raw secret once.","x-almetia-scope":"space:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/space/tokens/revoke":{"post":{"operationId":"space_revoke_token","summary":"Revoke Personal Access Token","description":"Immediately revokes a Personal Access Token belonging to the active Space.","x-almetia-scope":"space:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/documents":{"get":{"operationId":"documents_list","summary":"List Documents","description":"Lists Documents in the active Space filtered by readingStatus and brainStatus.","x-almetia-scope":"documents:read","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/documents/detail":{"get":{"operationId":"documents_get","summary":"Get Document with Snapshot and Highlights","description":"Returns one Document, its latest cached Markdown Snapshot, and its Highlights.","x-almetia-scope":"documents:read","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/documents/save-url":{"post":{"operationId":"documents_save_url","summary":"Save URL for background caching","description":"Creates a pending Document in the active Space and enqueues background caching.","x-almetia-scope":"documents:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/documents/triage":{"patch":{"operationId":"documents_triage","summary":"Triage Document or promote to Second Brain","description":"Updates readingStatus and brainStatus independently, enrolling Highlights into recall when promoted to evergreen.","x-almetia-scope":"documents:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/ingestion/readwise":{"post":{"operationId":"ingestion_import_readwise","summary":"Import Readwise export archive","description":"Idempotently imports Readwise v2 JSON, Readwise CSV, or Reader v3 JSON into the active Space.","x-almetia-scope":"documents:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/ingestion/kindle-clippings":{"post":{"operationId":"ingestion_import_kindle_clippings","summary":"Import Kindle My Clippings.txt","description":"Parses and idempotently imports Highlights and notes from a Kindle My Clippings.txt file.","x-almetia-scope":"documents:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/ingestion/kindle-cloud":{"post":{"operationId":"ingestion_import_kindle_cloud","summary":"Import Kindle Cloud Notebook HTML","description":"Parses and idempotently imports Highlights from a local Kindle Cloud notebook HTML capture.","x-almetia-scope":"documents:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/ingestion/apple-books":{"post":{"operationId":"ingestion_import_apple_books","summary":"Import Apple Books annotations","description":"Idempotently imports Apple Books highlights and notes extracted from macOS Books SQLite databases.","x-almetia-scope":"documents:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/ingestion/kobo":{"post":{"operationId":"ingestion_import_kobo","summary":"Import Kobo bookmarks","description":"Idempotently imports Kobo Reader highlights and annotations extracted from KoboReader.sqlite.","x-almetia-scope":"documents:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/ingestion/newsletter":{"post":{"operationId":"ingestion_import_newsletter","summary":"Import newsletter issue","description":"Cleans and imports an HTML or plain-text newsletter into the Triage Inbox without auto-enrolling recall.","x-almetia-scope":"documents:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/highlights":{"post":{"operationId":"highlights_create","summary":"Create a Highlight on a Document","description":"Saves a Highlight, indexes it for hybrid search, and enrolls a Recall Card when the Document is evergreen.","x-almetia-scope":"highlights:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}},"get":{"operationId":"highlights_list","summary":"List Highlights","description":"Lists Highlights in the active Space, optionally filtered by documentId.","x-almetia-scope":"highlights:read","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/notes":{"post":{"operationId":"notes_upsert","summary":"Create or update an Evergreen Note","description":"Upserts an Evergreen Note by slug, indexes its Markdown for hybrid search, and saves knowledge links.","x-almetia-scope":"brain:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}},"get":{"operationId":"notes_list","summary":"List Evergreen Notes","description":"Lists Evergreen Notes in the active Space.","x-almetia-scope":"brain:read","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/recall/daily":{"get":{"operationId":"recall_daily_get","summary":"Get Daily Recall Queue","description":"Returns due passive and active FSRS Recall Cards in the active Space, excluding muted and non-evergreen items.","x-almetia-scope":"recall:read","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/recall/review":{"post":{"operationId":"recall_submit_review","summary":"Submit Recall Card Review","description":"Grades a Recall Card (1=Again, 2=Hard, 3=Good, 4=Easy), advances FSRS schedule, and records an immutable Review Log.","x-almetia-scope":"recall:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/recall/upgrade":{"post":{"operationId":"recall_upgrade_to_active_card","summary":"Upgrade Highlight to Active Recall Card","description":"Creates an active Cloze or Q&A Recall Card from a Highlight, drafting front and back with AI when omitted.","x-almetia-scope":"recall:write","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/brain/search":{"get":{"operationId":"brain_search","summary":"Hybrid Search Second Brain","description":"Searches Evergreen Documents, Highlights, and Notes with Postgres FTS and pgvector Reciprocal Rank Fusion. Pass scope=all to include unread inbox items.","x-almetia-scope":"brain:read","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/brain/related-highlights":{"get":{"operationId":"brain_related_highlights","summary":"Find related Evergreen Highlights for a Document","description":"Surfaces related Kindle, Apple Books, Kobo, and Evergreen Highlights from other Documents while reading.","x-almetia-scope":"brain:read","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/brain/ghostreader":{"post":{"operationId":"brain_ghostreader","summary":"Ask Ghostreader for structured synthesis cards","description":"Synthesizes the active Document and related Evergreen Highlights into a validated @json-render/react card Spec.","x-almetia-scope":"brain:read","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}},"/sync/pull":{"get":{"operationId":"sync_pull","summary":"Pull Space Sync Delta","description":"Returns monotonic sync_seq deltas for Documents, Snapshots, Highlights, Recall Cards, and Notes since sinceSeq.","x-almetia-scope":"space:read","responses":{"200":{"description":"Success"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limited"},"500":{"description":"Internal server error"}}}}}}