Documents

Documents

Documents are markdown notes you own. They support folder organisation, full-text search, image embedding, templates, and a delta-sync mechanism for offline-capable clients. All document-creation endpoints require a subscription.

For organising documents into folders, see Document Folders.

Endpoint table

MethodPathAuthDescription
GET/api/documentsSession or BearerList root-level documents (folderId is null), ordered by relativePath.
POST/api/documentsSession or BearerCreate a root-level document. Subscriber only.
GET/api/documents/:idSession or BearerGet a document. Owner sees everything; public documents are readable by anyone authenticated.
PUT/api/documents/:idSession or BearerUpdate a document (title, content, isPublic, folderId).
DELETE/api/documents/:idSession or BearerSoft-delete; cascades blob image cleanup.
GET/api/documents/searchSession or BearerFull-text search of your own documents.
GET/api/documents/syncSession or BearerDelta sync (pass ?lastSyncAt=<ISO> for incremental).
POST/api/documents/syncSession or BearerBatch apply create/update/delete operations in one request.
POST/api/documents/:id/images/uploadSession or BearerUpload an image to embed in a document. Subscriber only.
GET/api/documents/templatesSession or BearerList document templates.
POST/api/documents/templates/seed-defaultsSession or BearerSeed your account with the default starter templates.
POST/api/documents/from-templateSession or BearerCreate a document from a template. Subscriber only.

Creating a document

POST /api/documents
Content-Type: application/json

{
  "title": "API Integration Notes",
  "content": "# Notes\n\nHere are my integration notes...",
  "isPublic": false
}

Response (201):

{
  "id": "doc_qrs001",
  "title": "API Integration Notes",
  "content": "# Notes\n\nHere are my integration notes...",
  "isPublic": false,
  "folderId": null,
  "relativePath": "api-integration-notes.md",
  "createdAt": "2025-06-11T09:00:00.000Z",
  "updatedAt": "2025-06-11T09:00:00.000Z"
}

relativePath is auto-generated from title if omitted. A content hash (contentHash) is computed server-side and used by the delta-sync engine.

Delta sync

Delta sync is the efficient way to keep a local copy up to date. On first run, omit lastSyncAt to fetch everything. On subsequent runs, pass the timestamp returned by the previous sync:

GET /api/documents/sync?lastSyncAt=2025-06-10T00:00:00.000Z
Authorization: Bearer il_tok_...
{
  "syncedAt": "2025-06-11T09:15:00.000Z",
  "folders": [ ... ],
  "documents": [
    { "id": "doc_qrs001", "title": "API Integration Notes", "updatedAt": "2025-06-11T09:00:00.000Z", "deleted": false }
  ]
}

Documents with "deleted": true should be removed from the local copy. Use the returned syncedAt as the next lastSyncAt.

The POST /api/documents/sync form accepts a batch of operations (create/update/delete) and applies them atomically — useful for two-way sync clients pushing local edits.

Search

GET /api/documents/search?q=integration&limit=20

Searches across title and content. Only your own documents are searched.

Templates

GET /api/documents/templates                   # list available templates
POST /api/documents/templates/seed-defaults    # add the defaults to your account
POST /api/documents/from-template              # create a document from a template
Content-Type: application/json

{ "templateId": "tpl_default_meeting_notes", "title": "Standup 2026-06-23", "folderId": null }

Image uploads

POST /api/documents/doc_qrs001/images/upload
Content-Type: multipart/form-data

file=<binary>

Returns the uploaded image URL. Embed it in markdown with ![alt](url). Soft-deleting the document cascades the cleanup of these blob images.