APIs
Internal API#
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 note
Tree Operations:
GET /api/tree- Get note treePOST /api/branches- Create branchPUT /api/branches/:branchId- Update branchDELETE /api/branches/:branchId- Delete branch
Search:
GET /api/search?query=...- Search notesGET /api/search-note/:noteId- Execute search note
ETAPI (External API)#
Located 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 handling
Example:
curl -H "Authorization: YOUR_TOKEN" \
https://trilium.example.com/etapi/notes/noteIdWebSocket API#
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 UI
Client Subscribe:
ws.subscribe('entity-change', (data) => {
froca.processEntityChange(data)
})