Portable-Notes

PeaNote API Reference

Generated by python scripts/generate_api_docs.py from api/routes.py. Do not edit this file by hand. Runtime version: 3.11.0.

The server binds to 127.0.0.1 on a free local port (8765 when available). The active URL is in data/server.json and printed by start.bat status / ./start.sh status. All paths are local. Mutating routes require a same-origin Origin/Referer and application/json except /api/attachment/upload, which accepts a raw body under the same origin guard.

Endpoint index

Method Path Category Read-only Purpose
GET / System yes App shell; debug.html when ?debug=1
GET /index.html System yes Alias of /
GET /static/<file> System yes Allowlisted static asset under static/
GET /companion System yes Read-only phone companion app shell
GET /manifest.webmanifest System yes Companion install manifest
GET /sw.js System yes Companion offline shell service worker
GET /icon.svg System yes Companion PWA icon
GET /api/health System yes App identity, live URL/port, optional LAN companion URL, version, vault path, and note count
GET /api/diagnostics System yes Request timings and reindex lifecycle
GET /api/reindex System yes Poll a background reindex job
GET /api/routes System yes This route registry and its contracts
GET /api/onboarding System yes Local first-run state
GET /api/notes Notes yes Paged note list with filters
GET /api/search Notes yes FTS5 search with LIKE fallback
GET /api/search/semantic Notes yes Optional local semantic search via loopback Ollama
GET /api/settings/semantic Notes yes Local semantic settings and cache statistics
POST /api/search/semantic/index Notes no Build or refresh the local embedding cache
POST /api/settings/semantic Notes no Update allowlisted local semantic settings
GET /api/mentions Notes yes Notes mentioning a title without linking it
GET /api/duplicates Notes yes Groups of effectively identical note bodies
GET /api/note Notes yes One note by vault-relative path
GET /api/tree Notes yes Folder tree entries
GET /api/backlinks Notes yes Notes linking to a title
GET /api/orphans Notes yes Attachment files no note references
GET /api/graph Notes yes Capped graph nodes and edges
GET /api/templates Notes yes Templates/*.md contents
GET /api/attachment Notes yes Read an attachment by path
GET /Attachments/<name> Notes yes Vault-relative Markdown image link
GET /api/export Notes yes Versioned vault ZIP
GET /api/export/markdown Notes yes One-file Markdown bundle
GET /api/tasks Tasks yes Flat task list with filters
GET /api/task-dashboard Tasks yes Task summary by project
GET /api/task-calendar Tasks yes Due tasks in a date range
GET /api/task-board Tasks yes Kanban lanes for open tasks
GET /api/task-focus Tasks yes Today’s priority tasks
GET /api/task-review Tasks yes Weekly review summary
GET /api/task-stats Tasks yes Task statistics
GET /api/task-project Tasks yes Project rollup
GET /api/task-timeline Tasks yes Task timeline
GET /api/task-milestones Tasks yes Milestone list
GET /api/task-milestone-board Tasks yes Milestone board
GET /api/task-dependencies Tasks yes Dependency graph
GET /api/task-critical-path Tasks yes Critical path
GET /api/task-risk Tasks yes Risk radar
GET /api/task-workload Tasks yes Workload by project
GET /api/task-capacity Tasks yes Capacity report
GET /api/task-burndown Tasks yes Burndown series
GET /api/task-forecast Tasks yes Completion forecast
GET /api/task-schedule Tasks yes Schedule plan
GET /api/task-slippage Tasks yes Slippage report
GET /api/task-baseline-health Tasks yes Baseline health
GET /api/task-quality Tasks yes Metadata quality
GET /api/task-readiness Tasks yes Execution readiness
GET /api/task-projects Tasks yes Project names
GET /api/history Recovery yes History snapshots for a note
GET /api/history/item Recovery yes One snapshot’s full text
GET /api/history/diff Recovery yes Segment and aligned-row diff
GET /api/trash Recovery yes Search/sort trashed notes
GET /api/settings/trash Recovery yes Trash retention policy
GET /api/settings/backup Recovery yes Backup policy and manifests
GET /api/backups Recovery yes Backup manifests
GET /api/integrity Recovery yes Read-only vault health report
GET /api/migrations Recovery yes Read-only migration dry-run plan
GET /api/sync Recovery yes Read-only external-change ledger and snapshots
POST /api/onboarding System no Update local onboarding state
POST /api/reindex System no Start a background reindex job
POST /api/rebuild System no Rebuild the SQLite index synchronously
POST /api/capture Notes no Capture text into Inbox
POST /api/inbox/scan Notes no Import files from the local drop folder
POST /api/note Notes no Create a note
POST /api/voice/transcribe Notes no Fill a voice note transcript with a local CLI
PUT /api/note Notes no Update or rename a note
DELETE /api/note Notes no Move a note to the internal trash
POST /api/folder Notes no Create a folder
POST /api/attachment/upload Notes no Upload an attachment (<= 25 MB)
POST /api/task/toggle Tasks no Toggle a task line in a note
POST /api/trash/restore Recovery no Bulk restore trashed notes
POST /api/trash/delete Recovery no Permanently delete selected trashed notes
POST /api/trash/empty Recovery no Permanently empty the trash
POST /api/settings/trash Recovery no Update trash retention policy
POST /api/settings/backup Recovery no Update backup policy
POST /api/backup Recovery no Create and verify a local ZIP backup
POST /api/history/label Recovery no Label or unlabel a snapshot
POST /api/history/restore Recovery no Restore a snapshot into a new note
POST /api/migrations Recovery no Plan, apply, or roll back migrations
POST /api/shutdown System no Stop the local server after replying

Contracts

System

GET /

App shell; debug.html when ?debug=1 (read-only)

Request (query):

Field Type Required Description
debug str no 1 selects the diagnostics view

Response: text/html

curl -X GET "http://127.0.0.1:<port>/?debug=..."

GET /index.html

Alias of / (read-only)

Request (query):

Field Type Required Description
debug str no  

Response: text/html

curl -X GET "http://127.0.0.1:<port>/index.html?debug=..."

GET /static/<file>

Allowlisted static asset under static/ (read-only)

Request (path):

Field Type Required Description
file str yes  

Response: static asset

curl -X GET "http://127.0.0.1:<port>/static/<file>"

GET /companion

Read-only phone companion app shell (read-only)

Request: none — no fields.

Response: text/html

curl -X GET "http://127.0.0.1:<port>/companion"

GET /manifest.webmanifest

Companion install manifest (read-only)

Request: none — no fields.

Response: application/manifest+json

curl -X GET "http://127.0.0.1:<port>/manifest.webmanifest"

GET /sw.js

Companion offline shell service worker (read-only)

Request: none — no fields.

Response: application/javascript

curl -X GET "http://127.0.0.1:<port>/sw.js"

GET /icon.svg

Companion PWA icon (read-only)

Request: none — no fields.

Response: image/svg+xml

curl -X GET "http://127.0.0.1:<port>/icon.svg"

GET /api/health

App identity, live URL/port, optional LAN companion URL, version, vault path, and note count (read-only)

Request: none — no fields.

Response: Health

curl -X GET "http://127.0.0.1:<port>/api/health"

GET /api/diagnostics

Request timings and reindex lifecycle (read-only)

Request (query):

Field Type Required Description
debug str no  

Response: Diagnostics

curl -X GET "http://127.0.0.1:<port>/api/diagnostics?debug=..."

GET /api/reindex

Poll a background reindex job (read-only)

Request (query):

Field Type Required Description
job str no  

Response: ReindexStatus

curl -X GET "http://127.0.0.1:<port>/api/reindex?job=..."

GET /api/routes

This route registry and its contracts (read-only)

Request: none — no fields.

Response: RouteRegistry

curl -X GET "http://127.0.0.1:<port>/api/routes"

GET /api/onboarding

Local first-run state (read-only)

Request: none — no fields.

Response: Onboarding

curl -X GET "http://127.0.0.1:<port>/api/onboarding"

POST /api/onboarding

Update local onboarding state (mutation)

Request (json):

Field Type Required Description
dismissed bool no  
shortcuts_seen bool no  
first_note_at str no  

Response: Onboarding

curl -X POST "http://127.0.0.1:<port>/api/onboarding" -H 'Content-Type: application/json' -d '{}'

POST /api/reindex

Start a background reindex job (mutation)

Request: none — no fields.

Response: ReindexJob

curl -X POST "http://127.0.0.1:<port>/api/reindex"

POST /api/rebuild

Rebuild the SQLite index synchronously (mutation)

Request: none — no fields.

Response: RebuildResult

curl -X POST "http://127.0.0.1:<port>/api/rebuild"

POST /api/shutdown

Stop the local server after replying (mutation)

Request: json — no fields.

Response: Ok

curl -X POST "http://127.0.0.1:<port>/api/shutdown" -H 'Content-Type: application/json' -d '{}'

Notes

GET /api/notes

Paged note list with filters (read-only)

Request (query):

Field Type Required Description
q str no  
folder str no  
favorite bool no  
limit int no  
offset int no  
preview int no  

Response: Note[]

curl -X GET "http://127.0.0.1:<port>/api/notes?q=...&folder=...&favorite=True"

GET /api/search

FTS5 search with LIKE fallback (read-only)

Request (query):

Field Type Required Description
q str no  
folder str no  
tag str no  
limit int no  
offset int no  
preview int no  

Response: Note[]

curl -X GET "http://127.0.0.1:<port>/api/search?q=...&folder=...&tag=..."

GET /api/search/semantic

Optional local semantic search via loopback Ollama (read-only)

Request (query):

Field Type Required Description
q str yes  
limit int no  
offset int no  
preview int no  

Response: Note[]

curl -X GET "http://127.0.0.1:<port>/api/search/semantic?q=...&limit=1&offset=1"

GET /api/settings/semantic

Local semantic settings and cache statistics (read-only)

Request: none — no fields.

Response: SemanticSettings

curl -X GET "http://127.0.0.1:<port>/api/settings/semantic"

POST /api/search/semantic/index

Build or refresh the local embedding cache (mutation)

Request: none — no fields.

Response: SemanticIndexResult

curl -X POST "http://127.0.0.1:<port>/api/search/semantic/index"

POST /api/settings/semantic

Update allowlisted local semantic settings (mutation)

Request (json):

Field Type Required Description
enabled bool no  
model str no  
url str no  

Response: SemanticSettings

curl -X POST "http://127.0.0.1:<port>/api/settings/semantic" -H 'Content-Type: application/json' -d '{}'

GET /api/mentions

Notes mentioning a title without linking it (read-only)

Request (query):

Field Type Required Description
title str yes  

Response: Note[]

curl -X GET "http://127.0.0.1:<port>/api/mentions?title=..."

GET /api/duplicates

Groups of effectively identical note bodies (read-only)

Request: none — no fields.

Response: DuplicateGroup[]

curl -X GET "http://127.0.0.1:<port>/api/duplicates"

GET /api/note

One note by vault-relative path (read-only)

Request (query):

Field Type Required Description
path str yes  

Response: Note

curl -X GET "http://127.0.0.1:<port>/api/note?path=..."

GET /api/tree

Folder tree entries (read-only)

Request: none — no fields.

Response: TreeItem[]

curl -X GET "http://127.0.0.1:<port>/api/tree"

Notes linking to a title (read-only)

Request (query):

Field Type Required Description
title str yes  

Response: Note[]

curl -X GET "http://127.0.0.1:<port>/api/backlinks?title=..."

GET /api/orphans

Attachment files no note references (read-only)

Request: none — no fields.

Response: str[]

curl -X GET "http://127.0.0.1:<port>/api/orphans"

GET /api/graph

Capped graph nodes and edges (read-only)

Request (query):

Field Type Required Description
filter str no  

Response: Graph

curl -X GET "http://127.0.0.1:<port>/api/graph?filter=..."

GET /api/templates

Templates/*.md contents (read-only)

Request: none — no fields.

Response: Template[]

curl -X GET "http://127.0.0.1:<port>/api/templates"

GET /api/attachment

Read an attachment by path (read-only)

Request (query):

Field Type Required Description
path str yes  

Response: binary

curl -X GET "http://127.0.0.1:<port>/api/attachment?path=..."

GET /Attachments/<name>

Vault-relative Markdown image link (read-only)

Request (path):

Field Type Required Description
name str yes  

Response: binary

curl -X GET "http://127.0.0.1:<port>/Attachments/<name>"

GET /api/export

Versioned vault ZIP (read-only)

Request: binary — no fields.

Response: application/zip

curl -X GET "http://127.0.0.1:<port>/api/export"

GET /api/export/markdown

One-file Markdown bundle (read-only)

Request: none — no fields.

Response: text/markdown

curl -X GET "http://127.0.0.1:<port>/api/export/markdown"

POST /api/capture

Capture text into Inbox (mutation)

Request (json):

Field Type Required Description
text str no  
title str no  
folder str no  
tags list[str] no  

Response: Note

curl -X POST "http://127.0.0.1:<port>/api/capture" -H 'Content-Type: application/json' -d '{}'

POST /api/inbox/scan

Import files from the local drop folder (mutation)

Request (json):

Field Type Required Description
limit int no  

Response: ScanResult

curl -X POST "http://127.0.0.1:<port>/api/inbox/scan" -H 'Content-Type: application/json' -d '{}'

POST /api/note

Create a note (mutation)

Request (json):

Field Type Required Description
title str no  
folder str no  
content str no  
tags list[str] no  

Response: Note

curl -X POST "http://127.0.0.1:<port>/api/note" -H 'Content-Type: application/json' -d '{}'

POST /api/voice/transcribe

Fill a voice note transcript with a local CLI (mutation)

Request (json):

Field Type Required Description
path str yes  
audio str yes  
expected_updated str no  
expected_sha str no Reject with 409 if disk body changed

Response: Note

curl -X POST "http://127.0.0.1:<port>/api/voice/transcribe" -H 'Content-Type: application/json' -d '{"path": "...", "audio": "..."}'

PUT /api/note

Update or rename a note (mutation)

Request (json):

Field Type Required Description
path str yes  
title str no  
folder str no  
content str no  
tags list[str] no  
favorite bool no  
pinned bool no  
expected_updated str no  
expected_sha str no Reject with 409 if disk body changed

Response: Note

curl -X PUT "http://127.0.0.1:<port>/api/note" -H 'Content-Type: application/json' -d '{"path": "..."}'

DELETE /api/note

Move a note to the internal trash (mutation)

Request (query):

Field Type Required Description
path str yes  

Response: DeleteResult

curl -X DELETE "http://127.0.0.1:<port>/api/note?path=..."

POST /api/folder

Create a folder (mutation)

Request (json):

Field Type Required Description
path str yes  

Response: Ok

curl -X POST "http://127.0.0.1:<port>/api/folder" -H 'Content-Type: application/json' -d '{"path": "..."}'

POST /api/attachment/upload

Upload an attachment (<= 25 MB) (mutation)

Request: binary — no fields.

Response: UploadResult

curl -X POST "http://127.0.0.1:<port>/api/attachment/upload"

Tasks

GET /api/tasks

Flat task list with filters (read-only)

Request (query):

Field Type Required Description
status str no  
project str no  
priority str no  

Response: Task[]

curl -X GET "http://127.0.0.1:<port>/api/tasks?status=...&project=...&priority=..."

GET /api/task-dashboard

Task summary by project (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-dashboard"

GET /api/task-calendar

Due tasks in a date range (read-only)

Request (query):

Field Type Required Description
start str no  
end str no  

Response: Task[]

curl -X GET "http://127.0.0.1:<port>/api/task-calendar?start=...&end=..."

GET /api/task-board

Kanban lanes for open tasks (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-board"

GET /api/task-focus

Today’s priority tasks (read-only)

Request: none — no fields.

Response: Task[]

curl -X GET "http://127.0.0.1:<port>/api/task-focus"

GET /api/task-review

Weekly review summary (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-review"

GET /api/task-stats

Task statistics (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-stats"

GET /api/task-project

Project rollup (read-only)

Request (query):

Field Type Required Description
project str no  

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-project?project=..."

GET /api/task-timeline

Task timeline (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-timeline"

GET /api/task-milestones

Milestone list (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-milestones"

GET /api/task-milestone-board

Milestone board (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-milestone-board"

GET /api/task-dependencies

Dependency graph (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-dependencies"

GET /api/task-critical-path

Critical path (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-critical-path"

GET /api/task-risk

Risk radar (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-risk"

GET /api/task-workload

Workload by project (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-workload"

GET /api/task-capacity

Capacity report (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-capacity"

GET /api/task-burndown

Burndown series (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-burndown"

GET /api/task-forecast

Completion forecast (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-forecast"

GET /api/task-schedule

Schedule plan (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-schedule"

GET /api/task-slippage

Slippage report (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-slippage"

GET /api/task-baseline-health

Baseline health (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-baseline-health"

GET /api/task-quality

Metadata quality (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-quality"

GET /api/task-readiness

Execution readiness (read-only)

Request: none — no fields.

Response: Report

curl -X GET "http://127.0.0.1:<port>/api/task-readiness"

GET /api/task-projects

Project names (read-only)

Request: none — no fields.

Response: str[]

curl -X GET "http://127.0.0.1:<port>/api/task-projects"

POST /api/task/toggle

Toggle a task line in a note (mutation)

Request (json):

Field Type Required Description
path str yes  
line int yes  
expected_updated str no  
expected_sha str no  

Response: ToggleResult

curl -X POST "http://127.0.0.1:<port>/api/task/toggle" -H 'Content-Type: application/json' -d '{"path": "...", "line": 1}'

Recovery

GET /api/history

History snapshots for a note (read-only)

Request (query):

Field Type Required Description
path str yes  

Response: HistoryItem[]

curl -X GET "http://127.0.0.1:<port>/api/history?path=..."

GET /api/history/item

One snapshot’s full text (read-only)

Request (query):

Field Type Required Description
path str yes  
id str yes  

Response: HistoryContent

curl -X GET "http://127.0.0.1:<port>/api/history/item?path=...&id=..."

GET /api/history/diff

Segment and aligned-row diff (read-only)

Request (query):

Field Type Required Description
path str yes  
id1 str yes  
id2 str yes  

Response: Diff

curl -X GET "http://127.0.0.1:<port>/api/history/diff?path=...&id1=...&id2=..."

GET /api/trash

Search/sort trashed notes (read-only)

Request (query):

Field Type Required Description
q str no  
sort str no  

Response: TrashItem[]

curl -X GET "http://127.0.0.1:<port>/api/trash?q=...&sort=..."

GET /api/settings/trash

Trash retention policy (read-only)

Request: none — no fields.

Response: TrashSettings

curl -X GET "http://127.0.0.1:<port>/api/settings/trash"

GET /api/settings/backup

Backup policy and manifests (read-only)

Request: none — no fields.

Response: BackupSettings

curl -X GET "http://127.0.0.1:<port>/api/settings/backup"

GET /api/backups

Backup manifests (read-only)

Request: none — no fields.

Response: BackupInfo[]

curl -X GET "http://127.0.0.1:<port>/api/backups"

GET /api/integrity

Read-only vault health report (read-only)

Request: none — no fields.

Response: IntegrityReport

curl -X GET "http://127.0.0.1:<port>/api/integrity"

GET /api/migrations

Read-only migration dry-run plan (read-only)

Request: none — no fields.

Response: MigrationPlan

curl -X GET "http://127.0.0.1:<port>/api/migrations"

GET /api/sync

Read-only external-change ledger and snapshots (read-only)

Request: none — no fields.

Response: SyncStatus

curl -X GET "http://127.0.0.1:<port>/api/sync"

POST /api/trash/restore

Bulk restore trashed notes (mutation)

Request (json):

Field Type Required Description
names list[str] yes  

Response: RestoreResult

curl -X POST "http://127.0.0.1:<port>/api/trash/restore" -H 'Content-Type: application/json' -d '{"names": []}'

POST /api/trash/delete

Permanently delete selected trashed notes (mutation)

Request (json):

Field Type Required Description
names list[str] yes  

Response: DeleteResult

curl -X POST "http://127.0.0.1:<port>/api/trash/delete" -H 'Content-Type: application/json' -d '{"names": []}'

POST /api/trash/empty

Permanently empty the trash (mutation)

Request: json — no fields.

Response: EmptyResult

curl -X POST "http://127.0.0.1:<port>/api/trash/empty" -H 'Content-Type: application/json' -d '{}'

POST /api/settings/trash

Update trash retention policy (mutation)

Request (json):

Field Type Required Description
auto_empty bool no  
retention_days int no  

Response: TrashSettings

curl -X POST "http://127.0.0.1:<port>/api/settings/trash" -H 'Content-Type: application/json' -d '{}'

POST /api/settings/backup

Update backup policy (mutation)

Request (json):

Field Type Required Description
auto_backup bool no  
interval_hours int no  
retention int no  

Response: BackupSettings

curl -X POST "http://127.0.0.1:<port>/api/settings/backup" -H 'Content-Type: application/json' -d '{}'

POST /api/backup

Create and verify a local ZIP backup (mutation)

Request (json):

Field Type Required Description
label str no  

Response: BackupResult

curl -X POST "http://127.0.0.1:<port>/api/backup" -H 'Content-Type: application/json' -d '{}'

POST /api/history/label

Label or unlabel a snapshot (mutation)

Request (json):

Field Type Required Description
path str yes  
id str yes  
label str no  

Response: LabelResult

curl -X POST "http://127.0.0.1:<port>/api/history/label" -H 'Content-Type: application/json' -d '{"path": "...", "id": "..."}'

POST /api/history/restore

Restore a snapshot into a new note (mutation)

Request (json):

Field Type Required Description
path str yes  
id str yes  
title str no  
folder str no  

Response: Note

curl -X POST "http://127.0.0.1:<port>/api/history/restore" -H 'Content-Type: application/json' -d '{"path": "...", "id": "..."}'

POST /api/migrations

Plan, apply, or roll back migrations (mutation)

Request (json):

Field Type Required Description
action str yes  
dry_run bool no  
token str no  

Response: MigrationResult

curl -X POST "http://127.0.0.1:<port>/api/migrations" -H 'Content-Type: application/json' -d '{"action": "..."}'