docs/Developer Guide/Developer Guide/Architecture/APIs.md
REST Endpoints (/api/*)
Used by the frontend for all operations:
Note Operations:
GET /api/notes/:noteId - Get notePOST /api/notes/:noteId/content - Update contentPUT /api/notes/:noteId - Update metadataDELETE /api/notes/:noteId - Delete noteTree Operations:
GET /api/tree - Get note treePOST /api/branches - Create branchPUT /api/branches/:branchId - Update branchDELETE /api/branches/:branchId - Delete branchSearch:
GET /api/search?query=... - Search notesGET /api/search-note/:noteId - Execute search noteLocated at: apps/server/src/etapi/
Purpose: Third-party integrations and automation
Authentication: Token-based (ETAPI tokens)
OpenAPI Spec: Auto-generated
Key Endpoints:
/etapi/notes - Note CRUD/etapi/branches - Branch management/etapi/attributes - Attribute operations/etapi/attachments - Attachment handlingExample:
curl -H "Authorization: YOUR_TOKEN" \
https://trilium.example.com/etapi/notes/noteId
Located at: apps/server/src/services/ws.ts
Purpose: Real-time updates and synchronization
Protocol: WebSocket (Socket.IO-like custom protocol)
Message Types:
sync - Synchronization requestentity-change - Entity update notificationrefresh-tree - Tree structure changedopen-note - Open note in UIClient Subscribe:
ws.subscribe('entity-change', (data) => {
froca.processEntityChange(data)
})