Trilium PowerShell Module Docs
This module provides functions to interact with Trilium ETAPI to automate tasks, and manage your notes.
Trilium is an advanced hierarchical note-taking application. Learn more at Trilium on GitHub.
✨ Features
This module enables you to:
- Connect and disconnect from your TriliumNext instance
- Search, create, update, and delete notes
- Export and import notes as ZIP files
- Manage note attributes, branches, and attachments
- Create notes by day, week, month, year, and inbox
- Backup your Trilium instance
- Update note order and details
- Create note using Markdown content
- Upload files as note attachments and create notes from files
- Retrieve application info and root note details
- And more!
🗂️ API Endpoints and Functions
| Method | Endpoint | Function | Notes |
|---|---|---|---|
| POST | /create-note | New-TriliumNote | Create a new note |
| GET | /notes | Find-TriliumNote | Search for notes |
| GET | /notes/{noteId} | Get-TriliumNoteDetails | Get note details |
| PATCH | /notes/{noteId} | Set-TriliumNoteDetails | Update note details (PATCH) |
| DELETE | /notes/{noteId} | Remove-TriliumNote | Delete a note |
| GET | /notes/{noteId}/content | Get-TriliumNoteContent | Get note content |
| PUT | /notes/{noteId}/content | Set-TriliumNoteContent | Update note content |
| GET | /notes/{noteId}/export | Export-TriliumNote | Export note(s) as zip (HTML/Markdown) |
| POST | /notes/{noteId}/import | Import-TriliumNoteZip | Import notes from ZIP |
| POST | /notes/{noteId}/revision | New-TriliumNoteRevision | Create a new note revision |
| POST | /branches | Copy-TriliumNote | Copy a note to a new branch |
| GET | /branches/{branchId} | Get-TriliumBranch | Get branch details |
| PATCH | /branches/{branchId} | Set-TriliumBranch | Update branch prefix and/or note position (PATCH) |
| DELETE | /branches/{branchId} | Remove-TriliumBranch | Delete a branch |
| POST | /attachments | New-TriliumAttachment | Create a new attachment for a note |
| GET | /attachments/{attachmentId} | Get-TriliumAttachment | Get attachment metadata |
| PATCH | /attachments/{attachmentId} | Set-TriliumAttachment | Update attachment properties (role, mime, title, position) |
| DELETE | /attachments/{attachmentId} | Remove-TriliumAttachment | Delete an attachment |
| GET | /attachments/{attachmentId}/content | Get-TriliumAttachmentContent | Download attachment content |
| PUT | /attachments/{attachmentId}/content | New-TriliumNoteFile | Create a new note from a local file (uploads file content) |
| N/A | N/A | Format-TriliumHtml | Helper function to beautify HTML content with improved header spacing and code block formatting |
| POST | /attributes | New-TriliumAttribute | Create a new attribute |
| GET | /attributes/{attributeId} | Get-TriliumAttribute | Get attribute details |
| PATCH | /attributes/{attributeId} | Set-TriliumAttribute | Update attribute properties |
| DELETE | /attributes/{attributeId} | Remove-TriliumAttribute | Delete an attribute |
| POST | /refresh-note-ordering/{parentNoteId} | Update-TriliumNoteOrder | Refresh note ordering |
| GET | /inbox/{date} | Get-TriliumInbox | Get or create inbox note for a date |
| GET | /calendar/days/{date} | Get-TriliumDayNote | Get or create day note for a date |
| GET | /calendar/weeks/{date} | Get-TriliumWeekNote | (Broken: appears to be a bug in Trilium) |
| GET | /calendar/months/{month} | Get-TriliumMonthNote | Get or create month note for a month |
| GET | /calendar/years/{year} | Get-TriliumYearNote | Get or create year note for a year |
| POST | /auth/login | Connect-TriliumAuth | Authenticate to Trilium (now uses 'Bearer' for ETAPI) |
| POST | /auth/logout | Disconnect-TriliumAuth | Logout from Trilium |
| GET | /app-info | Get-TriliumInfo | Get Trilium server info |
| PUT | /backup/{backupName} | New-TriliumBackup | Create a new backup |
| GET | /notes/root | Get-TriliumRootNote | Get root note details (requires Connect-TriliumAuth, no params; every root note has id 'root'). |
| GET | /notes/{noteId}/attachments | Get-TriliumNoteAttachment | Retrieves attachments for a specific note (Undocumented API) |
📦 Installation
To install the module, run:
Install-PSResource Trilium -Scope CurrentUser
📥 Importing the Module
After installation, import the module with:
Import-Module Trilium