๐Ÿš€ Trilium PowerShell Module

October 11, 2025 ยท View on GitHub

PowerShell Gallery Version Downloads PSGallery Quality
Trilium Notes
License: MIT

Manage your Trilium Notes instance via PowerShell using the ETAPI


๐Ÿฆพ Description

Trilium is a PowerShell module that enables you to interact with your Trilium server programmatically. It provides functions to:

  • Authenticate and manage sessions
  • Search and manage notes
  • Export and import notes
  • Manage note attributes and branches
  • And more!

๐Ÿ›  Requirements

  • PowerShell 7 or higher
  • Trilium instance with ETAPI enabled
  • HTTP(S) access to your Trilium server

๐Ÿ“ฆ Installation

Install from the PowerShell Gallery:

Install-PSResource -Name Trilium -Scope CurrentUser

๐Ÿ” Authentication

All functions require 1 time authentication 1st. Use a PSCredential object to store the password or ETAPI token. Username does not matter but required for Get-Credential. We only use the stored password.

๐Ÿ” Authenticate with Password

Authenticate using your Trilium username and password:

Tip

Since Trilium doesn't need a username, anything will do.

$creds = Get-Credential -UserName 'admin'
Connect-TriliumAuth -BaseUrl "https://trilium.myDomain.net" -Password $creds
appVersion             : 0.96.0
dbVersion              : 232
nodeVersion            : v22.17.0
syncVersion            : 36
buildDate              : 6/7/2025 9:45:40 AM
buildRevision          : 7cbff47078012e32279c110c49b904bd24dcecb3
dataDirectory          : /home/node/trilium-data
clipperProtocolVersion : 1.0
utcDateTime            : 7/4/2025 4:07:48 AM

Tip

This output confirms successful connection and shows server environment details.

๐Ÿ” Authenticate with ETAPI Token

Authenticate using your ETAPI token (enter token as password):

Tip

Since Trilium doesn't need a username, anything will do.

$token = Get-Credential -UserName 'admin' # Enter your ETAPI token as the password
Connect-TriliumAuth -BaseUrl "https://trilium.myDomain.net" -EtapiToken $token

โš ๏ธ Skip Certificate Check (Self-Signed Certs)

If your Trilium instance uses a self-signed certificate, you can skip certificate validation with any cmdlet using -SkipCertCheck:

Connect-TriliumAuth -BaseUrl "https://trilium.myDomain.net" -Password $creds -SkipCertCheck

Tip

All Trilium module cmdlets support the -SkipCertCheck parameter for self-signed certificates.

Warning

Ensure your BaseUrl is correct and accessible. Use -SkipCertCheck only if you trust the server.


๐Ÿ—‚๏ธ API Endpoints and Functions

MethodEndpointFunctionNotes
POST/create-noteNew-TriliumNoteCreate a new note
GET/notesFind-TriliumNoteSearch for notes
GET/notes/{noteId}Get-TriliumNoteDetailsGet note details
PATCH/notes/{noteId}Set-TriliumNoteDetailsUpdate note details (PATCH)
DELETE/notes/{noteId}Remove-TriliumNoteDelete a note
GET/notes/{noteId}/contentGet-TriliumNoteContentGet note content
PUT/notes/{noteId}/contentSet-TriliumNoteContentUpdate note content
GET/notes/{noteId}/exportExport-TriliumNoteExport note(s) as zip (HTML/Markdown)
POST/notes/{noteId}/importImport-TriliumNoteZipImport notes from ZIP
POST/notes/{noteId}/revisionNew-TriliumNoteRevisionCreate a new note revision
POST/branchesCopy-TriliumNoteCopy a note to a new branch
GET/branches/{branchId}Get-TriliumBranchGet branch details
PATCH/branches/{branchId}Set-TriliumBranchUpdate branch prefix and/or note position (PATCH)
DELETE/branches/{branchId}Remove-TriliumBranchDelete a branch
POST/attachmentsNew-TriliumAttachmentCreate a new attachment for a note
GET/attachments/{attachmentId}Get-TriliumAttachmentGet attachment metadata
PATCH/attachments/{attachmentId}Set-TriliumAttachmentUpdate attachment properties (role, mime, title, position)
DELETE/attachments/{attachmentId}Remove-TriliumAttachmentDelete an attachment
GET/attachments/{attachmentId}/contentGet-TriliumAttachmentContentDownload attachment content
PUT/attachments/{attachmentId}/contentNew-TriliumNoteFileCreate a new note from a local file (uploads file content)
N/AN/AFormat-TriliumHtmlHelper function to beautify HTML content with improved header spacing and code block formatting
POST/attributesCreate-TriliumAttributeCreate a new attribute
GET/attributes/{attributeId}Get-TriliumAttributeGet attribute details
PATCH/attributes/{attributeId}
DELETE/attributes/{attributeId}Remove-TriliumAttributeDelete an attribute
POST/refresh-note-ordering/{parentNoteId}Update-TriliumNoteOrderRefresh note ordering
GET/inbox/{date}Get-TriliumInboxGet or create inbox note for a date
GET/calendar/days/{date}Get-TriliumDayNoteGet 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-TriliumMonthNoteGet or create month note for a month
GET/calendar/years/{year}Get-TriliumYearNoteGet or create year note for a year
POST/auth/loginConnect-TriliumAuthAuthenticate to Trilium (now uses 'Bearer' for ETAPI)
POST/auth/logoutDisconnect-TriliumAuthLogout from Trilium
GET/app-infoGet-TriliumInfoGet Trilium server info
PUT/backup/{backupName}New-TriliumBackupCreate a new backup
GET/notes/rootGet-TriliumRootNoteGet root note details (requires Connect-TriliumAuth, no params; every root note has id 'root').
GET/notes/{noteId}/attachmentsGet-TriliumNoteAttachmentRetrieves attachments for a specific note (Undocumented API)

๐Ÿ“– Getting Help in PowerShell

You can view detailed help for any function in this module directly from PowerShell using the Get-Help cmdlet. This displays usage, parameters, examples, and notes for each function.

Examples:

Get-Help Connect-TriliumAuth -Full
Get-Help New-TriliumNote -Examples
Get-Help Get-TriliumAttachment

Read the docs


๐Ÿงฉ Notable Dependencies & Inspiration

  • ๐Ÿ“ Markdig: Used for converting Markdown to HTML in this module.
  • ๐Ÿ trilium-py: Python library for Trilium ETAPI, used for some inspiration.

๐Ÿ“ฃ Contributions & Issues

Feel free to open issues, submit pull requests, or suggest features!


๐Ÿ“„ License

This project is licensed under the MIT License.


๐Ÿ“… Changelog

See CHANGELOG.md for release history.


๐Ÿ”— Resources


๐Ÿง  Made with โค๏ธ for scripting your notes.