Frontend API
FrontendApi
The api global available inside frontend script notes (application/javascript;env=frontend).
| Member | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|
$container |
| ||||||||
startNote |
| ||||||||
currentNote |
| ||||||||
originEntity |
| ||||||||
dayjs |
| ||||||||
RightPanelWidget |
| ||||||||
NoteContextAwareWidget |
| ||||||||
BasicWidget |
| ||||||||
activateNote | Activates note in the tree and in the note detail.
| ||||||||
activateNewNote | Activates newly created note. Compared to this.activateNote() also makes sure that frontend has been fully synced.
| ||||||||
openTabWithNote | Open a note in a new tab.
| ||||||||
openSplitWithNote | Open a note in a new split.
| ||||||||
runOnBackend | Executes given anonymous function on the backend. Internally this serializes the anonymous function into string and sends it to backend via AJAX. Please make sure that the supplied function is synchronous. Only sync functions will work correctly with transaction management. If you really know what you're doing, you can call api.runAsyncOnBackendWithManualTransactionHandling()
Returns | ||||||||
runAsyncOnBackendWithManualTransactionHandling | Executes given anonymous function on the backend. Internally this serializes the anonymous function into string and sends it to backend via AJAX. This function is meant for advanced needs where an async function is necessary. In this case, the automatic request-scoped transaction management is not applied, and you need to manually define transaction via api.transactional(). If you have a synchronous function, please use api.runOnBackend().
Returns | ||||||||
isBackendScriptingEnabled | Whether backend script execution is enabled on the server (the | ||||||||
isSqlConsoleEnabled | Whether the SQL console is enabled on the server (the | ||||||||
searchForNotes | This is a powerful search method - you can search by attributes and their values, e.g.: "#dateModified =* MONTH AND #log". See full documentation for all options at: https://triliumnext.github.io/Docs/Wiki/search.html | ||||||||
searchForNote | This is a powerful search method - you can search by attributes and their values, e.g.: "#dateModified =* MONTH AND #log". See full documentation for all options at: https://triliumnext.github.io/Docs/Wiki/search.html | ||||||||
getNote | Returns note by given noteId. If note is missing from the cache, it's loaded. | ||||||||
getNotes | Returns list of notes. If note is missing from the cache, it's loaded. This is often used to bulk-fill the cache with notes which would have to be picked one by one otherwise (by e.g. createLink())
| ||||||||
reloadNotes | Update frontend tree (note) cache from the backend. | ||||||||
createNote | Creates a new note as a child of the given parent, entirely on the frontend — no backend scripting required (unlike
Returns | ||||||||
getInstanceName | Instance name identifies particular Trilium instance. It can be useful for scripts if some action needs to happen on only one specific instance. | ||||||||
addTextToActiveContextEditor | Adds given text to the editor cursor
| ||||||||
getActiveContextNote | Returns | ||||||||
getActiveContext | Obtains the currently active/focused split in the current tab. Note that this method does not return the note context of the "Quick edit" panel, it will return the note context behind it. | ||||||||
getActiveMainContext | Obtains the main context of the current tab. This is the left-most split. Note that this method does not return the note context of the "Quick edit" panel, it will return the note context behind it. | ||||||||
getNoteContexts | Returns | ||||||||
getMainNoteContexts | Returns | ||||||||
getActiveContextTextEditor | Returns the editor of the text note in the active tab or split. Resolves to | ||||||||
getActiveContextCodeEditor | Returns the editor of the code note in the active tab or split. Resolves to | ||||||||
getActiveNoteDetailWidget | Get access to the widget handling note detail. Methods like | ||||||||
getActiveContextNotePath | Returns | ||||||||
getComponentByEl | Returns component which owns the given DOM element (the nearest parent component in DOM tree)
| ||||||||
showMessage | Show an info toast message to the user. | ||||||||
showError | Show an error toast message to the user. | ||||||||
showInfoDialog | Show an info dialog to the user. | ||||||||
showConfirmDialog | Show confirm dialog to the user. Returns | ||||||||
showPromptDialog | Show prompt dialog to the user. Returns | ||||||||
pickSingleItem | Show a dialog for picking one item out of many, grouped and searchable.
Returns | ||||||||
createLink | Create a note link (jQuery object) for given note.
Returns | ||||||||
createNoteLink | | ||||||||
triggerCommand | Trigger command. This is a very low-level API which should be avoided if possible. | ||||||||
triggerEvent | Trigger event. This is a very low-level API which should be avoided if possible. | ||||||||
setupElementTooltip | Shows a preview of the linked note while the mouse pointer rests on the element, as Trilium does for links in note content. The element must be a link whose
| ||||||||
protectNote |
| ||||||||
protectSubTree |
| ||||||||
getTodayNote | Returns date-note for today. If it doesn't exist, it is automatically created. | ||||||||
getDayNote | Returns day note for a given date. If it doesn't exist, it is automatically created.
| ||||||||
getWeekFirstDayNote | Returns day note for the first date of the week of the given date. If it doesn't exist, it is automatically created.
| ||||||||
getWeekNote | Returns week note for given date. If such a note doesn't exist, it is automatically created.
| ||||||||
getMonthNote | Returns month-note. If it doesn't exist, it is automatically created.
| ||||||||
getQuarterNote | Returns quarter note for given date. If such a note doesn't exist, it is automatically created.
| ||||||||
getYearNote | Returns year-note. If it doesn't exist, it is automatically created.
| ||||||||
setHoistedNoteId | Hoist note in the current tab. See https://triliumnext.github.io/Docs/Wiki/note-hoisting.html
| ||||||||
bindGlobalShortcut |
| ||||||||
waitUntilSynced | Trilium runs in a backend and frontend process, when something is changed on the backend from a script, frontend will get asynchronously synchronized. This method returns a promise which resolves once all the backend -> frontend synchronization is finished. Typical use case is when a new note has been created, we should wait until it is synced into frontend and only then activate it. | ||||||||
refreshIncludedNote | This will refresh all currently opened notes which have included note specified in the parameter
| ||||||||
randomString | Return randomly generated string of given length. This random string generation is NOT cryptographically secure.
Returns | ||||||||
formatSize |
Returns | ||||||||
formatNoteSize |
Returns | ||||||||
htmlToMarkdown | Converts the given HTML string to Markdown. Unlike the backend API, this runs on the server (the HTML→Markdown converter is backend-only), so it returns a promise.
Returns | ||||||||
markdownToHtml | Converts the given Markdown string to HTML. Runs entirely in the browser; the promise is only needed because the Markdown renderer is loaded on demand.
Returns | ||||||||
formatDateISO | Returns | ||||||||
parseDate | Parses a date string into a Date. | ||||||||
logMessages |
| ||||||||
logSpacedUpdates |
| ||||||||
log | Log given message to the log pane in UI. Accepts multiple arguments which are joined with spaces, similar to | ||||||||
preact |
|
FNote
A note as seen by frontend scripts (subset of the client's FNote).
| Member | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|
noteId |
| ||||||||
title |
| ||||||||
type |
| ||||||||
mime |
| ||||||||
isProtected |
| ||||||||
isArchived |
| ||||||||
isMetadataReadOnly |
| ||||||||
attributes |
| ||||||||
targetRelations |
| ||||||||
parents |
| ||||||||
children |
| ||||||||
getParentNotes | Returns the parent notes that the client has already loaded. A parent that is not loaded is skipped, and a search note that shows this note in its results counts as a parent. | ||||||||
getChildNotes | Loads any missing child notes from the server, then returns all child notes in tree order. Archived children are included. | ||||||||
getParentNoteIds | Returns the IDs of the parent notes. The returned array is the note's own list, so do not change it. | ||||||||
getChildNoteIds | Returns the IDs of the child notes in tree order, archived ones included. The returned array is the note's own list, so do not change it. | ||||||||
getChildNoteIdsWithArchiveFiltering | Returns the IDs of the child notes in tree order, leaving out archived notes unless
| ||||||||
getSubtreeNotes | Returns all descendants of the note, loading missing ones from the server one level at a time. An archived note and everything below it are left out, and the note itself is not included. | ||||||||
getSubtreeNoteIds | Returns the IDs of all the note's descendants, depth-first, without the note itself. Archived notes and the notes below them are left out unless | ||||||||
hasChildren | Returns | ||||||||
hasAncestor | Returns
| ||||||||
isRoot | Returns | ||||||||
getParentBranchIds | Returns the IDs of the branches that place this note under each of its parents. | ||||||||
getBranchIds | Returns the IDs of the branches that place the note under its parents. | ||||||||
getParentBranches | Returns the branches that place this note under each of its parents. A branch the client has not loaded is skipped. | ||||||||
getChildBranches | Returns the branches to this note's children, in tree order. A branch the client has not loaded is skipped. | ||||||||
getBranches | Returns the branches that place the note under its parents. | ||||||||
getFilteredChildBranches | Returns the same branches as | ||||||||
getAllNotePaths | Returns every path from the root to the note, each as a list of note IDs that starts with | ||||||||
getBestNotePath | Returns the note's best path as a list of note IDs that starts with
| ||||||||
getBestNotePathString | Returns the note's best path, as
| ||||||||
getSortedNotePathRecords | Returns every path from the root to this note, best first. Paths inside the hoisted note come first, then paths that do not pass through an archived note or the hidden subtree, then paths that share the most with
| ||||||||
getAttributes | Returns the note's attributes, including inherited ones, optionally only those of the given type and name. The note's own attributes come first, then the ones inherited from its parents, then the ones from its templates.
| ||||||||
getOwnedAttributes | Returns the note's own attributes, without inherited ones, optionally only those of the given type and name.
| ||||||||
getAttribute | Returns the first attribute of the given type and name, including inherited ones, or
| ||||||||
getOwnedAttribute | Returns the first of the note's own attributes with the given type and name, or
| ||||||||
getAttributeValue | Returns the value of the first attribute of the given type and name, including inherited ones, or
| ||||||||
getOwnedAttributeValue | Returns the value of the first of the note's own attributes with the given type and name, or
| ||||||||
hasAttribute | Returns whether the note has an attribute of the given type and name, including inherited ones.
| ||||||||
hasOwnedAttribute | Returns whether the note itself has an attribute of the given type and name, without inherited ones.
| ||||||||
getAttributeDefinitions | Returns the attribute definitions that apply to the note, at most one per defined name. When the note gets a definition from several places, such as its own, an ancestor's and a template's, the nearest one wins, in the order | ||||||||
getPromotedDefinitionAttributes | Returns the attribute definitions that are marked as promoted, at most one per name, grouped by the note that owns them and ordered by position. Returns an empty array if the note has a truthy | ||||||||
getLabels | Returns the note's labels, including inherited ones, optionally only those with | ||||||||
getOwnedLabels | Returns the note's own labels, without inherited ones, optionally only those with | ||||||||
getLabel | Returns the first label with the given name, including inherited ones, or | ||||||||
getOwnedLabel | Returns the first of the note's own labels with the given name, or | ||||||||
getLabelValue | Returns the value of the first label with the given name, including inherited ones, or | ||||||||
getOwnedLabelValue | Returns the value of the first of the note's own labels with the given name, or | ||||||||
hasLabel | Returns whether the note has a label with the given name, including inherited ones. | ||||||||
hasOwnedLabel | Returns whether the note itself has a label with the given name, without inherited ones. | ||||||||
hasLabelOrDisabled | Returns whether the note has a label with the given name, including inherited ones, or the same label with the | ||||||||
isLabelTruthy | Returns whether the note has a label with the given name, including inherited ones, whose value is anything but | ||||||||
getRelations | Returns the note's relations, including inherited ones, optionally only those with | ||||||||
getOwnedRelations | Returns the note's own relations, without inherited ones, optionally only those with | ||||||||
getRelation | Returns the first relation with the given name, including inherited ones, or | ||||||||
getOwnedRelation | Returns the first of the note's own relations with the given name, or | ||||||||
getRelationValue | Returns the target note ID of the first relation with the given name, including inherited ones, or | ||||||||
getOwnedRelationValue | Returns the target note ID of the first of the note's own relations with the given name, or | ||||||||
hasRelation | Returns whether the note has a relation with the given name, including inherited ones. | ||||||||
hasOwnedRelation | Returns whether the note itself has a relation with the given name, without inherited ones. | ||||||||
getLabelOrRelation | Returns the value of a label or relation, inherited ones included, or
| ||||||||
getRelationTarget | Returns the target note of the first relation with the given name, including inherited ones. Returns | ||||||||
getRelationTargets | Returns the target notes of the note's relations with the given name, including inherited ones, in the order of the relations. A relation whose target is missing gives | ||||||||
getTargetRelations | Returns the relations, owned by any note, that point at this note. | ||||||||
getTargetRelationSourceNotes | Returns the notes that own a relation pointing at this note. | ||||||||
getContent | Fetches the note's content from the server. Resolves to a string for text-based notes; for a binary note such as an image or file, the content is not sent, and for a protected note without a protected session, it is an empty string. | ||||||||
getJsonContent | Fetches the note's content and parses it as JSON. Resolves to | ||||||||
getBlob | Fetches the note's content together with its blob ID, length and modification date. Resolves to | ||||||||
getNoteComplement | Returns the blob that holds the note's content. | ||||||||
getMetadata | Returns the note's creation and modification dates, which it requests from the server. | ||||||||
attachments |
| ||||||||
getAttachments | Returns the note's attachments. The first call loads them from the server, and later calls reuse that list. | ||||||||
getAttachmentsByRole | Returns the note's attachments with the given role, such as | ||||||||
getAttachmentById | Returns the note's attachment with the given ID, or | ||||||||
getNotesToInheritAttributesFrom | Returns the target notes of this note's | ||||||||
getIcon | Returns the CSS classes of the note's icon, such as | ||||||||
isFolder | Returns | ||||||||
isShared | Returns | ||||||||
isContentAvailable | Returns | ||||||||
isJson | Returns | ||||||||
isJavaScript | Returns whether the note is a code, file or launcher note with a JavaScript MIME type. | ||||||||
isJsx | Returns | ||||||||
isHtml | Returns whether the note is a code, file or render note with the | ||||||||
isMarkdown | Returns | ||||||||
isOptions | Returns | ||||||||
isTriliumScript | Returns | ||||||||
isTriliumSqlite | Returns | ||||||||
isLaunchBarConfig | Returns | ||||||||
isHiddenCompletely | Returns whether every path to the note runs through the hidden subtree, so that no clone of it appears in the visible tree. Paths through search notes are not counted. | ||||||||
isInHiddenSubtree | Returns | ||||||||
isEligibleForConversionToAttachment | Returns | ||||||||
getColorClass | Returns the CSS class that applies the note's | ||||||||
getCssClass | Returns the values of all the note's | ||||||||
getWorkspaceIconClass | Returns the value of the note's | ||||||||
getWorkspaceTabBackgroundColor | Returns the value of the note's | ||||||||
getScriptEnv | Returns where the note runs as a script: | ||||||||
executeScript | Runs the note as a frontend or backend script, depending on | ||||||||
blobId |
| ||||||||
parentToBranch |
| ||||||||
childToBranch |
| ||||||||
searchResultsLoadedoptional |
| ||||||||
highlightedTokensoptional |
| ||||||||
dto |
| ||||||||
addParent | Adds a parent to this note in the client's cache only. Trilium calls it when it loads branches; scripts do not normally call it, and the change is not saved. To place a note under another, use
| ||||||||
addChild | Adds a child to this note in the client's cache only. Trilium calls it when it loads branches; scripts do not normally call it, and the change is not saved.
| ||||||||
sortParents | Reorders the parent list in the client's cache so that ordinary parents come before search notes, archived notes and notes outside the visible tree. Trilium calls it itself; scripts do not normally call it. | ||||||||
sortChildren | Reorders the child list in the client's cache by each branch's position. Trilium calls it itself; scripts do not normally call it, and it does not change the order saved in the database. | ||||||||
update | Overwrites the note's ID, title, type, MIME type, protection flag and blob ID in the client's cache with the values in | ||||||||
invalidateAttributeCache | Does nothing; the note's attributes stay up to date without it. | ||||||||
toString | Returns a short description of the note for logging, such as |
RightPanelWidget
Instance shape of RightPanelWidget (subset) — a widget shown in the right sidebar.
| Member | Description |
|---|---|
$widget |
|
isEnabled | Returns whether the widget is shown: always for a |
doRender | Builds the widget's DOM. Override it to create the root element and assign it to |
render | Renders the widget and returns its root element. |
cleanup | Tears down the widget; override to release resources. |
toggleInt | Shows or hides the widget from inside the widget itself, such as from |
id | Fluent builder: set the element id. Chainable. |
class | Fluent builder: add a CSS class. Chainable. |
css | Sets an inline CSS property on the widget's root element, such as |
child | Fluent builder: append child components. Chainable. |
note |
|
noteId |
|
notePath |
|
ntxId |
|
noteContextoptional |
|
isNote | Returns whether |
refreshWithNote | Updates the widget for the note in its context. Override it to refresh the widget's content; it runs when that note changes and on |
refresh | Forces a refresh against the current note. |
widgetTitle |
|
doRenderBody | Builds the panel's body. Override it to fill |
NoteContextAwareWidget
Instance shape of NoteContextAwareWidget (subset) — reacts to the active note.
| Member | Description |
|---|---|
$widget |
|
isEnabled | Returns whether the widget is shown: always for a |
doRender | Builds the widget's DOM. Override it to create the root element and assign it to |
render | Renders the widget and returns its root element. |
cleanup | Tears down the widget; override to release resources. |
toggleInt | Shows or hides the widget from inside the widget itself, such as from |
id | Fluent builder: set the element id. Chainable. |
class | Fluent builder: add a CSS class. Chainable. |
css | Sets an inline CSS property on the widget's root element, such as |
child | Fluent builder: append child components. Chainable. |
note |
|
noteId |
|
notePath |
|
ntxId |
|
noteContextoptional |
|
isNote | Returns whether |
refreshWithNote | Updates the widget for the note in its context. Override it to refresh the widget's content; it runs when that note changes and on |
refresh | Forces a refresh against the current note. |
BasicWidget
Instance shape of BasicWidget (subset) — the base for custom frontend widgets.
| Member | Description |
|---|---|
$widget |
|
isEnabled | Returns whether the widget is shown: always for a |
doRender | Builds the widget's DOM. Override it to create the root element and assign it to |
render | Renders the widget and returns its root element. |
cleanup | Tears down the widget; override to release resources. |
toggleInt | Shows or hides the widget from inside the widget itself, such as from |
id | Fluent builder: set the element id. Chainable. |
class | Fluent builder: add a CSS class. Chainable. |
css | Sets an inline CSS property on the widget's root element, such as |
child | Fluent builder: append child components. Chainable. |
FBranch
A branch (parent↔child link) as seen by frontend scripts (subset of FBranch).
| Member | Description |
|---|---|
branchId |
|
noteId |
|
parentNoteId |
|
notePosition |
|
prefixoptional |
|
isExpandedoptional |
|
getNote | Returns the child note, loading it from the server if the frontend cache does not hold it yet. Resolves to |
getNoteFromCache | Returns the child note from the frontend cache, without contacting the server. Returns |
getParentNote | Returns the parent note, loading it from the server if the frontend cache does not hold it yet. Resolves to |
isTopLevel | Returns whether the branch places its note directly under the root note. |
NoteContext
A split/tab context as seen by frontend scripts (subset of NoteContext).
| Member | Description |
|---|---|
ntxId |
|
note |
|
notePath |
|
getCodeEditor | Returns the CodeMirror editor of the code note this context shows. Resolves to |
getTextEditor | Returns the CKEditor instance of the editable text note this context shows. Resolves to |
DayjsInstance
A date as day.js wraps it (subset).
| Member | Description | ||||||
|---|---|---|---|---|---|---|---|
format | Formats the date, such as | ||||||
add | Returns a new date,
| ||||||
subtract | Returns a new date,
| ||||||
toDate | Returns the date as a JavaScript |
Types
JQuery
A jQuery object: one or more page elements with jQuery's methods, as $(…) returns. The jQuery API documentation describes them, and the script editor offers them as completions.
Dayjs
Minimal day.js surface (the real API exposes the full day.js factory).
type Dayjs = (date?: string | number | Date) => DayjsInstanceWidgetClass
Constructor type allowing class X extends api.Widget { … }.
type WidgetClass<T> = new (...args: unknown[]) => TFunc
type Func = ((...args: unknown[]) => unknown) | stringCreateNoteOpts
Options accepted by FrontendApi.createNote.
| Property | Description |
|---|---|
title optional | string | null Title of the new note. |
content optional | string | null Content of the new note (HTML for text notes, source for code notes, etc.). |
type optional | string Note type, e.g. "text" (default), "code", "book". |
mime optional | string MIME type, e.g. "application/javascript;env=frontend" for a frontend code note. |
templateNoteId optional | string Note ID of a template to apply to the new note. |
isProtected optional | boolean Create the note as protected (only takes effect when a protected session is available). |
activate optional | boolean Activate (open) the new note after creation. Defaults to true. |
focus optional | "title" | "content" Which part of the activated note to focus. Defaults to "title". |
target optional | string Where to place the note relative to the parent/target: "into" (default) or "after". |
targetBranchId optional | string Branch ID used together with target: "after". |
attributes optional | CreateAttribute[] Attributes to set atomically on creation. |
TextEditor
The editor of a text note, a CKEditor 5 editor. The CKEditor 5 API documentation describes it; editor.model and editor.getData() are the usual starting points.
CodeEditor
The editor of a code note, a CodeMirror 6 EditorView. The CodeMirror reference describes it; editor.state.doc.toString() reads the code.
PickerItem
One thing a picker offers, as pickSingleItem takes and answers with.
| Property | Description |
|---|---|
key | string The ID of the item. It must be unique within its group, and tells the script which item the user picked. |
caption | string The text shown for the item. The search field filters items by it. |
icon optional | string An icon class, bx prefix included. |
tooltip optional | string HTML shown in a tooltip while the item is hovered. |
PickerItemGroup
A run of picker items under a heading of their own.
| Property | Description |
|---|---|
key | string The ID of the group. It must be unique among the groups. |
groupHeader | string The heading shown above the group's items. An empty string shows the items without a heading. |
items | PickerItem[] The items in the group, in the order the picker shows them. |
LinkOptions
Options of api.createLink().
| Property | Description |
|---|---|
title optional | string The text of the link. Defaults to the note's title. |
showTooltip optional | boolean Whether a preview of the note shows while the mouse pointer rests on the link. Defaults to true. |
showNotePath optional | boolean Whether the path of the note's parents shows below the link. Defaults to false. |
showNoteIcon optional | boolean Whether the note's icon shows before the link. Defaults to false. |
referenceLink optional | boolean Whether the link is styled as a reference link, as in text notes. Defaults to false. |
autoConvertToImage optional | boolean Whether an image, canvas or Mermaid note shows as its picture instead of a link. Defaults to false. |
titleSuffix optional | string Text shown right after the link's title. |
Preact
The Preact API that render notes import from trilium:preact: Preact's own functions and hooks, and Trilium's components and defineWidget(). In a JSX note, the script editor offers its full type.
NotePathRecord
One resolved tree path to a note (subset of the client's NotePathRecord).
| Property | Description |
|---|---|
isArchived | boolean Whether a note on the path, the note itself included, is archived, which means it has the #archived label, owned or inherited. |
isInHoistedSubTree | boolean Whether the path passes through the hoisted note passed to getSortedNotePathRecords(). It is always true when the hoisted note is root. |
isSearch optional | boolean Whether the note itself is a search note. Only frontend scripts get this property; backend records leave it out. |
notePath | string[] The note IDs along the path, from root to the note itself. |
isHidden | boolean Whether the path passes through the hidden subtree, _hidden, which holds Trilium's system notes. |
Attribute
A label or relation attached to a note.
| Property | Description |
|---|---|
attributeId | string The ID of the attribute. |
type | "label" | "relation" The type of the attribute: label or relation. |
name | string The name of the attribute, without the # or ~ prefix. |
value | string The value of the attribute. For a relation, it is the ID of the target note. For a label without a value, it is an empty string. |
isInheritable | boolean Whether the note's descendants inherit the attribute. |
isOwned | boolean Not set by Trilium: neither frontend nor backend attributes carry this property, so it reads undefined. |
Blob
A note's binary/text content blob (subset of the client's FBlob).
| Property | Description |
|---|---|
blobId | string The ID of the blob, derived from its content. Notes, attachments and revisions with identical content share one blob. |
content | string The content as text. It is null when the content is binary, as in images and files. |
contentLength | number The length of the content as stored: characters for text, bytes for binary content. For a protected note, it measures the encrypted content. |
dateModified | string The local date and time this content was first stored, with the UTC offset, such as 2026-10-22 14:03:05.123+0200. A blob never changes, so new content gets a new blob. |
utcDateModified | string The date and time, in UTC, that this content was first stored, such as 2026-10-22 12:03:05.123Z. |
NoteMetadata
Creation/modification timestamps returned by FNote.getMetadata.
| Property | Description |
|---|---|
dateCreated | string The local date and time the note was created, with the UTC offset, such as 2026-10-22 14:03:05.123+0200. |
utcDateCreated | string The date and time, in UTC, that the note was created, such as 2026-10-22 12:03:05.123Z. |
dateModified | string The local date and time the note was last modified, with the UTC offset, such as 2026-10-22 14:03:05.123+0200. A change to the note's content counts as a modification. |
utcDateModified | string The date and time, in UTC, that the note was last modified, such as 2026-10-22 12:03:05.123Z. A change to the note's content counts as a modification. |
Attachment
An attachment as seen by frontend scripts (subset of the client's FAttachment).
| Property | Description |
|---|---|
attachmentId | string The ID of the attachment. |
ownerId | string The ID of the note the attachment belongs to. For an attachment of a revision, it is the ID of the revision. |
role | string The purpose of the attachment, such as image for an image shown in a text note or file for an attached file. Trilium also uses roles of its own, such as viewConfig for a collection's view settings. |
mime | string The MIME type of the attachment's content, such as image/png. |
title | string The title of the attachment, usually its file name. |
utcDateModified | string The date and time, in UTC, that the attachment was last saved, such as 2026-10-22 12:03:05.123Z. Replacing the content counts as saving. |
contentLength | number The length of the attachment's content. Only some ways of loading an attachment fill it in, such as getAttachments(). |
CreateAttribute
An attribute to create together with a note (see CreateNoteOpts.attributes).
| Property | Description |
|---|---|
type | "label" | "relation" The type of the attribute: label or relation. |
name | string The name of the attribute, without the # or ~ prefix. |
value optional | string The value of the attribute. For a relation, it is the ID of the target note. Defaults to an empty string. |
isInheritable optional | boolean Whether the note's descendants inherit the attribute. Defaults to false. |
position optional | number The place of the attribute among the note's attributes, which are listed by ascending position. Defaults to 10 more than the highest position among the note's attributes. |