Skip to content

Build your personal knowledge base with Trilium Notes

client/launch bar: allow creating new launchers by dropping notes

Adorian Doran6fbc58ecc48e
diff --git a/apps/client/src/services/branches.spec.ts b/apps/client/src/services/branches.spec.ts
index a04885e4f2..8cab8a174d 100644
--- a/apps/client/src/services/branches.spec.ts
+++ b/apps/client/src/services/branches.spec.ts
@@ -530,6 +530,15 @@ describe("clone helpers", () => {
await branches.cloneNoteAfter("noteN", "afterB");
expect(toastService.showError).toHaveBeenCalledWith("e3");
});
+
+ it("cloneNoteBefore calls server and surfaces errors", async () => {
+ await branches.cloneNoteBefore("noteN", "beforeB");
+ expect(server.put).toHaveBeenCalledWith("notes/noteN/clone-before/beforeB");
+
+ server.put = vi.fn(async () => ({ success: false, message: "e4" })) as typeof server.put;
+ await branches.cloneNoteBefore("noteN", "beforeB");
+ expect(toastService.showError).toHaveBeenCalledWith("e4");
+ });
});
describe("ws task-message subscribers", () => {
diff --git a/apps/client/src/services/branches.ts b/apps/client/src/services/branches.ts
index b1a41f2297..00f5d94d73 100644
--- a/apps/client/src/services/branches.ts
+++ b/apps/client/src/services/branches.ts
@@ -382,6 +382,15 @@ async function cloneNoteAfter(noteId: string, afterBranchId: string) {
}
}
+// beware that the first arg is noteId and the second is branchId!
+async function cloneNoteBefore(noteId: string, beforeBranchId: string) {
+ const resp = await server.put<Response>(`notes/${noteId}/clone-before/${beforeBranchId}`);
+
+ if (!resp.success) {
+ toastService.showError(resp.message);
+ }
+}
+
export default {
moveBeforeBranch,
moveAfterBranch,
@@ -389,6 +398,7 @@ export default {
deleteNotes,
moveNodeUpInHierarchy,
cloneNoteAfter,
+ cloneNoteBefore,
cloneNoteToBranch,
cloneNoteToParentNote
};
diff --git a/apps/client/src/widgets/launch_bar/LauncherContainer.css b/apps/client/src/widgets/launch_bar/LauncherContainer.css
new file mode 100644
index 0000000000..65cc8df226
--- /dev/null
+++ b/apps/client/src/widgets/launch_bar/LauncherContainer.css
@@ -0,0 +1,3 @@
+#launcher-container .launcher-slot {
+ display: contents;
+}
diff --git a/apps/client/src/widgets/launch_bar/LauncherContainer.spec.tsx b/apps/client/src/widgets/launch_bar/LauncherContainer.spec.tsx
index a25a925329..d0c3fd6c41 100644
--- a/apps/client/src/widgets/launch_bar/LauncherContainer.spec.tsx
+++ b/apps/client/src/widgets/launch_bar/LauncherContainer.spec.tsx
@@ -5,6 +5,7 @@ import { afterEach, describe, expect, it, vi } from "vitest";
import Component from "../../components/component.js";
import type FNote from "../../entities/fnote.js";
import { buildNote } from "../../test/easy-froca.js";
+import { TREE_CLIPBOARD_TYPE } from "../react/hooks.js";
import { ParentComponent } from "../react/react_utils.js";
import LauncherContainer, { useLauncherChildNotes } from "./LauncherContainer.js";
@@ -17,6 +18,13 @@ vi.mock("../../services/utils", async (importOriginal) => ({
vi.mock("./RecordMeetingButton", () => ({
default: () => <span className="record-meeting-button" />
}));
+vi.mock("./GenericButtons", async (importOriginal) => ({
+ ...await importOriginal<typeof import("./GenericButtons")>(),
+ CustomNoteLauncher: ({ launcherNote, getTargetNoteId }: {
+ launcherNote: FNote,
+ getTargetNoteId: (launcherNote: FNote) => unknown
+ }) => <span className="custom-note-launcher" data-target={`${getTargetNoteId(launcherNote)}`} />
+}));
let container: HTMLDivElement;
@@ -115,4 +123,34 @@ describe("LauncherContainer", () => {
await flush();
expect(container.querySelector(".record-meeting-button")).not.toBeNull();
});
+
+ it("shows a note cloned into the bar as a launcher of itself, and takes drops", async () => {
+ buildNote({
+ id: "_lbVisibleLaunchers",
+ title: "Visible Launchers",
+ children: [ { id: "clonedNote", title: "Cloned note" } ]
+ });
+ container = document.createElement("div");
+ document.body.appendChild(container);
+ act(() => render(
+ <ParentComponent.Provider value={new Component()}>
+ <LauncherContainer isHorizontalLayout={false} />
+ </ParentComponent.Provider>, container));
+ await flush();
+
+ const slot = container.querySelector(".launcher-slot[data-launcher-id='clonedNote']");
+ const launcher = slot?.querySelector(".custom-note-launcher");
+ expect(launcher?.getAttribute("data-target")).toBe("clonedNote");
+
+ const bar = container.querySelector("#launcher-container");
+ expect(bar).not.toBeNull();
+ const dragOver = new Event("dragover", { bubbles: true, cancelable: true });
+ Object.defineProperty(dragOver, "dataTransfer", {
+ value: { types: [ TREE_CLIPBOARD_TYPE ] }
+ });
+ act(() => {
+ bar?.dispatchEvent(dragOver);
+ });
+ expect(document.body.querySelector(".launcher-drop-indicator")).not.toBeNull();
+ });
});
diff --git a/apps/client/src/widgets/launch_bar/LauncherContainer.tsx b/apps/client/src/widgets/launch_bar/LauncherContainer.tsx
index 3698966da0..3994eae410 100644
--- a/apps/client/src/widgets/launch_bar/LauncherContainer.tsx
+++ b/apps/client/src/widgets/launch_bar/LauncherContainer.tsx
@@ -1,3 +1,5 @@
+import "./LauncherContainer.css";
+
import { useCallback, useLayoutEffect, useRef, useState } from "preact/hooks";
import FNote from "../../entities/fnote";
@@ -10,9 +12,11 @@ import { onWheelHorizontalScroll } from "../widget_utils";
import BookmarkButtons from "./BookmarkButtons";
import CalendarWidget from "./CalendarWidget";
import ColorSchemeSwitcher from "./ColorSchemeSwitcher";
+import { CustomNoteLauncher } from "./GenericButtons";
import HistoryNavigationButton from "./HistoryNavigation";
import { LaunchBarContext } from "./launch_bar_widgets";
import { CommandButton, CustomWidget, NoteLauncher, QuickSearchLauncherWidget, ScriptLauncher, TodayLauncher } from "./LauncherDefinitions";
+import LauncherDropTarget from "./LauncherDropTarget";
import ProtectedSessionStatusWidget from "./ProtectedSessionStatusWidget";
import RecordMeetingButton from "./RecordMeetingButton";
import SidebarChatButton from "./SidebarChatButton";
@@ -41,23 +45,37 @@ export default function LauncherContainer({ isHorizontalLayout }: { isHorizontal
isHorizontalLayout
}}>
{childNotes?.map(childNote => {
- if (childNote.type !== "launcher") {
- console.warn(`Note '${childNote.noteId}' '${childNote.title}' is not a launcher even though it's in the launcher subtree`);
- return false;
- }
-
if (!isDesktop() && childNote.isLabelTruthy("desktopOnly")) {
return false;
}
- return <Launcher key={childNote.noteId} note={childNote} isHorizontalLayout={isHorizontalLayout} />;
+ // `LauncherDropTarget` measures each launcher through its slot.
+ return (
+ <div
+ key={childNote.noteId}
+ className="launcher-slot"
+ data-launcher-id={childNote.noteId}
+ >
+ <Launcher note={childNote} isHorizontalLayout={isHorizontalLayout} />
+ </div>
+ );
})}
</LaunchBarContext.Provider>
+ <LauncherDropTarget
+ containerRef={containerRef}
+ parentNoteId={getVisibleLaunchersRootId()}
+ isHorizontalLayout={isHorizontalLayout}
+ />
</div>
);
}
function Launcher({ note, isHorizontalLayout }: { note: FNote, isHorizontalLayout: boolean }) {
+ // A note cloned into the launch bar opens itself.
+ if (note.type !== "launcher") {
+ return <CustomNoteLauncher launcherNote={note} getTargetNoteId={() => note.noteId} />;
+ }
+
const launcherType = note.getLabelValue("launcherType");
if (glob.TRILIUM_SAFE_MODE && launcherType === "customWidget") return;
@@ -121,8 +139,7 @@ export function useLauncherChildNotes() {
// Load the root note.
const loadRoot = useCallback(() => {
- const visibleLaunchersRootId = isMobile() ? "_lbMobileVisibleLaunchers" : "_lbVisibleLaunchers";
- froca.getNote(visibleLaunchersRootId, true).then(setVisibleLaunchersRoot);
+ froca.getNote(getVisibleLaunchersRootId(), true).then(setVisibleLaunchersRoot);
}, []);
useLayoutEffect(loadRoot, [ loadRoot ]);
@@ -149,6 +166,11 @@ export function useLauncherChildNotes() {
return childNotes;
}
+/** The note whose children are the launchers shown in this layout's launch bar. */
+function getVisibleLaunchersRootId() {
+ return isMobile() ? "_lbMobileVisibleLaunchers" : "_lbVisibleLaunchers";
+}
+
// Measures the scrollbar's actual consumed size (which varies by browser and the OS "show scroll
// bars" setting) and publishes it as `--launcher-scrollbar-size`; shell.css reserves that much on
// the opposite edge so the bar never shifts the centred buttons. Recomputed on resize and whenever
diff --git a/apps/client/src/widgets/launch_bar/LauncherDropTarget.css b/apps/client/src/widgets/launch_bar/LauncherDropTarget.css
new file mode 100644
index 0000000000..eb867be01f
--- /dev/null
+++ b/apps/client/src/widgets/launch_bar/LauncherDropTarget.css
@@ -0,0 +1,22 @@
+:where(:root) {
+ --launcher-drop-indicator-color: var(--muted-text-color);
+ --launcher-drop-indicator-inset: 6px;
+}
+
+.launcher-drop-indicator {
+ position: fixed;
+ z-index: 1000;
+ pointer-events: none;
+
+ &::before {
+ content: "";
+ position: absolute;
+ inset: -1px var(--launcher-drop-indicator-inset);
+ border-radius: 1px;
+ background: var(--launcher-drop-indicator-color);
+ }
+
+ &[data-axis="x"]::before {
+ inset: var(--launcher-drop-indicator-inset) -1px;
+ }
+}
diff --git a/apps/client/src/widgets/launch_bar/LauncherDropTarget.spec.tsx b/apps/client/src/widgets/launch_bar/LauncherDropTarget.spec.tsx
new file mode 100644
index 0000000000..7ccabbc8a4
--- /dev/null
+++ b/apps/client/src/widgets/launch_bar/LauncherDropTarget.spec.tsx
@@ -0,0 +1,353 @@
+import { render } from "preact";
+import { useRef } from "preact/hooks";
+import { act } from "preact/test-utils";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+import branches from "../../services/branches";
+import { buildNote } from "../../test/easy-froca";
+import { TREE_CLIPBOARD_TYPE } from "../react/hooks";
+import LauncherDropTarget, {
+ dropNotesOnLaunchBar, findInsertionPoint, getDropAnchor
+} from "./LauncherDropTarget";
+
+vi.mock("../../services/branches", () => ({
+ default: {
+ cloneNoteBefore: vi.fn(async () => {}),
+ cloneNoteAfter: vi.fn(async () => {}),
+ cloneNoteToParentNote: vi.fn(async () => {}),
+ moveBeforeBranch: vi.fn(async () => {}),
+ moveAfterBranch: vi.fn(async () => {}),
+ moveToParentNote: vi.fn(async () => {})
+ }
+}));
+
+const VISIBLE = "_lbVisibleLaunchers";
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ buildNote({
+ id: "_lbRoot",
+ title: "Launch bar",
+ children: [
+ {
+ id: VISIBLE,
+ title: "Visible launchers",
+ children: [
+ { id: "a", title: "A", type: "launcher" },
+ { id: "b", title: "B", type: "launcher" },
+ { id: "c", title: "C", type: "launcher" }
+ ]
+ },
+ {
+ id: "_lbAvailableLaunchers",
+ title: "Available launchers",
+ children: [ { id: "hidden", title: "Hidden", type: "launcher" } ]
+ }
+ ]
+ });
+ buildNote({
+ id: "_lbMobileVisibleLaunchers",
+ title: "Mobile launchers",
+ children: [ { id: "mobile", title: "Mobile", type: "launcher" } ]
+ });
+ buildNote({ id: "n1", title: "First" });
+ buildNote({ id: "n2", title: "Second" });
+});
+
+describe("findInsertionPoint", () => {
+ /** Three items 40 long with gaps of 10. */
+ const spans = [ { start: 0, end: 40 }, { start: 50, end: 90 }, { start: 100, end: 140 } ];
+ const wide = { start: -100, end: 300 };
+
+ it("inserts before the first item whose middle is past the pointer", () => {
+ expect(findInsertionPoint(spans, 30, wide)).toEqual({ index: 1, position: 45 });
+ expect(findInsertionPoint(spans, 119, wide)).toEqual({ index: 2, position: 95 });
+ });
+
+ it("draws the line half a gap out at either end, within the bounds", () => {
+ expect(findInsertionPoint(spans, 10, wide)).toEqual({ index: 0, position: -5 });
+ expect(findInsertionPoint(spans, 120, wide)).toEqual({ index: 3, position: 145 });
+
+ const tight = { start: 0, end: 142 };
+ expect(findInsertionPoint(spans, 10, tight)).toEqual({ index: 0, position: 0 });
+ expect(findInsertionPoint(spans, 500, tight)).toEqual({ index: 3, position: 142 });
+ });
+
+ it("handles a bar with one item or none", () => {
+ expect(findInsertionPoint([ { start: 0, end: 40 } ], 30, wide))
+ .toEqual({ index: 1, position: 40 });
+ expect(findInsertionPoint([], 30, wide)).toEqual({ index: 0, position: -100 });
+ });
+});
+
+describe("getDropAnchor", () => {
+ const shown = [ "a", "b", "c" ];
+
+ it("places the notes before the launcher at the index, or after the last one", () => {
+ expect(getDropAnchor(shown, 1, [ "n1" ])).toEqual({ side: "before", noteId: "b" });
+ expect(getDropAnchor(shown, 3, [ "n1" ])).toEqual({ side: "after", noteId: "c" });
+ });
+
+ it("never anchors on a note being dropped", () => {
+ expect(getDropAnchor(shown, 1, [ "b" ])).toEqual({ side: "before", noteId: "c" });
+ expect(getDropAnchor(shown, 2, [ "c" ])).toEqual({ side: "after", noteId: "b" });
+ expect(getDropAnchor([ "a" ], 0, [ "a" ])).toEqual({ side: "end" });
+ expect(getDropAnchor([], 0, [ "n1" ])).toEqual({ side: "end" });
+ });
+});
+
+describe("dropNotesOnLaunchBar", () => {
+ it("clones the notes next to the anchor, keeping their order", async () => {
+ await dropNotesOnLaunchBar([ "n1", "n2" ], VISIBLE, { side: "before", noteId: "b" });
+ expect(vi.mocked(branches.cloneNoteBefore).mock.calls).toEqual([
+ [ "n1", `${VISIBLE}_b` ],
+ [ "n2", `${VISIBLE}_b` ]
+ ]);
+
+ await dropNotesOnLaunchBar([ "n1", "n2" ], VISIBLE, { side: "after", noteId: "c" });
+ expect(vi.mocked(branches.cloneNoteAfter).mock.calls).toEqual([
+ [ "n2", `${VISIBLE}_c` ],
+ [ "n1", `${VISIBLE}_c` ]
+ ]);
+
+ await dropNotesOnLaunchBar([ "n1" ], VISIBLE, { side: "end" });
+ expect(branches.cloneNoteToParentNote).toHaveBeenCalledWith("n1", VISIBLE);
+ });
+
+ it("moves a launcher of this bar, shown or hidden, and skips one of another bar", async () => {
+ const beforeC = { side: "before", noteId: "c" } as const;
+ await dropNotesOnLaunchBar([ "a", "hidden", "mobile" ], VISIBLE, beforeC);
+ expect(vi.mocked(branches.moveBeforeBranch).mock.calls).toEqual([
+ [ [ `${VISIBLE}_a` ], `${VISIBLE}_c` ],
+ [ [ "_lbAvailableLaunchers_hidden" ], `${VISIBLE}_c` ]
+ ]);
+
+ await dropNotesOnLaunchBar([ "hidden" ], VISIBLE, { side: "end" });
+ expect(branches.moveToParentNote)
+ .toHaveBeenCalledWith([ "_lbAvailableLaunchers_hidden" ], `_lbRoot_${VISIBLE}`);
+
+ expect(branches.cloneNoteBefore).not.toHaveBeenCalled();
+ expect(branches.cloneNoteToParentNote).not.toHaveBeenCalled();
+ });
+});
+
+describe("LauncherDropTarget", () => {
+ let container: HTMLDivElement | undefined;
+
+ afterEach(() => {
+ const mounted = container;
+ if (mounted) {
+ act(() => render(null, mounted));
+ mounted.remove();
+ container = undefined;
+ }
+ vi.useRealTimers();
+ });
+
+ /**
+ * Mounts a bar of the given launchers, each slot holding one element measured at its rect. An
+ * element without a rect measures zero, like a launcher that renders an empty element.
+ */
+ function mountBar(
+ launchers: Record<string, DOMRect | null>,
+ barRect: DOMRect,
+ isHorizontalLayout = false
+ ) {
+ function Harness() {
+ const ref = useRef<HTMLDivElement>(null);
+ return (
+ <div ref={ref} className="bar">
+ {Object.keys(launchers).map((noteId) => (
+ <div key={noteId} className="launcher-slot" data-launcher-id={noteId}>
+ <button type="button" />
+ </div>
+ ))}
+ <LauncherDropTarget
+ containerRef={ref}
+ parentNoteId={VISIBLE}
+ isHorizontalLayout={isHorizontalLayout}
+ />
+ </div>
+ );
+ }
+
+ const host = document.createElement("div");
+ container = host;
+ document.body.appendChild(host);
+ act(() => render(<Harness />, host));
+
+ const bar = host.querySelector<HTMLElement>(".bar");
+ if (!bar) throw new Error("The bar did not render.");
+ bar.getBoundingClientRect = () => barRect;
+ for (const [ noteId, rect ] of Object.entries(launchers)) {
+ const button = bar.querySelector(`[data-launcher-id="${noteId}"] button`);
+ if (button && rect) {
+ button.getBoundingClientRect = () => rect;
+ }
+ }
+ return bar;
+ }
+
+ /** A vertical bar 53 wide with launchers 40 tall and gaps of 10, and one of zero size. */
+ function mountVerticalBar() {
+ return mountBar({
+ a: new DOMRect(6, 10, 41, 40),
+ empty: null,
+ b: new DOMRect(6, 60, 41, 40),
+ c: new DOMRect(6, 110, 41, 40)
+ }, new DOMRect(0, 0, 53, 400));
+ }
+
+ function drag(target: Element, type: string, init: {
+ x?: number,
+ y?: number,
+ types?: string[],
+ text?: string,
+ relatedTarget?: EventTarget | null
+ } = {}) {
+ const event = new Event(type, { bubbles: true, cancelable: true });
+ for (const [ name, value ] of Object.entries({
+ clientX: init.x ?? 0,
+ clientY: init.y ?? 0,
+ relatedTarget: init.relatedTarget ?? null,
+ dataTransfer: {
+ types: init.types ?? [ TREE_CLIPBOARD_TYPE ],
+ dropEffect: "none",
+ getData: (format: string) => (format === "text" ? init.text ?? "" : "")
+ }
+ })) {
+ Object.defineProperty(event, name, { value, configurable: true });
+ }
+ act(() => {
+ target.dispatchEvent(event);
+ });
+ return event;
+ }
+
+ function indicator() {
+ return document.body.querySelector<HTMLElement>(".launcher-drop-indicator");
+ }
+
+ it("draws the line where a dragged note goes, outside the bar's own layout", () => {
+ const bar = mountVerticalBar();
+
+ // Above the middle of B, so between A and B.
+ const event = drag(bar, "dragover", { y: 70 });
+ expect(event.defaultPrevented).toBe(true);
+ const line = indicator();
+ expect(line).not.toBeNull();
+ expect(bar.contains(line)).toBe(false);
+ expect(line?.dataset.axis).toBe("y");
+ expect(line?.style.top).toBe("55px");
+ expect(line?.style.left).toBe("0px");
+ expect(line?.style.width).toBe("53px");
+ expect(line?.style.height).toBe("0px");
+
+ // Past the middle of C, so after the last launcher.
+ drag(bar, "dragover", { y: 140 });
+ expect(indicator()?.style.top).toBe("155px");
+ });
+
+ it("ignores a drag that holds no notes", () => {
+ const bar = mountVerticalBar();
+
+ const event = drag(bar, "dragover", { y: 70, types: [ "Files" ] });
+ expect(event.defaultPrevented).toBe(false);
+ expect(indicator()).toBeNull();
+ });
+
+ it("removes the line once the drag leaves the bar or stops arriving", () => {
+ vi.useFakeTimers();
+ const bar = mountVerticalBar();
+ const launcher = bar.querySelector("button");
+ expect(launcher).not.toBeNull();
+
+ drag(bar, "dragover", { y: 70 });
+ drag(bar, "dragleave", { relatedTarget: launcher });
+ expect(indicator()).not.toBeNull();
+ drag(bar, "dragleave", { relatedTarget: document.body });
+ expect(indicator()).toBeNull();
+
+ drag(bar, "dragover", { y: 70 });
+ act(() => {
+ vi.advanceTimersByTime(500);
+ });
+ expect(indicator()).not.toBeNull();
+ act(() => {
+ vi.advanceTimersByTime(600);
+ });
+ expect(indicator()).toBeNull();
+ });
+
+ it("drops the notes where the line is, skipping launchers that render nothing", async () => {
+ const bar = mountVerticalBar();
+ const text = JSON.stringify([ { noteId: "n1", branchId: "root_n1", title: "First" } ]);
+
+ drag(bar, "dragover", { y: 70 });
+ const event = drag(bar, "drop", { y: 70, text });
+ await act(async () => {
+ await new Promise((resolve) => setTimeout(resolve));
+ });
+
+ expect(event.defaultPrevented).toBe(true);
+ expect(indicator()).toBeNull();
+ expect(branches.cloneNoteBefore).toHaveBeenCalledWith("n1", `${VISIBLE}_b`);
+
+ drag(bar, "drop", { y: 70, text: "not json" });
+ await act(async () => {
+ await new Promise((resolve) => setTimeout(resolve));
+ });
+ expect(branches.cloneNoteBefore).toHaveBeenCalledTimes(1);
+ });
+
+ it("follows a right-to-left horizontal bar in its reading order", () => {
+ // The launchers run leftwards from the right end.
+ const bar = mountBar({
+ a: new DOMRect(300, 6, 40, 41),
+ b: new DOMRect(250, 6, 40, 41),
+ c: new DOMRect(200, 6, 40, 41)
+ }, new DOMRect(0, 0, 400, 53), true);
+ bar.style.direction = "rtl";
+
+ // Right of the middle of B, so between A and B.
+ drag(bar, "dragover", { x: 285 });
+ expect(indicator()?.dataset.axis).toBe("x");
+ expect(indicator()?.style.left).toBe("295px");
+ expect(indicator()?.style.height).toBe("53px");
+
+ drag(bar, "dragover", { x: 255 });
+ expect(indicator()?.style.left).toBe("245px");
+ });
+
+ it("scrolls the bar while a note is held near its end, and moves the line with it", () => {
+ vi.useFakeTimers();
+ const bar = mountVerticalBar();
+ for (const [ name, value ] of Object.entries({ clientHeight: 400, scrollHeight: 1000 })) {
+ Object.defineProperty(bar, name, { value, configurable: true });
+ }
+
+ drag(bar, "dragover", { y: 395 });
+ act(() => {
+ vi.advanceTimersByTime(200);
+ });
+ expect(bar.scrollTop).toBeGreaterThan(0);
+
+ // The launchers moved up under a still pointer.
+ const lineBefore = indicator()?.style.top;
+ for (const [ index, button ] of [ ...bar.querySelectorAll("button") ].entries()) {
+ button.getBoundingClientRect = () => new DOMRect(6, 300 + index * 50, 41, 40);
+ }
+ act(() => {
+ bar.dispatchEvent(new Event("scroll"));
+ });
+ expect(indicator()?.style.top).not.toBe(lineBefore);
+
+ // Leaving the bar stops the scrolling.
+ drag(bar, "dragleave", { relatedTarget: document.body });
+ const scrolled = bar.scrollTop;
+ act(() => {
+ vi.advanceTimersByTime(200);
+ });
+ expect(bar.scrollTop).toBe(scrolled);
+ });
+});
diff --git a/apps/client/src/widgets/launch_bar/LauncherDropTarget.tsx b/apps/client/src/widgets/launch_bar/LauncherDropTarget.tsx
new file mode 100644
index 0000000000..36266d59a1
--- /dev/null
+++ b/apps/client/src/widgets/launch_bar/LauncherDropTarget.tsx
@@ -0,0 +1,336 @@
+import "./LauncherDropTarget.css";
+
+import { createPortal, type RefObject } from "preact";
+import { useEffect, useState } from "preact/hooks";
+
+import branches from "../../services/branches";
+import froca from "../../services/froca";
+import { createEdgeScroller } from "../react/edge_scroll";
+import { TREE_CLIPBOARD_TYPE } from "../react/hooks";
+
+/** How near an end of the bar a drag starts to scroll it, in pixels. */
+const EDGE_SCROLL_MARGIN = 40;
+
+/** How fast the bar scrolls with the pointer at its very end, in pixels a second. */
+const EDGE_SCROLL_SPEED = 600;
+
+/** How long the drop target waits for the next `dragover` before it treats the drag as ended. */
+const DRAG_TIMEOUT = 1000;
+
+/** The root of the hidden launchers, for each root of the visible ones. */
+const AVAILABLE_LAUNCHERS_ROOTS: Record<string, string> = {
+ _lbVisibleLaunchers: "_lbAvailableLaunchers",
+ _lbMobileVisibleLaunchers: "_lbMobileAvailableLaunchers"
+};
+
+interface LauncherDropTargetProps {
+ /** The bar element; each launcher is rendered in one of its `.launcher-slot` children. */
+ containerRef: RefObject<HTMLElement | null>;
+ /** The note whose children are the launchers in the bar. */
+ parentNoteId: string;
+ isHorizontalLayout: boolean;
+}
+
+/**
+ * Accepts notes dragged from the note tree onto the launch bar. A line shows where they go; a drop
+ * clones them there, or moves them when they are already in the launch bar.
+ */
+export default function LauncherDropTarget({
+ containerRef, parentNoteId, isHorizontalLayout
+}: LauncherDropTargetProps) {
+ const [ marker, setMarker ] = useState<MarkerBox | null>(null);
+
+ useEffect(() => {
+ const container = containerRef.current;
+ if (!container) return;
+
+ const axis = isHorizontalLayout ? "x" : "y";
+ const scroller = createEdgeScroller({
+ margin: EDGE_SCROLL_MARGIN,
+ speed: EDGE_SCROLL_SPEED
+ });
+ let pointer: { x: number, y: number } | null = null;
+ let timeout: ReturnType<typeof setTimeout> | undefined;
+
+ const update = () => {
+ if (pointer) {
+ setMarker(locateDrop(container, isHorizontalLayout, pointer.x, pointer.y).marker);
+ }
+ };
+
+ const stop = () => {
+ clearTimeout(timeout);
+ pointer = null;
+ scroller.stop();
+ setMarker(null);
+ };
+
+ const onDragOver = (e: DragEvent) => {
+ if (!isNoteDrag(e)) return;
+
+ // Accepts the drop.
+ e.preventDefault();
+ if (e.dataTransfer) {
+ e.dataTransfer.dropEffect = "copy";
+ }
+
+ pointer = { x: e.clientX, y: e.clientY };
+ scroller.update([ { element: container, axis } ], e.clientX, e.clientY);
+ update();
+
+ // Stops the edge scrolling if the drag ends without a `dragleave` or `drop` here.
+ clearTimeout(timeout);
+ timeout = setTimeout(stop, DRAG_TIMEOUT);
+ };
+
+ const onDragLeave = (e: DragEvent) => {
+ if (e.relatedTarget instanceof Node && container.contains(e.relatedTarget)) return;
+ stop();
+ };
+
+ const onDrop = (e: DragEvent) => {
+ if (!isNoteDrag(e)) return;
+
+ e.preventDefault();
+ const { index, noteIds } =
+ locateDrop(container, isHorizontalLayout, e.clientX, e.clientY);
+ stop();
+
+ const droppedNoteIds = readDroppedNoteIds(e);
+ const anchor = getDropAnchor(noteIds, index, droppedNoteIds);
+ void dropNotesOnLaunchBar(droppedNoteIds, parentNoteId, anchor);
+ };
+
+ container.addEventListener("dragenter", onDragOver);
+ container.addEventListener("dragover", onDragOver);
+ container.addEventListener("dragleave", onDragLeave);
+ container.addEventListener("drop", onDrop);
+ container.addEventListener("scroll", update, { passive: true });
+
+ return () => {
+ container.removeEventListener("dragenter", onDragOver);
+ container.removeEventListener("dragover", onDragOver);
+ container.removeEventListener("dragleave", onDragLeave);
+ container.removeEventListener("drop", onDrop);
+ container.removeEventListener("scroll", update);
+ stop();
+ };
+ }, [ containerRef, parentNoteId, isHorizontalLayout ]);
+
+ return marker && createPortal(
+ <div
+ className="launcher-drop-indicator"
+ data-axis={isHorizontalLayout ? "x" : "y"}
+ style={{
+ left: `${marker.left}px`,
+ top: `${marker.top}px`,
+ width: `${marker.width}px`,
+ height: `${marker.height}px`
+ }}
+ />,
+ document.body
+ );
+}
+
+/** An extent along the bar, with coordinates growing in reading order. */
+export interface Span {
+ start: number;
+ end: number;
+}
+
+/** Where the drop indicator goes on the screen: a box of zero thickness along the bar. */
+interface MarkerBox {
+ left: number;
+ top: number;
+ width: number;
+ height: number;
+}
+
+/**
+ * Finds where an item dropped at `pointer` goes among `spans`, which are in their order along the
+ * bar.
+ *
+ * @returns the index to insert at, and the position of the line between the two neighbors,
+ * kept within `bounds`.
+ */
+export function findInsertionPoint(spans: Span[], pointer: number, bounds: Span) {
+ let index = spans.findIndex((span) => pointer < (span.start + span.end) / 2);
+ if (index === -1) {
+ index = spans.length;
+ }
+
+ const previous: Span | undefined = spans[index - 1];
+ const next: Span | undefined = spans[index];
+ let position: number;
+ if (previous && next) {
+ position = (previous.end + next.start) / 2;
+ } else if (next) {
+ // At either end, the line is half a gap out from the item, as it is between two items.
+ position = next.start - gapAfter(spans, 0) / 2;
+ } else if (previous) {
+ position = previous.end + gapAfter(spans, spans.length - 2) / 2;
+ } else {
+ position = bounds.start;
+ }
+
+ return {
+ index,
+ position: Math.min(Math.max(position, bounds.start), bounds.end)
+ };
+}
+
+/** The space between the span at `index` and the next one; 0 without both. */
+function gapAfter(spans: Span[], index: number) {
+ const span: Span | undefined = spans[index];
+ const next: Span | undefined = spans[index + 1];
+ return span && next ? Math.max(0, next.start - span.end) : 0;
+}
+
+export type DropAnchor =
+ | { side: "before" | "after", noteId: string }
+ | { side: "end" };
+
+/**
+ * Picks the launcher that dropped notes are placed next to.
+ *
+ * @param noteIds the launchers shown in the bar, in order.
+ * @param index where the drop goes among them.
+ * @param droppedNoteIds the notes being dropped, which can already be in the bar and so cannot be
+ * the anchor.
+ */
+export function getDropAnchor(
+ noteIds: string[],
+ index: number,
+ droppedNoteIds: string[]
+): DropAnchor {
+ const isDropped = (noteId: string) => droppedNoteIds.includes(noteId);
+
+ const next = noteIds.slice(index).find((noteId) => !isDropped(noteId));
+ if (next) {
+ return { side: "before", noteId: next };
+ }
+
+ const previous = noteIds.slice(0, index).findLast((noteId) => !isDropped(noteId));
+ if (previous) {
+ return { side: "after", noteId: previous };
+ }
+
+ return { side: "end" };
+}
+
+/**
+ * Puts the notes into the launch bar under `parentNoteId`, next to `anchor`, in their order. A note
+ * that is already a launcher of this bar, shown or hidden, is moved there; any other note is cloned
+ * there. A launcher of another bar is skipped.
+ */
+export async function dropNotesOnLaunchBar(
+ noteIds: string[],
+ parentNoteId: string,
+ anchor: DropAnchor
+) {
+ const anchorBranchId = anchor.side === "end"
+ ? undefined
+ : froca.getNoteFromCache(anchor.noteId)?.parentToBranch[parentNoteId];
+ const availableRootId = AVAILABLE_LAUNCHERS_ROOTS[parentNoteId];
+ // Placing each note right after the anchor reverses their order, so the last one goes first.
+ const orderedNoteIds = anchor.side === "after" ? [ ...noteIds ].reverse() : noteIds;
+
+ for (const noteId of orderedNoteIds) {
+ const note = await froca.getNote(noteId);
+ if (!note) continue;
+
+ const branchId = note.parentToBranch[parentNoteId] ?? note.parentToBranch[availableRootId];
+ if (!branchId && note.type === "launcher") continue;
+
+ if (anchor.side === "before" && anchorBranchId) {
+ await (branchId
+ ? branches.moveBeforeBranch([ branchId ], anchorBranchId)
+ : branches.cloneNoteBefore(noteId, anchorBranchId));
+ } else if (anchor.side === "after" && anchorBranchId) {
+ await (branchId
+ ? branches.moveAfterBranch([ branchId ], anchorBranchId)
+ : branches.cloneNoteAfter(noteId, anchorBranchId));
+ } else if (branchId) {
+ const parentBranchId = froca.getNoteFromCache(parentNoteId)?.getParentBranchIds()[0];
+ if (parentBranchId) {
+ await branches.moveToParentNote([ branchId ], parentBranchId);
+ }
+ } else {
+ await branches.cloneNoteToParentNote(noteId, parentNoteId);
+ }
+ }
+}
+
+/** Whether the drag contains notes from the note tree, the only drag the launch bar accepts. */
+function isNoteDrag(e: DragEvent) {
+ return !!e.dataTransfer?.types.includes(TREE_CLIPBOARD_TYPE);
+}
+
+function readDroppedNoteIds(e: DragEvent): string[] {
+ try {
+ const dropped: unknown = JSON.parse(e.dataTransfer?.getData("text") ?? "");
+ if (!Array.isArray(dropped)) {
+ return [];
+ }
+ return dropped
+ .map((item: { noteId?: unknown }) => item?.noteId)
+ .filter((noteId): noteId is string => typeof noteId === "string");
+ } catch {
+ return [];
+ }
+}
+
+/** Measures the bar for a drop at `x`, `y`: where it goes, and where the indicator is drawn. */
+function locateDrop(container: HTMLElement, isHorizontalLayout: boolean, x: number, y: number) {
+ // In a right-to-left bar the launchers run leftwards, so x coordinates are negated.
+ const isRtl = isHorizontalLayout && getComputedStyle(container).direction === "rtl";
+ const toSpan = (rect: DOMRect): Span => {
+ if (!isHorizontalLayout) {
+ return { start: rect.top, end: rect.bottom };
+ }
+ return isRtl
+ ? { start: -rect.right, end: -rect.left }
+ : { start: rect.left, end: rect.right };
+ };
+
+ const launchers = measureLaunchers(container, toSpan);
+ const box = container.getBoundingClientRect();
+ const pointer = isHorizontalLayout ? (isRtl ? -x : x) : y;
+ const { index, position } = findInsertionPoint(launchers, pointer, toSpan(box));
+
+ const marker: MarkerBox = isHorizontalLayout
+ ? { left: isRtl ? -position : position, top: box.top, width: 0, height: box.height }
+ : { left: box.left, top: position, width: box.width, height: 0 };
+
+ return { index, noteIds: launchers.map((launcher) => launcher.noteId), marker };
+}
+
+/** The extent of each launcher that renders something, in the order of the bar. */
+function measureLaunchers(container: HTMLElement, toSpan: (rect: DOMRect) => Span) {
+ const launchers: (Span & { noteId: string })[] = [];
+
+ for (const slot of container.children) {
+ const noteId = slot instanceof HTMLElement ? slot.dataset.launcherId : undefined;
+ if (!noteId) continue;
+
+ let span: Span | null = null;
+ for (const child of slot.children) {
+ const rect = child.getBoundingClientRect();
+ if (!rect.width && !rect.height) continue;
+
+ const childSpan = toSpan(rect);
+ span = span
+ ? {
+ start: Math.min(span.start, childSpan.start),
+ end: Math.max(span.end, childSpan.end)
+ }
+ : childSpan;
+ }
+
+ if (span) {
+ launchers.push({ noteId, ...span });
+ }
+ }
+
+ return launchers;
+}
diff --git a/apps/server/internal.openapi.yaml b/apps/server/internal.openapi.yaml
index 368c7bee46..15d259d054 100644
--- a/apps/server/internal.openapi.yaml
+++ b/apps/server/internal.openapi.yaml
@@ -1149,7 +1149,27 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Branch'
-
+
+ /api/notes/{noteId}/clone-before/{beforeBranchId}:
+ put:
+ tags: [Tree, Notes]
+ summary: Clone note before branch
+ operationId: cloneBeforeBranch
+ parameters:
+ - $ref: '#/components/parameters/noteId'
+ - name: beforeBranchId
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Note cloned
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Branch'
+
/api/notes/{noteId}/toggle-in-parent/{parentNoteId}/{present}:
put:
tags: [Tree, Notes]
diff --git a/apps/server/src/assets/help/help_content.json b/apps/server/src/assets/help/help_content.json
index 7e235d235d..7c9019c79a 100644
--- a/apps/server/src/assets/help/help_content.json
+++ b/apps/server/src/assets/help/help_content.json
@@ -43,7 +43,7 @@
"_help_DvdZhoQZY9Yd": "<p>The&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;comes with multiple keyboard shortcuts to make editing faster:</p><h2>Navigation within the tree</h2><ul><li><kbd><span>↑</span></kbd> and <kbd><span>↑</span></kbd> to navigate between notes.</li><li><kbd><span>←</span></kbd> to collapse a note with children, or <kbd><span>→</span></kbd> to expand it.</li><li><kbd><span>←</span></kbd> on a note with no children to navigate to its parent.</li></ul><h2>Opening notes</h2><ul><li><kbd>Click</kbd> to open the note in the current tab.</li><li><kbd>Ctrl</kbd>+<kbd>Click</kbd> or <kbd>Middle click</kbd> to open the note in a new tab.</li><li><kbd>Ctrl</kbd>+<kbd>Right click</kbd> to open the note in&nbsp;<a class=\"reference-link\" href=\"#root/_help_ZjLYv08Rp3qC\">Quick edit</a>.</li></ul><h2>Clipboard management</h2><ul><li><kbd>Ctrl</kbd>+<kbd>C</kbd> to copy one or more notes based on selection (see&nbsp;<a class=\"reference-link\" href=\"#root/_help_IakOLONlIfGI\">Cloning Notes</a>).</li><li><kbd>Ctrl</kbd>+<kbd>X</kbd> to cut one or more notes (for moving them).</li><li><kbd>Ctrl</kbd>+<kbd>V</kbd> to paste them somewhere (which results in a copy or move based on the shortcut used).</li></ul><h2>Moving notes</h2><ul><li><kbd>Ctrl</kbd> + <kbd><span>↑</span></kbd> , <kbd>Ctrl</kbd> + <kbd><span>↓</span></kbd> - move note up/down in the note list.</li><li><kbd>Ctrl</kbd> + <kbd><span>←</span></kbd> - move note up in the note tree.</li><li><kbd>Ctrl</kbd>+<kbd><span>→</span></kbd> - move note down in the note tree.</li><li><kbd>Del</kbd> - deletes note and optionally its subtree (asked in the dialog).</li><li><kbd>Alt</kbd>+<kbd>S</kbd> - sorts the child notes of the note (see&nbsp;<a class=\"reference-link\" href=\"#root/_help_aGlEvb9hyDhS\">Sorting Notes</a>).</li></ul><h2>Multiple selection</h2><p>See&nbsp;<a class=\"reference-link\" href=\"#root/_help_yTjUdsOi4CIE\">Multiple selection</a>&nbsp;for more information about how selection works.</p><ul><li><kbd>Alt</kbd>+<kbd>Click</kbd> – add a single note to the current selection.</li><li><kbd>Shift</kbd>+<kbd>Click</kbd> – select a range of notes, starting from the current note (the highlighted one) to the one that is being clicked.</li><li><kbd>Shift</kbd>+<kbd><span>↑</span></kbd>, <kbd>Shift</kbd>+<kbd><span>↓</span></kbd> – multi-select not above/below.</li><li><kbd>Ctrl</kbd>+<kbd>A</kbd> – select all notes in the current level</li></ul>",
"_help_wyaGBBQrl4i3": "<figure class=\"image image-style-align-right\"><img style=\"aspect-ratio:328/45;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree/1_Hiding%20the%20subtree_image.png\" width=\"328\" height=\"45\"><figcaption>An example of a collection with a relatively large number of children that are hidden from the tree.</figcaption></figure><p>The tree works well when the notes are structured in a hierarchy so that the number of items stays small. When a note has a large number of notes (in the order of thousands or tens of thousands), two problems arise:</p><ul><li>Navigating between notes becomes cumbersome and the tree itself gets cluttered with a large amount of notes.</li><li>The large amount of notes can slow down the application considerably.</li></ul><p>Since v0.102.0, Trilium allows the tree to hide the child notes of particular notes. This works for both&nbsp;<a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a>&nbsp;and normal notes.</p><h2>Interaction</h2><p>When the subtree of a note is hidden, there are a few subtle changes:</p><ul><li>To indicate that the subtree is hidden, the note will not have an expand button and it will display the number of children to the right.</li><li>It's not possible to add a new note directly from the tree.<ul><li>For&nbsp;<a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a>, it's best to use the built-in mechanism to create notes (for example by creating a new point on a geo-map, or by adding a new row in a table).</li><li>For normal notes, it's still possible to create children via other means such as using the&nbsp;<a class=\"reference-link\" href=\"#root/_help_hrZ1D00cLbal\">Internal (reference) links</a>&nbsp;system.</li></ul></li><li>Notes can be dragged from outside the note, case in which they will be cloned into it.<ul><li>Instead of switching to the child notes that were copied, the parent note is highlighted instead.</li><li>A notification will indicate this behavior.</li></ul></li><li>Similarly, features such as cut/copy and then paste into the note will also work.</li></ul><h2>Spotlighting</h2><figure class=\"image image-style-align-right\"><img style=\"aspect-ratio:322/83;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Note%20Tree/Hiding%20the%20subtree_image.png\" width=\"322\" height=\"83\"></figure><p>Even if the subtree of a note is hidden, if a child note manages to become active, it will still appear inside the tree in a special state called <em>spotlighted</em>.</p><p>During this state, the note remains under its normal hierarchy, so that its easy to tell its location. In addition, this means that:</p><ul><li>The note position is clearly visible when using the&nbsp;<a class=\"reference-link\" href=\"#root/_help_eIg8jdvaoNNd\">Search</a>.</li><li>The note can still be operated on from the tree, such as adding a&nbsp;<a class=\"reference-link\" href=\"#root/_help_TBwsyfadTA18\">Branch prefix</a>&nbsp;or moving it outside the collection.</li></ul><p>The note appears in italics to indicate its temporary display. When switching to another note, the spotlighted note will disappear.</p><aside class=\"admonition note\"><p>Only one note can be highlighted at the time. When working with multiple notes such as dragging them into the collection, no note will be spotlighted. This is intentional to avoid displaying a partial state of the subtree.</p></aside><h2>Working with collections</h2><p>For large collections, it can be helpful to hide their child notes for performance reasons or de-cluttering the tree.</p><p>To toggle this behavior:</p><ul><li>Open the collection and in&nbsp;<a class=\"reference-link\" href=\"#root/_help_CssoWBu8I7jF\">Collection Properties</a>, look for <em>Hide child notes in tree</em>.</li><li>Right click the collection note in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;and select <em>Advanced</em> → <em>Show subtree</em>.</li></ul><h2>Working with normal notes</h2><p>It's possible to hide the subtree for normal notes as well, not just collections. To do so, right click the note in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;and select <em>Advanced</em> → <em>Hide subtree.</em></p>",
"_help_3seOhtN8uLIY": "<figure class=\"image image-style-align-center\"><img style=\"aspect-ratio:1119/43;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Tabs_image.png\" width=\"1119\" height=\"43\"></figure><p>In Trilium, tabs allow easy switching between notes.</p><h2>Layout</h2><p>Depending on the&nbsp;<a class=\"reference-link\" href=\"#root/_help_x0JgW8UqGXvq\">Vertical and horizontal layout</a>:</p><ul><li>For the vertical layout, the tabs will be placed at the top but to the right of the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>.</li><li>For the horizontal layout, the tabs will be placed at the top in full-width, above the&nbsp;<a href=\"#root/_help_oPVyFC7WL2Lp\">note tree</a>, allowing for more tabs to be comfortably displayed.</li></ul><h2>Interaction</h2><ul><li>To create a new tab, press the&nbsp;<span class=\"tn-icon bx bx-plus\"></span> button that is to the right of the last tab.</li><li>Right-clicking the <span class=\"tn-icon bx bx-plus\"></span> button shows a menu with <em>New tab</em> and, if there are any <a class=\"reference-link\" href=\"#root/_help_9sRHySam5fXb\">Workspaces</a>, one entry per workspace, which opens the workspace in a new tab, hoisted into it.</li><li>To close a tab, press the corresponding&nbsp;<span class=\"tn-icon bx bx-x\"></span> button.</li><li>For multitasking, tabs can be used alongside&nbsp;<a class=\"reference-link\" href=\"#root/_help_luNhaphA37EO\">Split View</a>. Each tab can have one or more notes, displayed horizontally.</li><li>Tabs can be reordered by drag-and-dropping it into a new position.</li><li>An existing tab can be displayed in a new window by dragging the tab upwards or downwards. It is not possible to combine tabs back into another window.</li></ul><h2>Keyboard interaction</h2><p>Since tabs are a commonly used feature, there are multiple keyboard shortcuts that can be used:</p><ul><li><kbd>Ctrl</kbd>+<kbd>T</kbd> to open a new tab.</li><li><kbd>Ctrl</kbd>+<kbd>W</kbd> to close the current tab.</li><li><kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd> to reopen the last closed tab.</li><li><kbd>Ctrl</kbd>+<kbd>Tab</kbd> and <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd> to go to the next or previous tab.</li><li><kbd>Ctrl</kbd>+<kbd>1</kbd>, <kbd>Ctrl</kbd>+<kbd>2</kbd>, up to <kbd>Ctrl</kbd>+<kbd>9</kbd> to activate the first, second and up to ninth tab.</li><li>There is also a shortcut to go to the last tab, but it is not assigned a key by default.</li></ul><h2>Full screen</h2><p>To show Trilium in full screen, press <kbd>F11</kbd> or the <span class=\"tn-icon bx bx-expand-alt\"></span> <em>Fullscreen</em> button in the <a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>. While in full screen, the tab bar shows a <span class=\"tn-icon bx bx-exit-fullscreen\"></span> <em>Leave full screen</em> button before the <a class=\"reference-link\" href=\"#root/_help_RnaPdbciOfeq\">Right Sidebar</a> toggle; press it to return to the normal window.</p><h2>Background tabs</h2><p>When Trilium starts, it reopens the tabs from the previous session. Only the active tab loads its note right away; every other tab loads its note the first time you switch to it. This keeps startup fast when many tabs are open, especially tabs that show collections.</p><p>The same applies to a tab opened in the background, for example with a middle click or <kbd>Ctrl</kbd>+click on a link.</p><h2>Mobile</h2><figure class=\"image image-style-align-right image_resized\" style=\"width:34.12%;\"><img style=\"aspect-ratio:1242/2688;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Tabs_IMG_1767.PNG\" width=\"1242\" height=\"2688\"></figure><p>Tabs are also supported on the&nbsp;<a class=\"reference-link\" href=\"#root/_help_RDslemsQ6gCp\">Mobile Frontend</a>.</p><p>Since v0.102.0, the tabs are displayed by pressing the dedicated tab switcher button in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>. In this view the tabs are laid out on a grid with a preview of the note content.</p><p>The context menu button at the top-right of the popup allows creating a new tab, reopening the last closed tab and closing all the tabs.</p><p><a class=\"reference-link\" href=\"#root/_help_luNhaphA37EO\">Split View</a>s are also indicated in the tab switcher, with two titles displayed in a tab.</p><aside class=\"admonition note\"><p>Versions prior to v0.102.0 also supported tabs, but they were displayed directly above the&nbsp;<a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>. The decision to use a more mobile-like tab switcher was taken because the original tab bar could not support many tabs at once and the new design better aligns with how mobile applications handle tabs.</p></aside>",
- "_help_xYmIYSP6wE3F": "<h2>Position of the Launch bar</h2><p>On desktop, depending on the layout selected, the launcher bar will either be on the left side of the screen with buttons displayed vertically or at the top of the screen. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_x0JgW8UqGXvq\">Vertical and horizontal layout</a>&nbsp;for more information.</p><p>On mobile, the launch bar will always be at the bottom.</p><p>If there are too many items in the launch bar to fit the screen, it will become scrollable.</p><h2>Terminology</h2><ul><li><strong>Launcher</strong>: a button that can be (or is) displayed on the launch bar.</li><li><strong>Available Launcher</strong>: a launcher that is not displayed on the launch bar, but can be added.</li><li><strong>Visible Launcher</strong>: a launcher that is currently displayed on the launch bar.</li></ul><h2>Configuring the desktop Launch bar</h2><p>There are two ways to configure the launch bar:</p><ul><li>Right click in the empty space between launchers on the launch bar and select <em>Configure launch bar…</em></li><li>Click on the&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>&nbsp;and select <em>Configure launch bar</em>.</li></ul><p>This will open a new tab with the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;listing the launchers.</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Launch%20Bar_image.jpg\"></p><p>Expanding <em>Available Launchers</em> section will show the list of launchers that are not displayed on the launch bar. The <em>Visible Launchers</em> will show the ones that are currently displayed.</p><h2>Configuring the mobile launch bar</h2><p>The launch bar on mobile uses a different configuration from the desktop one. The reasoning is that not all desktop icons are available on mobile, and fewer icons fit on a mobile screen.</p><p>To configure the launch bar on mobile, go to&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>&nbsp;and select <em>Configure launch bar</em>.</p><p>The configure the mobile launch bar while on the desktop (especially useful to configure more complicated launchers such as scripts or custom widgets), go to&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>&nbsp;→ Advanced → Hidden notes and look for the <em>Mobile Launch Bar</em> section. While in the hidden subtree, it's also possible to drag launchers between the <em>Mobile Launch Bar</em> and (Desktop) <em>Launch Bar</em> sections.</p><h3>Adding/removing and reordering launchers</h3><p>To display a new launcher in the launch bar, first look for it in the <em>Available Launchers</em> section. Then right click it and select <em>Move to visible launchers</em>. It is also possible to drag and drop the item manually.</p><p>Similarly, to remove it from the launch bar, simply look for it in <em>Visible Launchers</em> then right click it and select <em>Move to available launchers</em> or use drag-and-drop.</p><p>Drag-and-drop the items in the&nbsp;tree&nbsp;in order to change their order. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;for more interaction options, including using keyboard shortcuts.</p><h2>Customizing the launcher</h2><ul><li>The icon of a launcher can be changed just like a normal note. See&nbsp;<a href=\"#root/_help_p9kXRFAkwN4o\">note icons</a>&nbsp;for more information.</li><li>The title of the launcher can also be changed.</li></ul><h3>Resetting</h3><p>Resetting allows restoring the original configuration of Trilium for the launcher bar, or for a portion of it. Simply right click a launcher (or even the entire <em>Launch Bar</em> section) and select <em>Reset</em> to bring it back to the original state.</p><h3>Creating new launchers / types of launchers</h3><p>Right click either the <em>Available launchers</em> or <em>Visible launchers</em> sections and select one of the options:</p><ol><li><p><strong>Note Launcher</strong><br>A note launcher will simply navigate to a specified note.</p><ol><li>Set the <code>target</code> promoted attribute to the note to navigate to.</li><li>Optionally, set <code>hoistedNote</code> to hoist a particular note. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_OR8WJ7Iz9K4U\">Note Hoisting</a>&nbsp;for more information.</li><li>Optionally, set a <code>keyboardShortcut</code> to trigger the launcher.</li></ol></li><li><p><strong>Script Launcher</strong><br>An advanced launcher which will run a script upon pressing. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_CdNpE2pqjmI6\">Scripting</a>&nbsp;for more information.</p><ol><li>Set <code>script</code> to point to the desired script to run.</li><li>Optionally, set a <code>keyboardShortcut</code> to trigger the launcher.</li></ol></li><li><p><strong>Custom Widget</strong></p><p>Allows defining a custom widget to be rendered inside the launcher. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_SynTBQiBsdYJ\">Widget Basics</a>&nbsp;for more information.</p></li><li><p><strong>Spacers</strong><br>Launchers that create some distance between other launchers for better visual distinction.</p></li></ol><p>Launchers are configured via predefined&nbsp;<a class=\"reference-link\" href=\"#root/_help_OFXdgB2nNk1F\">Promoted Attributes</a>.</p>",
+ "_help_xYmIYSP6wE3F": "<h2>Position of the Launch bar</h2><p>On desktop, depending on the layout selected, the launcher bar will either be on the left side of the screen with buttons displayed vertically or at the top of the screen. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_x0JgW8UqGXvq\">Vertical and horizontal layout</a>&nbsp;for more information.</p><p>On mobile, the launch bar will always be at the bottom.</p><p>If there are too many items in the launch bar to fit the screen, it will become scrollable.</p><h2>Terminology</h2><ul><li><strong>Launcher</strong>: a button that can be (or is) displayed on the launch bar.</li><li><strong>Available Launcher</strong>: a launcher that is not displayed on the launch bar, but can be added.</li><li><strong>Visible Launcher</strong>: a launcher that is currently displayed on the launch bar.</li></ul><h2>Configuring the desktop Launch bar</h2><p>There are two ways to configure the launch bar:</p><ul><li>Right click in the empty space between launchers on the launch bar and select <em>Configure launch bar…</em></li><li>Click on the&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>&nbsp;and select <em>Configure launch bar</em>.</li></ul><p>This will open a new tab with the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;listing the launchers.</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Launch%20Bar_image.jpg\"></p><p>Expanding <em>Available Launchers</em> section will show the list of launchers that are not displayed on the launch bar. The <em>Visible Launchers</em> will show the ones that are currently displayed.</p><h2>Configuring the mobile launch bar</h2><p>The launch bar on mobile uses a different configuration from the desktop one. The reasoning is that not all desktop icons are available on mobile, and fewer icons fit on a mobile screen.</p><p>To configure the launch bar on mobile, go to&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>&nbsp;and select <em>Configure launch bar</em>.</p><p>The configure the mobile launch bar while on the desktop (especially useful to configure more complicated launchers such as scripts or custom widgets), go to&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>&nbsp;→ Advanced → Hidden notes and look for the <em>Mobile Launch Bar</em> section. While in the hidden subtree, it's also possible to drag launchers between the <em>Mobile Launch Bar</em> and (Desktop) <em>Launch Bar</em> sections.</p><h3>Adding/removing and reordering launchers</h3><p>To display a new launcher in the launch bar, first look for it in the <em>Available Launchers</em> section. Then right click it and select <em>Move to visible launchers</em>. It is also possible to drag and drop the item manually.</p><p>Similarly, to remove it from the launch bar, simply look for it in <em>Visible Launchers</em> then right click it and select <em>Move to available launchers</em> or use drag-and-drop.</p><p>Drag-and-drop the items in the&nbsp;tree&nbsp;in order to change their order. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;for more interaction options, including using keyboard shortcuts.</p><h3>Adding a note by drag and drop</h3><p>To add a note to the launch bar, drag it from the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>&nbsp;onto the launch bar. A line between the launchers shows where the note will be placed. If the launch bar is scrollable, hold the note near either end to scroll it. Dropping the note adds a button with the note's title and icon, which opens the note when clicked.</p><ul><li>Several notes selected in the tree can be dropped at once; they keep their order.</li><li>A note that is already on the launch bar, or a launcher dragged from the <em>Available Launchers</em> section, is moved to the new place instead of being added again.</li></ul><p>The button is a clone of the note in the <em>Visible Launchers</em> section (see&nbsp;<a class=\"reference-link\" href=\"#root/_help_IakOLONlIfGI\">Cloning Notes</a>), so it always shows the note's current title and icon. Right click it and select <em>Remove from launch bar</em> to move it to the <em>Available Launchers</em>, like any other launcher; the note itself stays where it is in the tree.</p><h2>Customizing the launcher</h2><ul><li>The icon of a launcher can be changed just like a normal note. See&nbsp;<a href=\"#root/_help_p9kXRFAkwN4o\">note icons</a>&nbsp;for more information.</li><li>The title of the launcher can also be changed.</li></ul><h3>Resetting</h3><p>Resetting allows restoring the original configuration of Trilium for the launcher bar, or for a portion of it. Simply right click a launcher (or even the entire <em>Launch Bar</em> section) and select <em>Reset</em> to bring it back to the original state.</p><h3>Creating new launchers / types of launchers</h3><p>Right click either the <em>Available launchers</em> or <em>Visible launchers</em> sections and select one of the options:</p><ol><li><p><strong>Note Launcher</strong><br>A note launcher will simply navigate to a specified note.</p><ol><li>Set the <code>target</code> promoted attribute to the note to navigate to.</li><li>Optionally, set <code>hoistedNote</code> to hoist a particular note. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_OR8WJ7Iz9K4U\">Note Hoisting</a>&nbsp;for more information.</li><li>Optionally, set a <code>keyboardShortcut</code> to trigger the launcher.</li></ol></li><li><p><strong>Script Launcher</strong><br>An advanced launcher which will run a script upon pressing. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_CdNpE2pqjmI6\">Scripting</a>&nbsp;for more information.</p><ol><li>Set <code>script</code> to point to the desired script to run.</li><li>Optionally, set a <code>keyboardShortcut</code> to trigger the launcher.</li></ol></li><li><p><strong>Custom Widget</strong></p><p>Allows defining a custom widget to be rendered inside the launcher. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_SynTBQiBsdYJ\">Widget Basics</a>&nbsp;for more information.</p></li><li><p><strong>Spacers</strong><br>Launchers that create some distance between other launchers for better visual distinction.</p></li></ol><p>Launchers are configured via predefined&nbsp;<a class=\"reference-link\" href=\"#root/_help_OFXdgB2nNk1F\">Promoted Attributes</a>.</p>",
"_help_8YBEPzcpUgxw": "<figure class=\"image image-style-align-right image_resized\" style=\"width:25.95%;\"><img style=\"aspect-ratio:402/988;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Note%20menu_image.png\" width=\"402\" height=\"988\"></figure><p>The note menu contains various actions and configurations for the current note. It can be found in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_1P8QXI5edXNd\">Note buttons</a>&nbsp;area (to the right of the&nbsp;<a class=\"reference-link\" href=\"#root/_help_l7pigIGu01K2\">Title</a>).</p><p>Every split has a note menu of its own, which acts on the note displayed in that split. Entries that don't apply to the current note are still listed but grayed out, while entries that only exist for some notes (described in <em>Note-specific entries</em>) appear only on those notes.</p><h2>Navigating the note</h2><p>These entries are the row of icons at the top of the menu, each with a short title. Hovering one shows its full name and its keyboard shortcut. In Quick edit on a phone, where only <em>Find</em> is left, it is listed as an ordinary entry instead.</p><ul><li><span class=\"tn-icon bx bx-file-find\"></span>&nbsp;<em>Find</em> opens the&nbsp;<a class=\"reference-link\" href=\"#root/_help_McngOG2jbUWX\">Search in note</a>&nbsp;bar, to find and replace text inside the current note. On the desktop application, the same bar opens with <kbd>Ctrl</kbd>+<kbd>F</kbd>.<ul><li>It is available on&nbsp;<a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a>,&nbsp;<a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a>,&nbsp;<a class=\"reference-link\" href=\"#root/_help_gBbsAeiuUxI5\">Mind Map</a>&nbsp;and&nbsp;<a class=\"reference-link\" href=\"#root/_help_GWHEkY4I4OE3\">Spreadsheets</a>&nbsp;notes,&nbsp;<a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a>, PDF files, and any note displayed as&nbsp;<a class=\"reference-link\" href=\"#root/_help_4FahAwuGTAwC\">Note source</a>.</li></ul></li><li><span class=\"tn-icon bx bx-paperclip\"></span>&nbsp;<em>Attachments</em> switches the note to the list of its&nbsp;<a class=\"reference-link\" href=\"#root/_help_0vhv7lsOLy82\">Attachments</a>, where they can be uploaded, opened, downloaded, renamed or deleted.</li><li><span class=\"tn-icon bx bxs-network-chart\"></span>&nbsp;<em>Note map</em> opens the&nbsp;<a class=\"reference-link\" href=\"#root/_help_KRlZFoIH0j6p\">Connections tab</a>&nbsp;of the&nbsp;<a class=\"reference-link\" href=\"#root/_help_RnaPdbciOfeq\">Right Sidebar</a>, which shows the&nbsp;<a class=\"reference-link\" href=\"#root/_help_BCkXAVs63Ttv\">Note Map (Link map, Tree map)</a>&nbsp;centered on the current note.</li></ul><h2>Note properties</h2><p>The toggles in this section take effect immediately:</p><ul><li><span class=\"tn-icon bx bx-share-alt\"></span>&nbsp;<em>Shared</em> publishes the note via&nbsp;<a class=\"reference-link\" href=\"#root/_help_R9pX4DGra2Vt\">Sharing</a>, by cloning it into the <em>Shared Notes</em> tree.<ul><li>Turning it off removes the clone from that tree. If the note exists only as a shared note, Trilium asks for confirmation, since unsharing it deletes it.</li><li>The toggle is unavailable on the root note, on the <em>Shared Notes</em> note itself, and on system notes.</li></ul></li><li><span class=\"tn-icon bx bx-lock-alt\"></span>&nbsp;<em>Protect the note</em> encrypts the note, turning it into one of the&nbsp;<a class=\"reference-link\" href=\"#root/_help_bwg0e8ewQMak\">Protected Notes</a>. If no protected session is active, Trilium asks for the password first. Only the current note is affected, not its children.</li><li><span class=\"tn-icon bx bx-bookmark\"></span>&nbsp;<em>Bookmark</em> adds the note to the&nbsp;<a class=\"reference-link\" href=\"#root/_help_u3YFHC9tQlpm\">Bookmarks</a>&nbsp;that are displayed in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>, or removes it from them.</li><li><span class=\"tn-icon bx bx-copy-alt\"></span>&nbsp;<em>Template</em> marks the note as one of the&nbsp;<a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>&nbsp;(by adding the <code>#template</code> label), which makes it available when creating a new note.</li><li><span class=\"tn-icon bx bx-expand-horizontal\"></span>&nbsp;<em>Full width</em> lets the note use the whole width of the window instead of the limit set in&nbsp;<a class=\"reference-link\" href=\"#root/_help_t596jLvPrqkS\">Content width</a>&nbsp;by adding the <code>#fullContentWidth</code> label. It is not listed for note types that are always displayed at full width.</li></ul><p>The two submenus in this section:</p><ul><li><span class=\"tn-icon bx bx-file\"></span>&nbsp;<em>Note type</em> changes the type of the note to any of the&nbsp;<a class=\"reference-link\" href=\"#root/_help_KSZ04uQ2D1St\">Note Types</a>; the current one is checked. If the note already has content, Trilium asks for confirmation first, since the content generally doesn't carry over.&nbsp;<a class=\"reference-link\" href=\"#root/_help_jludwdW7N4hg\">Converting between note types</a>.<ul><li>For a&nbsp;<a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a>&nbsp;note, the language is chosen in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>&nbsp;instead.</li></ul></li><li><span class=\"tn-icon bx bx-edit-alt\"></span>&nbsp;<em>Editable</em> controls when the note opens as read-only (see&nbsp;<a class=\"reference-link\" href=\"#root/_help_CoFPLs3dRlXc\">Read-Only Notes</a>):<ul><li><em>Auto</em> (the default): the note is editable, unless it is long enough to be opened as read-only automatically.</li><li><em>Read-only</em>: the note always opens as read-only, but can still be edited after pressing <em>Edit note</em>.</li><li><em>Always editable</em>: the note is always editable, regardless of its length.</li></ul></li></ul><h2>Importing, exporting and printing</h2><ul><li><span class=\"tn-icon bx bx-import\"></span>&nbsp;<em>Import files</em> opens the import dialog, which imports files as children of the current note. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_mHbBMPDPkVV5\">Import &amp; Export</a>. It is unavailable on&nbsp;<a class=\"reference-link\" href=\"#root/_help_m523cpzocqaD\">Saved Search</a>&nbsp;notes.</li><li><span class=\"tn-icon bx bx-export\"></span>&nbsp;<em>Export note</em> opens the export dialog with <em>Only this note</em> selected; select <em>This note &amp; all descendants</em> there to export the whole subtree.</li><li><span class=\"tn-icon bx bx-printer\"></span><em>Print/export to PDF…</em> prints the note or saves it as a PDF file. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_NRnIZmSMc5sj\">Printing &amp; Exporting as PDF</a>, including which note types and collections can be printed.</li></ul><p>Some note types add their own export formats right below <em>Export note</em>:</p><ul><li><span class=\"tn-icon bx bxs-file-image\"></span><em>Export as image</em>, on&nbsp;<a class=\"reference-link\" href=\"#root/_help_s1aBHPd79XYj\">Mermaid Diagrams</a>&nbsp;and&nbsp;<a class=\"reference-link\" href=\"#root/_help_gBbsAeiuUxI5\">Mind Map</a>&nbsp;notes, downloads the diagram as <em>PNG (raster)</em> or <em>SVG (vector)</em>.</li><li><span class=\"tn-icon bx bxs-spreadsheet\"></span><em>Export to Excel (.xlsx)</em> and <em>Export to CSV (.csv)</em>, on&nbsp;<a class=\"reference-link\" href=\"#root/_help_GWHEkY4I4OE3\">Spreadsheets</a>, download the spreadsheet in those formats.</li></ul><h2>Revisions</h2><p>These entries manage the&nbsp;<a class=\"reference-link\" href=\"#root/_help_vZWERwf8U3nx\">Note Revisions</a>&nbsp;of the note:</p><ul><li><span class=\"tn-icon bx bx-history\"></span><em>Note revisions…</em> opens the revisions dialog, where previous versions can be previewed, compared with the current one, downloaded or restored. The arrow beside it opens the entries that save a revision right away. On mobile, tapping it opens those entries, with <em>Note revisions…</em> as the first one.<ul><li><span class=\"tn-icon bx bx-save\"></span><em>Save revision</em> saves a revision of the note right away, instead of waiting for the next automatic snapshot.</li><li><span class=\"tn-icon bx bx-purchase-tag\"></span><em>Save named revision…</em> also saves a revision right away, but first asks for a short description of the changes, which is shown in the revisions dialog.</li></ul></li></ul><h2>Note-specific entries</h2><p>The following entries only appear on some notes:</p><ul><li><span class=\"tn-icon bx bx-pencil\"></span><em>Edit note</em> appears at the top of the menu when the note is currently read-only. It enables editing until the note is closed.</li><li><span class=\"tn-icon bx bx-align-justify\"></span><em>Word wrap</em> appears at the top of the menu on&nbsp;<a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a>&nbsp;notes, and sets whether long lines wrap in this note:<ul><li><em>Auto</em> (the default) follows&nbsp;<a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a>&nbsp;→ <em>Code Notes</em> → <em>Wrap lines in code notes</em>.</li><li><em>On</em> and <em>Off</em> override it for this note only, by setting the <code>#wrapLines</code> label.</li></ul></li><li><span class=\"tn-icon bx bx-paperclip\"></span><em>Convert into attachment</em> appears on an image note that has no children and a single parent which is a&nbsp;<a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a>&nbsp;note. After a confirmation, it turns the image into an attachment of its parent note and opens it there. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_0vhv7lsOLy82\">Attachments</a>.</li><li><span class=\"tn-icon bx bx-extension\"></span><em>Re-render note</em> appears on a&nbsp;<a class=\"reference-link\" href=\"#root/_help_HcABDtFCkbFN\">Render Note</a>, and runs its script again to refresh the output.</li><li><span class=\"tn-icon bx bx-cog\"></span><em>Board properties</em> appears on a&nbsp;<a class=\"reference-link\" href=\"#root/_help_CtBQqbwXDx1w\">Kanban Board</a>, and configures its columns, card attributes and card templates.</li><li><span class=\"tn-icon bx bx-cog\"></span><em>Calendar properties</em> appears on a&nbsp;<a class=\"reference-link\" href=\"#root/_help_xWbu3jpNWapp\">Calendar</a> that creates events, and configures its event templates.</li><li><span class=\"tn-icon bx bx-cog\"></span><em>Geo map properties</em> appears on a&nbsp;<a class=\"reference-link\" href=\"#root/_help_81SGnPGMk7Xc\">Geo Map</a>, and configures its map settings and the image of an <a href=\"#root/_help_ZRDXGc0nAIh4\">image map</a>.</li><li><span class=\"tn-icon bx bx-cog\"></span><em>Table properties</em> appears on a <a class=\"reference-link\" href=\"#root/_help_2FvYrpmOXm29\">Table</a>, and configures which notes it shows.</li></ul><h2>Advanced</h2><p>The <span class=\"tn-icon bx bx-wrench\"></span><em>Advanced</em> submenu groups the actions that are needed less often:</p><ul><li><p><span class=\"tn-icon bx bx-file-find\"></span><em>Open note externally</em> (desktop application only) saves the note to a temporary file and opens it in the application that the operating system associates with it. Trilium watches the file, and offers to upload the modified version back into the note. It is unavailable on&nbsp;<a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a>&nbsp;and&nbsp;<a class=\"reference-link\" href=\"#root/_help_m523cpzocqaD\">Saved Search</a>&nbsp;notes.</p></li><li><p><span class=\"tn-icon bx bx-customize\"></span><em>Open note custom</em> (desktop application only, Windows and Linux) works like <em>Open note externally</em>, but lets you pick the application to open the file with.</p></li><li><p><span class=\"tn-icon bx bx-code\"></span><em>Note source</em> shows the&nbsp;<a class=\"reference-link\" href=\"#root/_help_4FahAwuGTAwC\">Note source</a>, the content of the note exactly as it is stored.</p></li><li><p><span class=\"tn-icon bx bxl-markdown\"></span><em>Convert to Markdown note</em> (on text notes) and <em>Convert to text note</em> (on Markdown notes) switch the note between rich text and Markdown. After a confirmation, Trilium saves a revision and converts the content; the revision allows going back if some formatting was lost. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_jludwdW7N4hg\">Converting between note types</a>.</p></li><li><p><span class=\"tn-icon bx bx-collapse-alt\"></span><em>Compress images</em> opens a dialog that reduces the size of the images in the note. It lists the images found and how much space they take, and offers to:</p><ul><li>Resize the images larger than a chosen size.</li><li>Keep, or compress, JPEG images.</li><li>Keep, optimize, or convert to JPEG the PNG images.</li><li><em>Process child notes as well</em>, to include the images of the notes beneath this one.</li></ul><p>Compressing cannot be undone. Images can also be compressed automatically on upload, see&nbsp;<a class=\"reference-link\" href=\"#root/_help_mT0HEkOsz6i1\">Images</a>.</p></li><li><p><span class=\"tn-icon bx bx-text\"></span><em>View OCR text</em> (on image and file notes) shows the text extracted from the note via&nbsp;<a class=\"reference-link\" href=\"#root/_help_TiQbQDgP8L5t\">Text Extraction (OCR)</a>. If the note has not been processed yet, the dialog offers to <em>Process OCR</em>.</p></li><li><p><span class=\"tn-icon bx bx-world\"></span><em>Open note on server</em> (desktop application only, listed when&nbsp;<a class=\"reference-link\" href=\"#root/_help_cbkrhQjrkKrh\">Synchronization</a>&nbsp;is configured) opens the same note on the sync server, in the web browser.</p></li></ul><h2>Deleting the note</h2><p><span class=\"tn-icon bx bx-trash\"></span><em>Delete note</em> opens the deletion dialog for the current note and its subtree. The dialog lists the notes that will be deleted and the relations that will be broken, and offers to:</p><ul><li>Also delete the other clones of the note, if it is cloned elsewhere. Otherwise, only the current placement is removed and the note stays in its other locations. See&nbsp;<a class=\"reference-link\" href=\"#root/_help_IakOLONlIfGI\">Cloning Notes</a>.</li><li><em>Erase permanently</em> instead of the usual soft deletion. This cannot be undone.</li></ul><p>Notes deleted without erasing can be brought back, see&nbsp;<a class=\"reference-link\" href=\"#root/_help_5Ct4MAJTS4tQ\">Restoring Deleted Notes</a>.</p><h2>Limitations</h2><ul><li>The note menu is not available on launchers.</li><li>On the notes of&nbsp;<a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a>&nbsp;and of the in-app help, most entries are grayed out, since these notes cannot be imported into, deleted or have revisions. Of the two, only the in-app help can be exported, see&nbsp;<a class=\"reference-link\" href=\"#root/_help_mHbBMPDPkVV5\">Import &amp; Export</a>.</li><li>The <a href=\"#note-properties\">Note properties</a> section is only listed when the note itself is displayed, not its&nbsp;<a class=\"reference-link\" href=\"#root/_help_0vhv7lsOLy82\">Attachments</a>&nbsp;or its&nbsp;<a class=\"reference-link\" href=\"#root/_help_4FahAwuGTAwC\">Note source</a>.</li><li>In&nbsp;<a class=\"reference-link\" href=\"#root/_help_ZjLYv08Rp3qC\">Quick edit</a>, <em>Note map</em>, <em>Full width</em> and <em>Convert into attachment</em> are not listed.</li></ul><h2>Mobile support</h2><p>On the&nbsp;<a class=\"reference-link\" href=\"#root/_help_RDslemsQ6gCp\">Mobile Frontend</a>, the note menu opens as a sheet from the bottom of the screen. Besides the entries above, it contains the items that the desktop layout places elsewhere:</p><ul><li>Two more icons in the row of icons at the very top of the sheet, which reads <span class=\"tn-icon bx bx-dock-right\"></span>&nbsp;<em>New split</em>, <em>Note map</em>, <em>Find</em> and <span class=\"tn-icon bx bx-plus\"></span>&nbsp;<em>Child note</em> from left to right: <em>New split</em> opens a <a class=\"reference-link\" href=\"#root/_help_luNhaphA37EO\">Split View</a> while there is none in the tab, and <em>Child note</em> creates a note under the current one.</li><li><em>Backlinks</em> and <em>Note paths</em>, below the row of icons, which open the <a class=\"reference-link\" href=\"#root/_help_wfGXLmm7x27z\">Backlinks</a> and the other locations of the note.</li><li><span class=\"tn-icon bx bx-paperclip\"></span>&nbsp;<em>Attachments</em> and <span class=\"tn-icon bx bx-list-check\"></span>&nbsp;<em>Attributes</em>, under them, which open the attachments and the attributes of the note, each with the number the note has. Links made by the content of the note are not counted as attributes. <em>Attributes</em> is unavailable where the note cannot be edited. On mobile, <em>Attachments</em> is listed here instead of in the row of icons.</li><li>The custom buttons of the note type (such as <span class=\"tn-icon bx bx-download\"></span><em>Download</em> on a&nbsp;<a class=\"reference-link\" href=\"#root/_help_W8vYD3Q1zjCR\">File</a>).</li><li><em>Close this pane</em>, on the second note of a <a class=\"reference-link\" href=\"#root/_help_luNhaphA37EO\">Split View</a>.</li><li><span class=\"tn-icon bx bx-slider-alt\"></span>&nbsp;<em>Note settings</em>, below <em>Protect the note</em>, which opens <em>Shared</em> and <em>Bookmark</em>, then <em>Note type</em>, <em>Template</em> and <em>Full width</em>, on a page of their own, together with the language of the note: the content language on <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> notes (see <a class=\"reference-link\" href=\"#root/_help_veGu4faJErEM\">Content language &amp; Right-to-left support</a>), and the language of the code on <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> notes. The choices of <em>Editable</em> are listed at the end of that page, under their own heading, instead of in a further submenu.</li><li><span class=\"tn-icon bx bx-info-circle\"></span>&nbsp;<em>Note info</em>, below <em>Note settings</em>, which opens the dates, type, ID and size of the note on a page of its own, ending with <em>Show similar notes</em> (see <a class=\"reference-link\" href=\"#root/_help_xWtq5NUHOwql\">Similar Notes</a>).</li><li><em>Note map</em> opens the map in a popup instead of the right sidebar.</li></ul>",
"_help_1P8QXI5edXNd": "<p>The note buttons is an area at the top-right of a note with a few buttons:</p><ul><li>The&nbsp;<a class=\"reference-link\" href=\"#root/_help_8YBEPzcpUgxw\">Note menu</a>&nbsp;which offers commands for the note or its subtree, such as import, export, viewing the&nbsp;<a href=\"#root/_help_4FahAwuGTAwC\">Note source code</a>&nbsp;or&nbsp;<a href=\"#root/_help_0vhv7lsOLy82\">Attachments</a>.</li><li><a class=\"reference-link\" href=\"#root/_help_luNhaphA37EO\">Split View</a>&nbsp;controls<ul><li><span class=\"tn-icon bx bx-dock-right\"></span>&nbsp;to open a new split</li><li><span class=\"tn-icon bx bx-chevron-right\"></span>/<span class=\"tn-icon bx bx-chevron-left\"></span> to move the pane around</li><li><span class=\"tn-icon bx bx-x\"></span>&nbsp;to close the pane.</li></ul></li><li>On some note types such as&nbsp;<a class=\"reference-link\" href=\"#root/_help_W8vYD3Q1zjCR\">File</a>&nbsp;and images, there are dedicated buttons (e.g.&nbsp;<span class=\"tn-icon bx bx-download\"></span> to download the file locally).</li></ul>",
"_help_4TIF1oA4VQRO": "<figure class=\"image image-style-align-center\"><img style=\"aspect-ratio:1189/709;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Options_image.png\" width=\"1189\" height=\"709\"></figure><p>The Options section allows the configuration of the TriliumNext client and server.</p><h2>Entering options</h2><p>The Options can be accessed via:</p><ul><li>The&nbsp;<a href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>, by selecting the <em>Options</em> item.</li><li>The&nbsp;<span class=\"tn-icon bx bx-cog\"></span> button in the&nbsp;<a href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>&nbsp;which can optionally be hidden if not desirable.</li><li>Optionally, a keyboard shortcut can be defined, but it is not assigned by default.</li><li>By clicking on this link:&nbsp;<a class=\"reference-link\" href=\"#root/_hidden/_options\">Options</a>.</li></ul><p>Once in the options section, simply select one of the option categories using the&nbsp;<a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>.</p><h2>Exiting options</h2><p>When entering the options, they are opened in a new <a href=\"#root/_help_3seOhtN8uLIY\">tab</a>. To close them, simply close the tab.</p><h2>Options when using sync</h2><p>When using&nbsp;<a class=\"reference-link\" href=\"#root/_help_cbkrhQjrkKrh\">Synchronization</a>, some of the options will be kept in sync across all the devices while others can be changed independently.</p><p>Generally, the options that relate to appearance are intentionally kept not synced in order to allow per-client customization (layout orientation, theme, vertical/horizontal layout, code block themes).</p>",
@@ -234,7 +234,7 @@
"_help_1YeN2MzFUluU": "<p>One core aspect of Trilium that allows it to have support for multiple&nbsp;<a href=\"#root/_help_KSZ04uQ2D1St\">Note Types</a>&nbsp;is the fact that it makes use of various off-the-shelf or reusable libraries.</p><p>This page showcases some of the technologies used, for a better understanding of how Trilium works but also to credit the developers of that particular technology.</p><h2>CKEditor</h2><p>CKEditor is the editor behind&nbsp;<a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a>&nbsp;notes, as well as integrated in various facets of the application such as the attribute editor in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>&nbsp;or the chat box in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_GBBMSlVSOIGP\">AI</a>&nbsp;sidebar or notes.</p><p>For more information see&nbsp;<a class=\"reference-link\" href=\"#root/_help_MI26XDLSAlCD\">CKEditor</a>.</p><h2>Excalidraw</h2><p><a href=\"https://excalidraw.com/\">Excalidraw</a> is the technology behind the&nbsp;<a class=\"reference-link\" href=\"#root/_help_grjYqerjn243\">Canvas</a>&nbsp;notes. The source code of the library is available on <a href=\"https://github.com/excalidraw/excalidraw\">GitHub</a>.</p><p>We are using an unmodified version of it, so it shares the same <a href=\"https://github.com/excalidraw/excalidraw/issues\">issues</a> as the original.</p><h2>MapLibre GL JS</h2><p>Trilium v0.105.0 introduces <a href=\"https://github.com/maplibre/maplibre-gl-js\">MapLibre GL JS</a> for the&nbsp;<a class=\"reference-link\" href=\"#root/_help_81SGnPGMk7Xc\">Geo Map</a>&nbsp;collection, which brings improved performance by using graphical acceleration (WebGL). Trilium ships its own track parsing logic as well as most of the UI such as the right panel.</p><h2>MindElixir</h2><p>MindElixir is the library we are using for&nbsp;<a class=\"reference-link\" href=\"#root/_help_gBbsAeiuUxI5\">Mind Map</a>&nbsp;note types. The main library is available on <a href=\"https://github.com/SSShooter/mind-elixir-core/issues\">GitHub as mind-elixir-core</a>.</p><p>Trilium ships its own UI which covers the toolbars, the contextual menu, the zoom buttons and the right panel that shows when clicking a node.</p><h2>FullCalendar</h2><p><a href=\"https://fullcalendar.io/\">FullCalendar</a> is the technology behind the&nbsp;<a class=\"reference-link\" href=\"#root/_help_xWbu3jpNWapp\">Calendar</a>&nbsp;collection, providing the various views (day, week, month, year) and the event management. Trilium also ships its own UI in the form of the popup that appears when editing, as well as the header that appears in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_CssoWBu8I7jF\">Collection Properties</a>.</p><p>Licensed under the MIT license.</p>",
"_help_MI26XDLSAlCD": "<h2>Editor core</h2><p>The CKEditor is the WYSIWYG (standing for What You See Is What You Get) editor behind&nbsp;<a href=\"#root/_help_iPIMuisry3hd\">Text</a>&nbsp;notes.</p><p>Their website is <a href=\"https://ckeditor.com/\">ckeditor.com</a>.</p><p>CKEditor by itself is a commercial product, but the core is open-source. As described in <a href=\"https://ckeditor.com/docs/ckeditor5/latest/features/index.html\">its documentation</a>, the editor supports quite a large number of features. Do note that not all the features are enabled in Trilium.</p><h2>Premium features</h2><p>CKEditor ships some plugins as premium (slash commands, templates, AI integration). Initially Trilium (since v0.96.0) shipped some of them like slash commands as part of a license grant from CKEditor to the Trilium Notes developers.</p><p>In v0.105.0 we've decided to replace those premium plugins with our own open-source implementations. This also means that we can better tailor those plugins to the Trilium app.</p><h2>Plugins</h2><p>The CKEditor ecosystem is quite extensible, in the sense that custom plugins can be written to extend the functionality of the editor beyond its original scope.</p><p>Trilium makes use of such features:</p><ul><li>The math feature is added by a version of <a href=\"https://github.com/isaul32/ckeditor5-math\">isaul32/ckeditor5-math: Math feature for CKEditor 5.</a> modified by us to fit our needs.</li><li><a href=\"https://github.com/mlewand/ckeditor5-keyboard-marker\">mlewand/ckeditor5-keyboard-marker: Plugin adds support for the keyboard input element (<code>&lt;kbd&gt;</code>) to CKEditor 5.</a></li><li>A modified version of <a href=\"https://github.com/ThomasAitken/ckeditor5-footnotes\">ThomasAitken/ckeditor5-footnotes: Footnotes plugin for CKEditor5</a> to allow footnotes.</li></ul><p>Apart from that, Trilium also has its own set of specific plugins such as:</p><ul><li><a class=\"reference-link\" href=\"#root/_help_2x0ZAX9ePtzV\">Cut to subnote</a></li><li><a class=\"reference-link\" href=\"#root/_help_nBAXQFj20hS1\">Include Note</a>, which also shows drawing canvases and <a href=\"#root/_help_CohkqWQC1iBv\">Mermaid diagrams</a> in place.</li><li>Mentions, for linking pages.</li><li><a class=\"reference-link\" href=\"#root/_help_Oau6X9rCuegd\">Markdown</a></li><li><a href=\"#root/_help_QEAPj01N5f7w\">Reference links</a></li><li><a href=\"#root/_help_NwBbFdNZ9h7O\">Admonitions</a>, we ended up creating our own plugin but <a href=\"https://github.com/aarkue/ckeditor5-admonition\">aarkue/ckeditor5-admonition</a> was a good inspiration (including the toolbar icon).</li></ul>",
"_help_m1lbrzyKDaRB": "<p>Whereas some applications use file names to uniquely identify notes, Trilium uses the concept of Note ID.</p><p>Generally, the Note ID is a 12-character long alphanumeric sequence (including both lower and upper case letter) that is randomly generated for each new note.</p><h2>How does the import/export affect the note IDs</h2><p>When notes are exported, their note ID is kept in the metadata of the export. However when they are imported back in, a new note ID is generated for all the notes. This also includes other entities that are part of the import/export process such as&nbsp;<a class=\"reference-link\" href=\"#root/_help_0vhv7lsOLy82\">Attachments</a>.</p><h2>Note collisions</h2><p>Since the Note ID is a fixed-width randomly generated number, due to the <a href=\"https://en.wikipedia.org/wiki/Pigeonhole_principle\">pigeonhole principle</a>, there is a possibility that a newly created note will have the same ID as an existing note.</p><p>Since the note ID is alphanumeric and the length is 12 we have&nbsp;<span class=\"math-tex\">\\(62^{12}\\)</span>&nbsp;unique IDs. However since we are generating them randomly, we can use a collision calculator such as the one for <a href=\"https://alex7kom.github.io/nano-nanoid-cc/?alphabet=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&amp;size=12&amp;speed=1000&amp;speedUnit=hour\">Nano ID</a> to determine that we'd need to create 1000 notes per hour every hour for 9 centuries in order to have at least 1% probability of a note collision.</p><p>As such, Trilium does not take any explicit action against potential note collisions, similar to other software that makes uses of unique hashes such as <a href=\"https://stackoverflow.com/questions/10434326/hash-collision-in-git\">Git</a>. If one would theoretically occur, what would most likely happen is that the existing note will be replaced by the new one.</p>",
- "_help_z8O2VG4ZZJD7": "<p>This is the internal API used by the Trilium Notes client application.</p><p><strong>Important:</strong> This API is primarily intended for internal use by the Trilium client. For external integrations, please use the <a href=\"https://github.com/TriliumNext/Trilium/blob/main/docs/User%20Guide/User%20Guide/Advanced%20Usage/ETAPI%20(REST%20API).md#etapi-rest-api\">ETAPI (External Trilium API)</a> instead.</p><h2>Signing in</h2><p>Most endpoints require session-based authentication. You can authenticate using:</p><ul><li><strong>Password login</strong>: POST to <code>/api/login</code> with password</li><li><strong>Token authentication</strong>: Generate a token via <code>/api/login/token</code></li><li><strong>Sync authentication</strong>: Use document secret for sync operations</li></ul><h2>Rate Limiting</h2><p>Authentication endpoints are rate-limited to prevent brute force attacks.</p><h2>CSRF Protection</h2><p>State-changing operations require CSRF tokens when using session authentication.</p><h2><span class=\"tn-icon bx bx-lock-alt\"></span> Authentication</h2><h3><code>sessionAuth</code></h3><p>API key in the <code>trilium.sid</code> cookie.</p><p>Session cookie obtained from login</p><h3><code>tokenAuth</code></h3><p>API key in the <code>Authorization</code> header.</p><p>API token in format \"Bearer {token}\"</p><h2><span class=\"tn-icon bx bx-log-in\"></span> Sessions</h2><p>Login, logout, and session management</p><h3>Login with password</h3><p><code>POST /api/login</code> · <code>login</code></p><p>Responds with 401 when the password is wrong or, with two-factor authentication enabled, the TOTP token is missing or wrong.</p><p><strong>Authorization</strong>: none</p><p><strong>Request body</strong> (required)</p><ul><li><code>application/x-www-form-urlencoded</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>password</code> <br><em>required</em></td><td><code>string (password)</code></td></tr><tr><td><code>totpToken</code></td><td><code>string</code> <br>TOTP token if 2FA is enabled</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Login successful</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Set-Cookie</code></td><td><code>string</code> <br>Example: <code>trilium.sid=s%3A...</code></td></tr></tbody></table></figure><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">401: Invalid credentials</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Generate API token</h3><p><code>POST /api/login/token</code> · <code>generateToken</code></p><p><strong>Authorization</strong>: none</p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>password</code> <br><em>required</em></td><td><code>string (password)</code></td></tr><tr><td><code>tokenName</code></td><td><code>string</code> <br>Optional name for the token</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"password\": \"string\",\n \"tokenName\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Token created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>authToken</code></td><td><code>string</code> <br>API authentication token</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"authToken\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Sync login using document secret</h3><p><code>POST /api/login/sync</code> · <code>loginSync</code></p><p><strong>Authorization</strong>: none</p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>timestamp</code> <br><em>required</em></td><td><code>string (date-time)</code></td></tr><tr><td><code>hash</code> <br><em>required</em></td><td><code>string</code> <br>HMAC hash of document secret and timestamp</td></tr><tr><td><code>syncVersion</code> <br><em>required</em></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"timestamp\": \"2019-08-24T14:15:22Z\",\n \"hash\": \"string\",\n \"syncVersion\": 0\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Login successful</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>instanceId</code></td><td><code>string</code></td></tr><tr><td><code>maxEntityChangeId</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"instanceId\": \"string\",\n \"maxEntityChangeId\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Enter protected session</h3><p><code>POST /api/login/protected</code> · <code>enterProtectedSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>password</code> <br><em>required</em></td><td><code>string (password)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"password\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Protected session entered</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">401: Invalid password</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Exit protected session</h3><p><code>POST /api/logout/protected</code> · <code>exitProtectedSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Protected session exited</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Keep protected session alive</h3><p><code>POST /api/login/protected/touch</code> · <code>touchProtectedSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Session refreshed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get OAuth status</h3><p><code>GET /api/oauth/status</code> · <code>getOAuthStatus</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: OAuth status</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>enabled</code></td><td><code>boolean</code></td></tr><tr><td><code>configured</code></td><td><code>boolean</code></td></tr><tr><td><code>providers</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"enabled\": true,\n \"configured\": true,\n \"providers\": [\n \"string\"\n ]\n}</code></pre></div></div></div></section></div><h3>Validate OAuth configuration</h3><p><code>GET /api/oauth/validate</code> · <code>validateOAuth</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: OAuth validation result</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>valid</code></td><td><code>boolean</code></td></tr><tr><td><code>errors</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"valid\": true,\n \"errors\": [\n \"string\"\n ]\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-note\"></span> Notes</h2><p>Core note operations</p><h3>Get note metadata</h3><p><code>GET /api/notes/{noteId}</code> · <code>getNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note metadata</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Delete note</h3><p><code>DELETE /api/notes/{noteId}</code> · <code>deleteNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>taskId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>eraseNotes</code></td><td><code>boolean</code></td></tr><tr><td><code>last</code> <br><em>required</em></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Note deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get note content</h3><p><code>GET /api/notes/{noteId}/blob</code> · <code>getNoteContent</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note content</p><div class=\"trilium-tab-panel\"><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>text/html</code>: <code>string</code></p><div class=\"trilium-tab-panel\"><p>&nbsp;</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>text/plain</code>: <code>string</code></p><div class=\"trilium-tab-panel\"><p>&nbsp;</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>application/json</code>: <code>object</code></p><div class=\"trilium-tab-panel\"><pre><code class=\"language-application-json\">{}</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>application/octet-stream</code>: <code>string (binary)</code></p><div class=\"trilium-tab-panel\"><p>&nbsp;</p></div></section></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Update note content</h3><p><code>PUT /api/notes/{noteId}/data</code> · <code>updateNoteContent</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>content</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>attachments</code></td><td>array of <a href=\"#schema-Attachment\"><code>Attachment</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"content\": \"string\",\n \"attachments\": [\n {\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Content updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get note timestamps</h3><p><code>GET /api/notes/{noteId}/metadata</code> · <code>getNoteMetadata</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note timestamps</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Timestamps\"><code>Timestamps</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Change note title</h3><p><code>PUT /api/notes/{noteId}/title</code> · <code>updateNoteTitle</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Title updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Change note type and MIME</h3><p><code>PUT /api/notes/{noteId}/type</code> · <code>updateNoteType</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"type\": \"text\",\n \"mime\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Type updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Protect or unprotect note</h3><p><code>PUT /api/notes/{noteId}/protect/{isProtected}</code> · <code>protectNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>subtree</code></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Protection status updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Undelete note</h3><p><code>PUT /api/notes/{noteId}/undelete</code> · <code>undeleteNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Note undeleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Create new note</h3><p><code>POST /api/notes/{parentNoteId}/children</code> · <code>createNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>target</code></td><td><code>string</code> <br>One of <code>after</code>, <code>into</code>.</td></tr><tr><td><code>targetBranchId</code></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-CreateNoteRequest\"><code>CreateNoteRequest</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>isProtected</code></td><td><code>boolean</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer</code></td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code></td><td><code>string</code></td></tr><tr><td><code>templateNoteId</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"content\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"isExpanded\": true,\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"parentNoteId\": \"string\",\n \"templateNoteId\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Note created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>note</code></td><td><a href=\"#schema-Note\"><code>Note</code></a></td></tr><tr><td><code>branch</code></td><td><a href=\"#schema-Branch\"><code>Branch</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"note\": {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n },\n \"branch\": {\n \"branchId\": \"string\",\n \"noteId\": \"string\",\n \"parentNoteId\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true\n }\n}</code></pre></div></div></div></section></div><h3>Duplicate note subtree</h3><p><code>POST /api/notes/{noteId}/duplicate/{parentNoteId}</code> · <code>duplicateNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Note duplicated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Force save revision</h3><p><code>POST /api/notes/{noteId}/revision</code> · <code>saveRevision</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Revision saved</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Revision\"><code>Revision</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code></td><td><code>string</code></td></tr><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>type</code></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"revisionId\": \"string\",\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Sort child notes</h3><p><code>PUT /api/notes/{noteId}/sort-children</code> · <code>sortChildren</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>sortBy</code></td><td><code>string</code> <br>One of <code>title</code>, <code>dateCreated</code>, <code>dateModified</code>.</td></tr><tr><td><code>sortDirection</code></td><td><code>string</code> <br>One of <code>asc</code>, <code>desc</code>.</td></tr><tr><td><code>foldersFirst</code></td><td><code>boolean</code></td></tr><tr><td><code>sortNatural</code></td><td><code>boolean</code></td></tr><tr><td><code>sortLocale</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"sortBy\": \"title\",\n \"sortDirection\": \"asc\",\n \"foldersFirst\": true,\n \"sortNatural\": true,\n \"sortLocale\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Children sorted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Convert note to attachment</h3><p><code>POST /api/notes/{noteId}/convert-to-attachment</code> · <code>convertToAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note converted to attachment</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>ownerId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>role</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>image</code>, <code>file</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Upload file to note</h3><p><code>PUT /api/notes/{noteId}/file</code> · <code>uploadFileToNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: File uploaded</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Open file note</h3><p><code>GET /api/notes/{noteId}/open</code> · <code>openFileNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: File content</p><div class=\"trilium-tab-panel\"><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Download file note</h3><p><code>GET /api/notes/download/{noteId}</code> · <code>downloadFileNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: File content</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Disposition</code></td><td><code>string</code> <br>Example: <code>attachment; filename=\"document.pdf\"</code></td></tr></tbody></table></figure><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Download file note (alternative path)</h3><p><code>GET /api/notes/{noteId}/download</code> · <code>downloadFileNoteAlt</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: File content</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Disposition</code></td><td><code>string</code> <br>Example: <code>attachment; filename=\"document.pdf\"</code></td></tr></tbody></table></figure><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Save note to temp directory</h3><p><code>POST /api/notes/{noteId}/save-to-tmp-dir</code> · <code>saveToTmpDir</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: File saved to temp directory</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>filePath</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"filePath\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Update note from modified temp file</h3><p><code>POST /api/notes/{noteId}/upload-modified-file</code> · <code>uploadModifiedFile</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>filePath</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"filePath\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Note updated from file</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get image from note</h3><p><code>GET /api/images/{noteId}/{filename}</code> · <code>getNoteImage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>filename</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Image content</p><div class=\"trilium-tab-panel\"><ul><li><code>image/*</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Update image note</h3><p><code>PUT /api/images/{noteId}</code> · <code>updateImageNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Image updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Execute bulk action</h3><p><code>POST /api/bulk-action/execute</code> · <code>executeBulkAction</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>action</code></td><td><code>string</code></td></tr><tr><td><code>noteIds</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"action\": \"string\",\n \"noteIds\": [\n \"string\"\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Bulk action results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get affected notes count</h3><p><code>POST /api/bulk-action/affected-notes</code> · <code>getAffectedNotesCount</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>action</code></td><td><code>string</code></td></tr><tr><td><code>noteIds</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"action\": \"string\",\n \"noteIds\": [\n \"string\"\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Affected notes count</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>count</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"count\": 0\n}</code></pre></div></div></div></section></div><h3>Preview note deletion</h3><p><code>POST /api/delete-notes-preview</code> · <code>previewNoteDeletion</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>branchIdsToDelete</code></td><td><code>array of string</code></td></tr><tr><td><code>deleteAllClones</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchIdsToDelete\": [\n \"string\"\n ],\n \"deleteAllClones\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Deletion preview</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>notesToDelete</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"notesToDelete\": [\n \"string\"\n ]\n}</code></pre></div></div></div></section></div><h3>Erase deleted notes</h3><p><code>POST /api/notes/erase-deleted-notes-now</code> · <code>eraseDeletedNotes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Deleted notes erased</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h2><span class=\"tn-icon bx bx-sitemap\"></span> Tree</h2><p>Note tree structure and branches</p><h3>Get tree structure</h3><p><code>GET /api/tree</code> · <code>getTree</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>subTreeNoteId</code></td><td><code>string</code> <br>Limit tree to this note and descendants</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Tree structure</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>notes</code></td><td>array of <a href=\"#schema-Note\"><code>Note</code></a></td></tr><tr><td><code>branches</code></td><td>array of <a href=\"#schema-Branch\"><code>Branch</code></a></td></tr><tr><td><code>attributes</code></td><td>array of <a href=\"#schema-Attribute\"><code>Attribute</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"notes\": [\n {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n ],\n \"branches\": [\n {\n \"branchId\": \"string\",\n \"noteId\": \"string\",\n \"parentNoteId\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true\n }\n ],\n \"attributes\": [\n {\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n }\n ]\n}</code></pre></div></div></div></section></div><h3>Load specific notes</h3><p><code>POST /api/tree/load</code> · <code>loadNotes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteIds</code> <br><em>required</em></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteIds\": [\n \"string\"\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Loaded notes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>notes</code></td><td>array of <a href=\"#schema-Note\"><code>Note</code></a></td></tr><tr><td><code>branches</code></td><td>array of <a href=\"#schema-Branch\"><code>Branch</code></a></td></tr><tr><td><code>attributes</code></td><td>array of <a href=\"#schema-Attribute\"><code>Attribute</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"notes\": [\n {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n ],\n \"branches\": [\n {\n \"branchId\": \"string\",\n \"noteId\": \"string\",\n \"parentNoteId\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true\n }\n ],\n \"attributes\": [\n {\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n }\n ]\n}</code></pre></div></div></div></section></div><h3>Delete branch</h3><p><code>DELETE /api/branches/{branchId}</code> · <code>deleteBranch</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>taskId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>eraseNotes</code></td><td><code>boolean</code></td></tr><tr><td><code>last</code> <br><em>required</em></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Branch deleted</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteDeleted</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteDeleted\": true\n}</code></pre></div></div></div></section></div><h3>Move branch to new parent</h3><p><code>PUT /api/branches/{branchId}/move-to/{parentBranchId}</code> · <code>moveBranchToParent</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>parentBranchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Branch moved</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Move branch before another</h3><p><code>PUT /api/branches/{branchId}/move-before/{beforeBranchId}</code> · <code>moveBranchBefore</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>beforeBranchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Branch moved</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Move branch after another</h3><p><code>PUT /api/branches/{branchId}/move-after/{afterBranchId}</code> · <code>moveBranchAfter</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>afterBranchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Branch moved</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Set branch expanded state</h3><p><code>PUT /api/branches/{branchId}/expanded/{expanded}</code> · <code>setBranchExpanded</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>expanded</code> <br><em>required</em></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Expanded state updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Set subtree expanded state</h3><p><code>PUT /api/branches/{branchId}/expanded-subtree/{expanded}</code> · <code>setSubtreeExpanded</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>expanded</code> <br><em>required</em></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Subtree expanded state updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Set branch prefix</h3><p><code>PUT /api/branches/{branchId}/set-prefix</code> · <code>setBranchPrefix</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>prefix</code></td><td><code>string | null</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"prefix\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Prefix updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Clone note to branch</h3><p><code>PUT /api/notes/{noteId}/clone-to-branch/{parentBranchId}</code> · <code>cloneToBranch</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>parentBranchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note cloned</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Branch\"><code>Branch</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code> <br>Branch ID (parentNoteId_noteId)</td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>notePosition</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>prefix</code></td><td><code>string | null</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"string\",\n \"noteId\": \"string\",\n \"parentNoteId\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true\n}</code></pre></div></div></div></section></div><h3>Clone note to parent note</h3><p><code>PUT /api/notes/{noteId}/clone-to-note/{parentNoteId}</code> · <code>cloneToNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note cloned</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Branch\"><code>Branch</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code> <br>Branch ID (parentNoteId_noteId)</td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>notePosition</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>prefix</code></td><td><code>string | null</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"string\",\n \"noteId\": \"string\",\n \"parentNoteId\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true\n}</code></pre></div></div></div></section></div><h3>Clone note after branch</h3><p><code>PUT /api/notes/{noteId}/clone-after/{afterBranchId}</code> · <code>cloneAfterBranch</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>afterBranchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note cloned</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Branch\"><code>Branch</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code> <br>Branch ID (parentNoteId_noteId)</td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>notePosition</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>prefix</code></td><td><code>string | null</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"string\",\n \"noteId\": \"string\",\n \"parentNoteId\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true\n}</code></pre></div></div></div></section></div><h3>Toggle note presence in parent</h3><p><code>PUT /api/notes/{noteId}/toggle-in-parent/{parentNoteId}/{present}</code> · <code>toggleInParent</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>present</code> <br><em>required</em></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Presence toggled</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h2><span class=\"tn-icon bx bx-purchase-tag\"></span> Attributes</h2><p>Note attributes and metadata</p><h3>Get effective note attributes</h3><p><code>GET /api/notes/{noteId}/attributes</code> · <code>getNoteAttributes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note attributes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-Attribute\"><code>Attribute</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n }\n]</code></pre></div></section></div><h3>Update all note attributes</h3><p><code>PUT /api/notes/{noteId}/attributes</code> · <code>updateNoteAttributes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: array of <a href=\"#schema-Attribute\"><code>Attribute</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n }\n]</code></pre><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attributes updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Add note attribute</h3><p><code>POST /api/notes/{noteId}/attributes</code> · <code>addNoteAttribute</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-Attribute\"><code>Attribute</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Attribute added</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Attribute\"><code>Attribute</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n}</code></pre></div></div></div></section></div><h3>Delete attribute</h3><p><code>DELETE /api/notes/{noteId}/attributes/{attributeId}</code> · <code>deleteAttribute</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>attributeId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attribute deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Update single attribute</h3><p><code>PUT /api/notes/{noteId}/attribute</code> · <code>updateAttribute</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-Attribute\"><code>Attribute</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attribute updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Set attribute value</h3><p><code>PUT /api/notes/{noteId}/set-attribute</code> · <code>setAttribute</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attribute set</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Create relation</h3><p><code>PUT /api/notes/{noteId}/relations/{name}/to/{targetNoteId}</code> · <code>createRelation</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>targetNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Relation created</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Delete relation</h3><p><code>DELETE /api/notes/{noteId}/relations/{name}/to/{targetNoteId}</code> · <code>deleteRelation</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>targetNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Relation deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get attribute name suggestions</h3><p><code>GET /api/attribute-names</code> · <code>getAttributeNames</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>query</code></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attribute names</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of string</code></li></ul><pre><code class=\"language-application-json\">[\n \"string\"\n]</code></pre></div></section></div><h3>Get values for attribute</h3><p><code>GET /api/attribute-values/{attributeName}</code> · <code>getAttributeValues</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeName</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attribute values</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of string</code></li></ul><pre><code class=\"language-application-json\">[\n \"string\"\n]</code></pre></div></section></div><h2><span class=\"tn-icon bx bx-paperclip\"></span> Attachments</h2><p>File attachments</p><h3>Stream file with partial content support</h3><p><code>GET /api/attachments/{attachmentId}/open-partial</code> · <code>openPartialFileAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Header parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Range</code></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">206: Partial content</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Range</code></td><td><code>string</code> <br>Example: <code>bytes 0-1023/146515</code></td></tr></tbody></table></figure><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Get note attachments</h3><p><code>GET /api/notes/{noteId}/attachments</code> · <code>getNoteAttachments</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note attachments</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n]</code></pre></div></section></div><h3>Save attachment</h3><p><code>POST /api/notes/{noteId}/attachments</code> · <code>saveAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>matchBy</code></td><td><code>string</code> <br>One of <code>attachmentId</code>, <code>title</code>.</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>ownerId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>role</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>image</code>, <code>file</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Attachment saved</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>ownerId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>role</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>image</code>, <code>file</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Upload attachment file</h3><p><code>POST /api/notes/{noteId}/attachments/upload</code> · <code>uploadAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>link</code></td><td><code>boolean</code> <br><code>true</code> answers with a link to the attachment instead of an image URL, and stores a picture as uploaded, without compressing it or shortening its name.</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Attachment uploaded</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>ownerId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>role</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>image</code>, <code>file</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get attachment metadata</h3><p><code>GET /api/attachments/{attachmentId}</code> · <code>getAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment metadata</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>ownerId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>role</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>image</code>, <code>file</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Delete attachment</h3><p><code>DELETE /api/attachments/{attachmentId}</code> · <code>deleteAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attachment deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get attachment content</h3><p><code>GET /api/attachments/{attachmentId}/blob</code> · <code>getAttachmentBlob</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>preview</code></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment content</p><div class=\"trilium-tab-panel\"><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Rename attachment</h3><p><code>PUT /api/attachments/{attachmentId}/rename</code> · <code>renameAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attachment renamed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Convert attachment to note</h3><p><code>POST /api/attachments/{attachmentId}/convert-to-note</code> · <code>convertAttachmentToNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment converted to note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Update attachment file</h3><p><code>PUT /api/attachments/{attachmentId}/file</code> · <code>updateAttachmentFile</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attachment file updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Open attachment</h3><p><code>GET /api/attachments/{attachmentId}/open</code> · <code>openAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment content</p><div class=\"trilium-tab-panel\"><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Download attachment</h3><p><code>GET /api/attachments/download/{attachmentId}</code> · <code>downloadAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment content</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Disposition</code></td><td><code>string</code> <br>Example: <code>attachment; filename=\"document.pdf\"</code></td></tr></tbody></table></figure><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Download attachment (alternative path)</h3><p><code>GET /api/attachments/{attachmentId}/download</code> · <code>downloadAttachmentAlt</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment content</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Disposition</code></td><td><code>string</code> <br>Example: <code>attachment; filename=\"document.pdf\"</code></td></tr></tbody></table></figure><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Get all attachment information</h3><p><code>GET /api/attachments/{attachmentId}/all</code> · <code>getAllAttachmentInfo</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment information</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>isProtected</code></td><td><code>boolean</code></td></tr><tr><td><code>position</code></td><td><code>integer</code></td></tr><tr><td><code>contentLength</code></td><td><code>integer</code></td></tr><tr><td><code>ownerId</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"string\",\n \"title\": \"string\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"position\": 0,\n \"contentLength\": 0,\n \"ownerId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Save attachment to temporary directory</h3><p><code>POST /api/attachments/{attachmentId}/save-to-tmp-dir</code> · <code>saveAttachmentToTmpDir</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment saved</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>tmpPath</code></td><td><code>string</code> <br>Path to temporary file</td></tr><tr><td><code>success</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"tmpPath\": \"string\",\n \"success\": true\n}</code></pre></div></div></div></section></div><h3>Upload modified attachment file</h3><p><code>POST /api/attachments/{attachmentId}/upload-modified-file</code> · <code>uploadModifiedAttachmentFile</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Modified file uploaded</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true\n}</code></pre></div></div></div></section></div><h3>Get attached image</h3><p><code>GET /api/attachments/{attachmentId}/image/{filename}</code> · <code>getAttachmentImage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>filename</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Image content</p><div class=\"trilium-tab-panel\"><ul><li><code>image/*</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Erase unused attachments</h3><p><code>POST /api/notes/erase-unused-attachments-now</code> · <code>eraseUnusedAttachments</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Unused attachments erased</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h2><span class=\"tn-icon bx bx-history\"></span> Revisions</h2><p>Note revision history</p><h3>Get note revisions</h3><p><code>GET /api/notes/{noteId}/revisions</code> · <code>getNoteRevisions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note revisions</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-Revision\"><code>Revision</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"revisionId\": \"string\",\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\"\n }\n]</code></pre></div></section></div><h3>Erase all note revisions</h3><p><code>DELETE /api/notes/{noteId}/revisions</code> · <code>eraseNoteRevisions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Revisions erased</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get revision details</h3><p><code>GET /api/revisions/{revisionId}</code> · <code>getRevision</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Revision details</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Revision\"><code>Revision</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code></td><td><code>string</code></td></tr><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>type</code></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"revisionId\": \"string\",\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Erase revision</h3><p><code>DELETE /api/revisions/{revisionId}</code> · <code>eraseRevision</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Revision erased</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get revision content</h3><p><code>GET /api/revisions/{revisionId}/blob</code> · <code>getRevisionBlob</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>preview</code></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Revision content</p><div class=\"trilium-tab-panel\"><ul><li><code>text/html</code>: <code>string</code></li><li><code>text/plain</code>: <code>string</code></li><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Restore revision</h3><p><code>POST /api/revisions/{revisionId}/restore</code> · <code>restoreRevision</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Revision restored</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Download revision</h3><p><code>GET /api/revisions/{revisionId}/download</code> · <code>downloadRevision</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Revision content</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Disposition</code></td><td><code>string</code></td></tr></tbody></table></figure><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Cleanup old revisions</h3><p><code>POST /api/revisions/erase-all-excess-revisions</code> · <code>eraseExcessRevisions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong></p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>snapshotsToKeep</code></td><td><code>integer</code> <br>Snapshots to keep per note, standing in for the revisionSnapshotNumberLimit option. -1 keeps every snapshot, 0 keeps none. Omitted, the option applies. A note carrying a valid #versioningLimit follows its own label instead.</td></tr><tr><td><code>keepNamedSnapshots</code></td><td><code>boolean</code> <br>Spare named snapshots (those with a description) from erasure and leave them out of the count, so the limit governs the automatic snapshots alone.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"snapshotsToKeep\": 0,\n \"keepNamedSnapshots\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Excess revisions erased</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>erasedCount</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"erasedCount\": 0\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">400: Invalid options</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get notes edited on date</h3><p><code>GET /api/edited-notes/{date}</code> · <code>getEditedNotes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>date</code> <br><em>required</em></td><td><code>string (date)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Edited notes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-Note\"><code>Note</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n]</code></pre></div></section></div><h3>Get image from revision</h3><p><code>GET /api/revisions/{revisionId}/image/{filename}</code> · <code>getRevisionImage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>filename</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Image content</p><div class=\"trilium-tab-panel\"><ul><li><code>image/*</code>: <code>string (binary)</code></li></ul></div></section></div><h2><span class=\"tn-icon bx bx-search\"></span> Search</h2><p>Search and discovery</p><h3>Full text search</h3><p><code>GET /api/search</code> · <code>search</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>searchString</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Search results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-SearchResult\"><code>SearchResult</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"path\": \"string\",\n \"score\": 0,\n \"highlights\": [\n \"string\"\n ]\n }\n]</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">400: Missing or empty search string</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Quick search with highlighting</h3><p><code>GET /api/quick-search</code> · <code>quickSearch</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>searchString</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Quick search results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-SearchResult\"><code>SearchResult</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"path\": \"string\",\n \"score\": 0,\n \"highlights\": [\n \"string\"\n ]\n }\n]</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">400: Missing or empty search string</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Execute search note</h3><p><code>GET /api/search-note/{noteId}</code> · <code>executeSearchNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Search results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-SearchResult\"><code>SearchResult</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"path\": \"string\",\n \"score\": 0,\n \"highlights\": [\n \"string\"\n ]\n }\n]</code></pre></div></section></div><h3>Search and execute actions</h3><p><code>POST /api/search-and-execute-note/{noteId}</code> · <code>searchAndExecute</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Execution results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Find related notes by attributes</h3><p><code>POST /api/search-related</code> · <code>searchRelated</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-Attribute\"><code>Attribute</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Related notes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>count</code> <br><em>required</em></td><td><code>integer</code> <br>Distinct notes matching, counted before the twenty-result cap.</td></tr><tr><td><code>results</code> <br><em>required</em></td><td><code>array of object</code> <br>At most twenty, name-and-value matches ahead of name-only ones.</td></tr><tr><td><code>results[].notePathArray</code> <br><em>required</em></td><td><code>array of string</code> <br>Note IDs from the root down to the matched note.</td></tr><tr><td><code>results[].score</code> <br><em>required</em></td><td><code>number</code> <br>Search relevance, higher is better.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"count\": 0,\n \"results\": [\n {\n \"notePathArray\": [\n \"string\"\n ],\n \"score\": 0\n }\n ]\n}</code></pre></div></div></div></section></div><h3>Search template notes</h3><p><code>GET /api/search-templates</code> · <code>searchTemplates</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Template notes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-Note\"><code>Note</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n]</code></pre></div></section></div><h3>Get autocomplete suggestions</h3><p><code>GET /api/autocomplete</code> · <code>autocomplete</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>query</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>fastSearch</code></td><td><code>boolean</code></td></tr><tr><td><code>activeNoteId</code></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Autocomplete suggestions</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"path\": \"string\"\n }\n]</code></pre></div></section></div><h3>Find similar notes</h3><p><code>GET /api/similar-notes/{noteId}</code> · <code>findSimilarNotes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Similar notes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"similarity\": 0\n }\n]</code></pre></div></section></div><h2><span class=\"tn-icon bx bx-transfer\"></span> Import/Export</h2><p>Import and export operations</p><h3>Export branch</h3><p><code>GET /api/branches/{branchId}/export/{type}/{format}/{taskId}</code> · <code>exportBranch</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>subtree</code>, <code>single</code>.</td></tr><tr><td><code>format</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>html</code>, <code>markdown</code>, <code>opml</code>.</td></tr><tr><td><code>taskId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Exported content</p><div class=\"trilium-tab-panel\"><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Import notes</h3><p><code>POST /api/notes/{parentNoteId}/notes-import</code> · <code>importNotes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr><tr><td><code>safeImport</code></td><td><code>boolean</code></td></tr><tr><td><code>shrinkImages</code></td><td><code>boolean</code></td></tr><tr><td><code>textImportedAsText</code></td><td><code>boolean</code></td></tr><tr><td><code>codeImportedAsCode</code></td><td><code>boolean</code></td></tr><tr><td><code>explodeArchives</code></td><td><code>boolean</code></td></tr><tr><td><code>replaceUnderscoresWithSpaces</code></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Import results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>note</code></td><td><a href=\"#schema-Note\"><code>Note</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"string\",\n \"note\": {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n}</code></pre></div></div></div></section></div><h3>Import attachments</h3><p><code>POST /api/notes/{parentNoteId}/attachments-import</code> · <code>importAttachments</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>array of string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Import results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h2><span class=\"tn-icon bx bx-sync\"></span> Sync</h2><p>Synchronization between instances</p><h3>Test sync connection</h3><p><code>POST /api/sync/test</code> · <code>testSync</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync test results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Trigger sync now</h3><p><code>POST /api/sync/now</code> · <code>syncNow</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync started</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get sync status</h3><p><code>GET /api/sync/check</code> · <code>checkSync</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync status</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>synced</code></td><td><code>boolean</code></td></tr><tr><td><code>lastSyncedPush</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>lastSyncedPull</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"synced\": true,\n \"lastSyncedPush\": \"2019-08-24T14:15:22Z\",\n \"lastSyncedPull\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get sync changes</h3><p><code>GET /api/sync/changed</code> · <code>getSyncChanges</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>instanceId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>lastEntityChangeId</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>logMarkerId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync changes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>entityChanges</code></td><td>array of <a href=\"#schema-EntityChange\"><code>EntityChange</code></a></td></tr><tr><td><code>lastEntityChangeId</code></td><td><code>integer</code></td></tr><tr><td><code>outstandingPullCount</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"entityChanges\": [\n {\n \"entityChange\": {\n \"entityName\": \"string\",\n \"changeId\": \"string\"\n },\n \"entity\": {}\n }\n ],\n \"lastEntityChangeId\": 0,\n \"outstandingPullCount\": 0\n}</code></pre></div></div></div></section></div><h3>Push sync changes</h3><p><code>PUT /api/sync/update</code> · <code>pushSyncChanges</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>logMarkerId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Header parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>pageCount</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>pageIndex</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>requestId</code></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>instanceId</code></td><td><code>string</code></td></tr><tr><td><code>entities</code></td><td>array of <a href=\"#schema-EntityChange\"><code>EntityChange</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"instanceId\": \"string\",\n \"entities\": [\n {\n \"entityChange\": {\n \"entityName\": \"string\",\n \"changeId\": \"string\"\n },\n \"entity\": {}\n }\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Changes processed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Mark sync as finished</h3><p><code>POST /api/sync/finished</code> · <code>finishSync</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Sync finished</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get sync statistics</h3><p><code>GET /api/sync/stats</code> · <code>getSyncStats</code></p><p><strong>Authorization</strong>: none</p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync statistics</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>initialized</code></td><td><code>boolean</code></td></tr><tr><td><code>stats</code></td><td><code>object</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"initialized\": true,\n \"stats\": {}\n}</code></pre></div></div></div></section></div><h3>Fill entity changes</h3><p><code>POST /api/sync/fill-entity-changes</code> · <code>fillEntityChanges</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Entity changes filled</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Force full sync</h3><p><code>POST /api/sync/force-full-sync</code> · <code>forceFullSync</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Full sync forced</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Check entity changes consistency</h3><p><code>POST /api/sync/check-entity-changes</code> · <code>checkEntityChanges</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Consistency check results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Queue sector for sync</h3><p><code>POST /api/sync/queue-sector/{entityName}/{sector}</code> · <code>queueSyncSector</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>entityName</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>sector</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Sector queued</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h2><span class=\"tn-icon bx bx-code-alt\"></span> Scripting</h2><p>Script execution and automation</p><h3>Execute script</h3><p><code>POST /api/script/exec</code> · <code>executeScript</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>script</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>params</code></td><td><code>array of string</code></td></tr><tr><td><code>startNoteId</code></td><td><code>string</code></td></tr><tr><td><code>currentNoteId</code></td><td><code>string</code></td></tr><tr><td><code>originEntityName</code></td><td><code>string</code></td></tr><tr><td><code>originEntityId</code></td><td><code>string</code></td></tr><tr><td><code>transactional</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"script\": \"string\",\n \"params\": [\n \"string\"\n ],\n \"startNoteId\": \"string\",\n \"currentNoteId\": \"string\",\n \"originEntityName\": \"string\",\n \"originEntityId\": \"string\",\n \"transactional\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Script execution results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre></div></section></div><h3>Run script note</h3><p><code>POST /api/script/run/{noteId}</code> · <code>runScriptNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Script execution results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get startup script bundles</h3><p><code>GET /api/script/startup</code> · <code>getStartupScripts</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>mobile</code></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Startup scripts</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-ScriptBundle\"><code>ScriptBundle</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"script\": \"string\",\n \"html\": \"string\",\n \"css\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get widget script bundles</h3><p><code>GET /api/script/widgets</code> · <code>getWidgetScripts</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Widget scripts</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-ScriptBundle\"><code>ScriptBundle</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"script\": \"string\",\n \"html\": \"string\",\n \"css\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get script bundle for note</h3><p><code>POST /api/script/bundle/{noteId}</code> · <code>getScriptBundle</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Script bundle</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-ScriptBundle\"><code>ScriptBundle</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>script</code></td><td><code>string</code></td></tr><tr><td><code>html</code></td><td><code>string</code></td></tr><tr><td><code>css</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"string\",\n \"script\": \"string\",\n \"html\": \"string\",\n \"css\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Get relation script bundles</h3><p><code>GET /api/script/relation/{noteId}/{relationName}</code> · <code>getRelationScripts</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>relationName</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Relation scripts</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-ScriptBundle\"><code>ScriptBundle</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"script\": \"string\",\n \"html\": \"string\",\n \"css\": \"string\"\n }\n]</code></pre></div></section></div><h2><span class=\"tn-icon bx bx-cog\"></span> Configuration</h2><p>System options and settings</p><h3>Get application information</h3><p><code>GET /api/app-info</code> · <code>getAppInfo</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Application information</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-AppInfo\"><code>AppInfo</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>appVersion</code></td><td><code>string</code></td></tr><tr><td><code>dbVersion</code></td><td><code>integer</code></td></tr><tr><td><code>nodeVersion</code></td><td><code>string</code></td></tr><tr><td><code>syncVersion</code></td><td><code>integer</code></td></tr><tr><td><code>buildDate</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>buildRevision</code></td><td><code>string</code></td></tr><tr><td><code>dataDirectory</code></td><td><code>string</code></td></tr><tr><td><code>clipperProtocolVersion</code></td><td><code>string</code></td></tr><tr><td><code>utcDateTime</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"appVersion\": \"0.91.6\",\n \"dbVersion\": 228,\n \"nodeVersion\": \"string\",\n \"syncVersion\": 34,\n \"buildDate\": \"2019-08-24T14:15:22Z\",\n \"buildRevision\": \"string\",\n \"dataDirectory\": \"string\",\n \"clipperProtocolVersion\": \"string\",\n \"utcDateTime\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get setup status</h3><p><code>GET /api/setup/status</code> · <code>getSetupStatus</code></p><p><strong>Authorization</strong>: none</p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Setup status</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>isInitialized</code></td><td><code>boolean</code></td></tr><tr><td><code>schemaExists</code></td><td><code>boolean</code></td></tr><tr><td><code>syncVersion</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"isInitialized\": true,\n \"schemaExists\": true,\n \"syncVersion\": 0\n}</code></pre></div></div></div></section></div><h3>Initialize new document</h3><p><code>POST /api/setup/new-document</code> · <code>initNewDocument</code></p><p><strong>Authorization</strong>: none</p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>password</code> <br><em>required</em></td><td><code>string (password)</code></td></tr><tr><td><code>theme</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"password\": \"string\",\n \"theme\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Document initialized</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Setup sync from server</h3><p><code>POST /api/setup/sync-from-server</code> · <code>setupSyncFromServer</code></p><p><strong>Authorization</strong>: none</p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>syncServerHost</code> <br><em>required</em></td><td><code>string (uri)</code></td></tr><tr><td><code>syncProxy</code></td><td><code>string</code></td></tr><tr><td><code>password</code> <br><em>required</em></td><td><code>string (password)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"syncServerHost\": \"string\",\n \"syncProxy\": \"string\",\n \"password\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync setup successful</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get sync seed for setup</h3><p><code>GET /api/setup/sync-seed</code> · <code>getSyncSeed</code></p><p><strong>Authorization</strong>: none</p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync seed information</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>syncVersion</code></td><td><code>integer</code></td></tr><tr><td><code>schemaVersion</code></td><td><code>integer</code></td></tr><tr><td><code>documentSecret</code></td><td><code>string</code></td></tr><tr><td><code>maxSyncId</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"syncVersion\": 0,\n \"schemaVersion\": 0,\n \"documentSecret\": \"string\",\n \"maxSyncId\": 0\n}</code></pre></div></div></div></section></div><h3>Get system options</h3><p><code>GET /api/options</code> · <code>getOptions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: System options</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre></div></section></div><h3>Update multiple options</h3><p><code>PUT /api/options</code> · <code>updateOptions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Options updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Update single option</h3><p><code>PUT /api/options/{name}/{value}</code> · <code>updateOption</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Option updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get user-defined themes</h3><p><code>GET /api/options/user-themes</code> · <code>getUserThemes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: User themes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"name\": \"string\",\n \"label\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get supported locales</h3><p><code>GET /api/options/locales</code> · <code>getLocales</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Supported locales</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"code\": \"string\",\n \"name\": \"string\"\n }\n]</code></pre></div></section></div><h2><span class=\"tn-icon bx bx-data\"></span> Database</h2><p>Database operations</p><h3>Get database schema</h3><p><code>GET /api/sql/schema</code> · <code>getDatabaseSchema</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Database schema</p><div class=\"trilium-tab-panel\"><ul><li><code>text/plain</code>: <code>string</code></li></ul></div></section></div><h3>Execute SQL from note</h3><p><code>POST /api/sql/execute/{noteId}</code> · <code>executeSql</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: SQL execution results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {}\n]</code></pre></div></section></div><h3>Create database backup</h3><p><code>POST /api/database/backup-database</code> · <code>backupDatabase</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Backup created</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>List existing backups</h3><p><code>GET /api/database/backups</code> · <code>listBackups</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Backup list</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>backupFolderPath</code></td><td><code>string | null</code> <br>Directory where the backups are stored, or null if there is no user-accessible location.</td></tr><tr><td><code>backups</code></td><td><code>array of object</code></td></tr><tr><td><code>backups[].fileName</code></td><td><code>string</code></td></tr><tr><td><code>backups[].filePath</code></td><td><code>string</code></td></tr><tr><td><code>backups[].mtime</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>backups[].fileSize</code></td><td><code>integer</code> <br>Size of the backup file, in bytes.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"backupFolderPath\": \"string\",\n \"backups\": [\n {\n \"fileName\": \"string\",\n \"filePath\": \"string\",\n \"mtime\": \"2019-08-24T14:15:22Z\",\n \"fileSize\": 0\n }\n ]\n}</code></pre></div></div></div></section></div><h3>Vacuum database</h3><p><code>POST /api/database/vacuum-database</code> · <code>vacuumDatabase</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Database vacuumed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Anonymize database</h3><p><code>POST /api/database/anonymize/{type}</code> · <code>anonymizeDatabase</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>save-as-file</code>, <code>save-and-send</code>.</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Anonymization results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>List anonymized databases</h3><p><code>GET /api/database/anonymized-databases</code> · <code>listAnonymizedDatabases</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Anonymized database list</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>anonymizedFolderPath</code></td><td><code>string</code> <br>Directory where the anonymized databases are stored.</td></tr><tr><td><code>databases</code></td><td><code>array of object</code></td></tr><tr><td><code>databases[].fileName</code></td><td><code>string</code></td></tr><tr><td><code>databases[].filePath</code></td><td><code>string</code></td></tr><tr><td><code>databases[].mtime</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>databases[].fileSize</code></td><td><code>integer</code> <br>Size of the anonymized database file, in bytes.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"anonymizedFolderPath\": \"string\",\n \"databases\": [\n {\n \"fileName\": \"string\",\n \"filePath\": \"string\",\n \"mtime\": \"2019-08-24T14:15:22Z\",\n \"fileSize\": 0\n }\n ]\n}</code></pre></div></div></div></section></div><h3>Download an anonymized database file</h3><p><code>GET /api/database/anonymized/download</code> · <code>downloadAnonymizedDatabase</code></p><p>Only files inside the anonymized database directory can be downloaded; any other path is refused with 403.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>filePath</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Anonymized database file</p><div class=\"trilium-tab-panel\"><ul><li><code>application/x-sqlite3</code>: <code>string (binary)</code></li></ul></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">400: Missing filePath</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">403: Path not allowed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: File not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Fix consistency issues</h3><p><code>POST /api/database/find-and-fix-consistency-issues</code> · <code>fixConsistencyIssues</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Consistency check results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Check database integrity</h3><p><code>GET /api/database/check-integrity</code> · <code>checkIntegrity</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Integrity check results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>results</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"results\": [\n \"string\"\n ]\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-bot\"></span> LLM</h2><p>AI/LLM integration</p><h3>List all chat sessions</h3><p><code>GET /api/llm/chat</code> · <code>listChatSessions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Chat sessions</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-ChatSession\"><code>ChatSession</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"sessionId\": \"string\",\n \"title\": \"string\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"string\",\n \"timestamp\": \"2019-08-24T14:15:22Z\"\n }\n ],\n \"createdAt\": \"2019-08-24T14:15:22Z\",\n \"lastActive\": \"2019-08-24T14:15:22Z\",\n \"messageCount\": 0\n }\n]</code></pre></div></section></div><h3>Create new chat session</h3><p><code>POST /api/llm/chat</code> · <code>createChatSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>systemPrompt</code></td><td><code>string</code></td></tr><tr><td><code>temperature</code></td><td><code>number</code></td></tr><tr><td><code>maxTokens</code></td><td><code>integer</code></td></tr><tr><td><code>model</code></td><td><code>string</code></td></tr><tr><td><code>provider</code></td><td><code>string</code> <br>One of <code>openai</code>, <code>anthropic</code>, <code>ollama</code>.</td></tr><tr><td><code>contextNoteId</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"systemPrompt\": \"string\",\n \"temperature\": 0,\n \"maxTokens\": 0,\n \"model\": \"string\",\n \"provider\": \"openai\",\n \"contextNoteId\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Chat session created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-ChatSession\"><code>ChatSession</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>messages</code></td><td><code>array of object</code></td></tr><tr><td><code>messages[].role</code></td><td><code>string</code> <br>One of <code>user</code>, <code>assistant</code>, <code>system</code>.</td></tr><tr><td><code>messages[].content</code></td><td><code>string</code></td></tr><tr><td><code>messages[].timestamp</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>createdAt</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>lastActive</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>messageCount</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"sessionId\": \"string\",\n \"title\": \"string\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"string\",\n \"timestamp\": \"2019-08-24T14:15:22Z\"\n }\n ],\n \"createdAt\": \"2019-08-24T14:15:22Z\",\n \"lastActive\": \"2019-08-24T14:15:22Z\",\n \"messageCount\": 0\n}</code></pre></div></div></div></section></div><h3>Get specific chat session</h3><p><code>GET /api/llm/chat/{sessionId}</code> · <code>getChatSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Chat session details</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-ChatSession\"><code>ChatSession</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>messages</code></td><td><code>array of object</code></td></tr><tr><td><code>messages[].role</code></td><td><code>string</code> <br>One of <code>user</code>, <code>assistant</code>, <code>system</code>.</td></tr><tr><td><code>messages[].content</code></td><td><code>string</code></td></tr><tr><td><code>messages[].timestamp</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>createdAt</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>lastActive</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>messageCount</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"sessionId\": \"string\",\n \"title\": \"string\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"string\",\n \"timestamp\": \"2019-08-24T14:15:22Z\"\n }\n ],\n \"createdAt\": \"2019-08-24T14:15:22Z\",\n \"lastActive\": \"2019-08-24T14:15:22Z\",\n \"messageCount\": 0\n}</code></pre></div></div></div></section></div><h3>Update chat session</h3><p><code>PATCH /api/llm/chat/{sessionId}</code> · <code>updateChatSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>systemPrompt</code></td><td><code>string</code></td></tr><tr><td><code>temperature</code></td><td><code>number</code></td></tr><tr><td><code>maxTokens</code></td><td><code>integer</code></td></tr><tr><td><code>model</code></td><td><code>string</code></td></tr><tr><td><code>provider</code></td><td><code>string</code></td></tr><tr><td><code>contextNoteId</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"systemPrompt\": \"string\",\n \"temperature\": 0,\n \"maxTokens\": 0,\n \"model\": \"string\",\n \"provider\": \"string\",\n \"contextNoteId\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Session updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-ChatSession\"><code>ChatSession</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>messages</code></td><td><code>array of object</code></td></tr><tr><td><code>messages[].role</code></td><td><code>string</code> <br>One of <code>user</code>, <code>assistant</code>, <code>system</code>.</td></tr><tr><td><code>messages[].content</code></td><td><code>string</code></td></tr><tr><td><code>messages[].timestamp</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>createdAt</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>lastActive</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>messageCount</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"sessionId\": \"string\",\n \"title\": \"string\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"string\",\n \"timestamp\": \"2019-08-24T14:15:22Z\"\n }\n ],\n \"createdAt\": \"2019-08-24T14:15:22Z\",\n \"lastActive\": \"2019-08-24T14:15:22Z\",\n \"messageCount\": 0\n}</code></pre></div></div></div></section></div><h3>Delete chat session</h3><p><code>DELETE /api/llm/chat/{chatNoteId}</code> · <code>deleteChatSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>chatNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Session deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Send message to LLM</h3><p><code>POST /api/llm/chat/{chatNoteId}/messages</code> · <code>sendChatMessage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>options</code></td><td><code>object</code></td></tr><tr><td><code>options.temperature</code></td><td><code>number</code></td></tr><tr><td><code>options.maxTokens</code></td><td><code>integer</code></td></tr><tr><td><code>options.model</code></td><td><code>string</code></td></tr><tr><td><code>options.provider</code></td><td><code>string</code></td></tr><tr><td><code>includeContext</code></td><td><code>boolean</code></td></tr><tr><td><code>useNoteContext</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"message\": \"string\",\n \"options\": {\n \"temperature\": 0,\n \"maxTokens\": 0,\n \"model\": \"string\",\n \"provider\": \"string\"\n },\n \"includeContext\": true,\n \"useNoteContext\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: LLM response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>response</code></td><td><code>string</code></td></tr><tr><td><code>sources</code></td><td><code>array of object</code></td></tr><tr><td><code>sources[].noteId</code></td><td><code>string</code></td></tr><tr><td><code>sources[].title</code></td><td><code>string</code></td></tr><tr><td><code>sources[].similarity</code></td><td><code>number</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"response\": \"string\",\n \"sources\": [\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"similarity\": 0\n }\n ]\n}</code></pre></div></div></div></section></div><h3>Stream message to LLM</h3><p><code>POST /api/llm/chat/{chatNoteId}/messages/stream</code> · <code>streamChatMessage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>content</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>useAdvancedContext</code></td><td><code>boolean</code></td></tr><tr><td><code>showThinking</code></td><td><code>boolean</code></td></tr><tr><td><code>mentions</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"content\": \"string\",\n \"useAdvancedContext\": true,\n \"showThinking\": true,\n \"mentions\": [\n \"string\"\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Streaming started</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>List Ollama models</h3><p><code>GET /api/llm/providers/ollama/models</code> · <code>listOllamaModels</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>baseUrl</code></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Ollama models</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>models</code></td><td><code>array of object</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"models\": [\n {}\n ]\n}</code></pre></div></div></div></section></div><h3>List OpenAI models</h3><p><code>GET /api/llm/providers/openai/models</code> · <code>listOpenAIModels</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: OpenAI models</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>chatModels</code></td><td><code>array of object</code></td></tr><tr><td><code>chatModels[].id</code></td><td><code>string</code></td></tr><tr><td><code>chatModels[].name</code></td><td><code>string</code></td></tr><tr><td><code>chatModels[].type</code></td><td><code>string</code></td></tr><tr><td><code>embeddingModels</code></td><td><code>array of object</code></td></tr><tr><td><code>embeddingModels[].id</code></td><td><code>string</code></td></tr><tr><td><code>embeddingModels[].name</code></td><td><code>string</code></td></tr><tr><td><code>embeddingModels[].type</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"chatModels\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"type\": \"string\"\n }\n ],\n \"embeddingModels\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"type\": \"string\"\n }\n ]\n}</code></pre></div></div></div></section></div><h3>List Anthropic models</h3><p><code>GET /api/llm/providers/anthropic/models</code> · <code>listAnthropicModels</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Anthropic models</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>chatModels</code></td><td><code>array of object</code></td></tr><tr><td><code>chatModels[].id</code></td><td><code>string</code></td></tr><tr><td><code>chatModels[].name</code></td><td><code>string</code></td></tr><tr><td><code>chatModels[].type</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"chatModels\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"type\": \"string\"\n }\n ]\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-shield-quarter\"></span> Security</h2><p>Security features (2FA, tokens)</p><h3>Change password</h3><p><code>POST /api/password/change</code> · <code>changePassword</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>current_password</code></td><td><code>string (password)</code></td></tr><tr><td><code>new_password</code> <br><em>required</em></td><td><code>string (password)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"current_password\": \"string\",\n \"new_password\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Password changed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Reset password (destructive)</h3><p><code>POST /api/password/reset</code> · <code>resetPassword</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>really</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Password reset</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Generate a TOTP secret</h3><p><code>GET /api/totp/generate</code> · <code>generateTotpSecret</code></p><p>Generates a fresh TOTP secret without persisting it. The caller must verify a code for this secret (see <code>/api/totp/verify</code>) and commit it (see <code>/api/totp/enable</code>) before it becomes active.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: TOTP secret generated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>message</code></td><td><code>string</code> <br>The bare TOTP secret (for manual entry), or an error message on failure.</td></tr><tr><td><code>url</code></td><td><code>string</code> <br>The <code>otpauth://</code> URL the authenticator expects, rendered as a QR code by the client.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"message\": \"string\",\n \"url\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Verify a generated TOTP secret</h3><p><code>POST /api/totp/verify</code> · <code>verifyTotpSecret</code></p><p>Verifies a freshly generated secret against a code the user produced for it, without persisting anything. On success, issues (unpersisted) recovery codes to be shown as the next enrollment step.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>secret</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>token</code> <br><em>required</em></td><td><code>string</code> <br>A TOTP code the user generated for the supplied secret.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"secret\": \"string\",\n \"token\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Verification result</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>recoveryCodes</code></td><td><code>array of string</code> <br>One-time recovery codes, present only when verification succeeds.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"recoveryCodes\": [\n \"string\"\n ]\n}</code></pre></div></div></div></section></div><h3>Enable TOTP with a verified secret</h3><p><code>POST /api/totp/enable</code> · <code>enableTotp</code></p><p>Commits a verified secret together with its recovery codes, activating TOTP. This is the final enrollment step and the only point at which the secret and recovery codes are persisted.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>secret</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>recoveryCodes</code> <br><em>required</em></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"secret\": \"string\",\n \"recoveryCodes\": [\n \"string\"\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Result of enabling TOTP</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true\n}</code></pre></div></div></div></section></div><h3>Get TOTP status</h3><p><code>GET /api/totp/status</code> · <code>getTotpStatus</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: TOTP status</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>message</code></td><td><code>boolean</code> <br>Whether TOTP is the active second factor and a secret is set.</td></tr><tr><td><code>set</code></td><td><code>boolean</code> <br>Whether a TOTP secret is currently stored.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"message\": true,\n \"set\": true\n}</code></pre></div></div></div></section></div><h3>Get the stored TOTP secret</h3><p><code>GET /api/totp/get</code> · <code>getTotpSecret</code></p><p>Returns <code>null</code> when no secret is set.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: TOTP secret</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>string | null</code></li></ul><pre><code class=\"language-application-json\">\"string\"</code></pre></div></section></div><h3>Reset (disable) TOTP</h3><p><code>POST /api/totp/reset</code> · <code>resetTotp</code></p><p>Clears the stored TOTP secret and its recovery codes, disabling TOTP.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Result of resetting TOTP</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true\n}</code></pre></div></div></div></section></div><h3>Check if TOTP recovery codes are set</h3><p><code>GET /api/totp_recovery/enabled</code> · <code>isTotpRecoveryEnabled</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: TOTP recovery status</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>keysExist</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"keysExist\": true\n}</code></pre></div></div></div></section></div><h3>Regenerate TOTP recovery codes</h3><p><code>POST /api/totp_recovery/regenerate</code> · <code>regenerateTotpRecoveryCodes</code></p><p>Issues a fresh batch of recovery codes for the already-enrolled TOTP secret, replacing any existing ones, and returns them for one-time display. Refuses when no TOTP secret is set.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Generated recovery codes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>recoveryCodes</code></td><td><code>array of string</code> <br>New recovery codes, present only when regeneration succeeds.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"recoveryCodes\": [\n \"string\"\n ]\n}</code></pre></div></div></div></section></div><h3>Get used TOTP recovery codes</h3><p><code>GET /api/totp_recovery/used</code> · <code>getUsedTotpRecoveryCodes</code></p><p>Returns an empty array if no recovery codes are set, otherwise an object listing each code's status.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Recovery code status</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of any | object</code></li></ul><pre><code class=\"language-application-json\">[\n null\n]</code></pre></div></section></div><h3>Verify a TOTP recovery code</h3><p><code>POST /api/totp_recovery/verify</code> · <code>verifyTotpRecoveryCode</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>recovery_code_guess</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"recovery_code_guess\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Verification result</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true\n}</code></pre></div></div></div></section></div><h3>List ETAPI tokens</h3><p><code>GET /api/etapi-tokens</code> · <code>listEtapiTokens</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: ETAPI tokens</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-EtapiToken\"><code>EtapiToken</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"etapiTokenId\": \"string\",\n \"name\": \"string\",\n \"token\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"isDeleted\": true\n }\n]</code></pre></div></section></div><h3>Create ETAPI token</h3><p><code>POST /api/etapi-tokens</code> · <code>createEtapiToken</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"name\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Token created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-EtapiToken\"><code>EtapiToken</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>etapiTokenId</code></td><td><code>string</code></td></tr><tr><td><code>name</code></td><td><code>string</code></td></tr><tr><td><code>token</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>isDeleted</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"etapiTokenId\": \"string\",\n \"name\": \"string\",\n \"token\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"isDeleted\": true\n}</code></pre></div></div></div></section></div><h3>Delete ETAPI token</h3><p><code>DELETE /api/etapi-tokens/{etapiTokenId}</code> · <code>deleteEtapiToken</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>etapiTokenId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Token deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Update ETAPI token</h3><p><code>PATCH /api/etapi-tokens/{etapiTokenId}</code> · <code>updateEtapiToken</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>etapiTokenId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"name\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Token updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-EtapiToken\"><code>EtapiToken</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>etapiTokenId</code></td><td><code>string</code></td></tr><tr><td><code>name</code></td><td><code>string</code></td></tr><tr><td><code>token</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>isDeleted</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"etapiTokenId\": \"string\",\n \"name\": \"string\",\n \"token\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"isDeleted\": true\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-star\"></span> Special Notes</h2><p>Special note types (calendar, inbox)</p><h3>Get/create inbox note</h3><p><code>GET /api/special-notes/inbox/{date}</code> · <code>getInboxNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>date</code> <br><em>required</em></td><td><code>string (date)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Inbox note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Resolve where an inbox capture would go</h3><p><code>GET /api/special-notes/inbox-target</code> · <code>getInboxTarget</code></p><p>Reports the destination <code>/api/special-notes/inbox/{date}</code> would use, without creating anything. Honours the hoisted note, read from the <code>trilium-hoisted-note-id</code> header.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: The resolved destination</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>kind</code> <br><em>required</em></td><td><code>string</code> <br>Which rule decided the destination. <code>dayNote</code> names no note, because the day note is created when the capture happens. One of <code>inbox</code>, <code>workspaceInbox</code>, <code>workspaceRoot</code>, <code>dayNote</code>, <code>root</code>.</td></tr><tr><td><code>noteId</code></td><td><code>string</code> <br>Absent for <code>dayNote</code>.</td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Absent for <code>dayNote</code>.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"kind\": \"inbox\",\n \"noteId\": \"string\",\n \"title\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Get/create day note</h3><p><code>GET /api/special-notes/days/{date}</code> · <code>getDayNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>date</code> <br><em>required</em></td><td><code>string (date)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Day note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get/create week note</h3><p><code>GET /api/special-notes/weeks/{week}</code> · <code>getWeekNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>week</code> <br><em>required</em></td><td><code>string</code> <br>Matches <code>^\\d{4}-\\d{2}$</code>.</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Week note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get/create month note</h3><p><code>GET /api/special-notes/months/{month}</code> · <code>getMonthNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>month</code> <br><em>required</em></td><td><code>string</code> <br>Matches <code>^\\d{4}-\\d{2}$</code>.</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Month note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get/create year note</h3><p><code>GET /api/special-notes/years/{year}</code> · <code>getYearNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>year</code> <br><em>required</em></td><td><code>string</code> <br>Matches <code>^\\d{4}$</code>.</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Year note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Create SQL console note</h3><p><code>POST /api/special-notes/sql-console</code> · <code>createSqlConsole</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: SQL console created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Create search note</h3><p><code>POST /api/special-notes/search-note</code> · <code>createSearchNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Search note created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Create launcher</h3><p><code>POST /api/special-notes/launchers/{parentNoteId}/{launcherType}</code> · <code>createLauncher</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>launcherType</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Launcher created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get notes for specific month</h3><p><code>GET /api/special-notes/notes-for-month/{month}</code> · <code>getNotesForMonth</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>month</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Notes for the month</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-Note\"><code>Note</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n]</code></pre></div></section></div><h3>Get quarter note</h3><p><code>GET /api/special-notes/quarters/{quarter}</code> · <code>getQuarter</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>quarter</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Quarter note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get first day of week for date</h3><p><code>GET /api/special-notes/week-first-day/{date}</code> · <code>getWeekFirstDay</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>date</code> <br><em>required</em></td><td><code>string (date)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: First day of week</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>date</code></td><td><code>string (date)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"date\": \"2019-08-24\"\n}</code></pre></div></div></div></section></div><h3>Reset launcher note</h3><p><code>POST /api/special-notes/launchers/{noteId}/reset</code> · <code>resetLauncher</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Launcher reset</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Save search note</h3><p><code>POST /api/special-notes/save-search-note</code> · <code>saveSearchNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>query</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"query\": \"string\",\n \"title\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Search note saved</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Save SQL console note</h3><p><code>POST /api/special-notes/save-sql-console</code> · <code>saveSqlConsole</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>sql</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"sql\": \"string\",\n \"title\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: SQL console saved</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Update API script launcher</h3><p><code>PUT /api/special-notes/api-script-launcher</code> · <code>updateApiScriptLauncher</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>code</code></td><td><code>string</code> <br>Script code</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"code\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: API script launcher updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-map-alt\"></span> Visualization</h2><p>Maps and visualizations</p><h3>Get tree map</h3><p><code>POST /api/note-map/{noteId}/tree</code> · <code>getTreeMap</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Tree map data</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre></div></section></div><h3>Get link map</h3><p><code>POST /api/note-map/{noteId}/link</code> · <code>getLinkMap</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Link map data</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre></div></section></div><h3>Get backlinks</h3><p><code>GET /api/note-map/{noteId}/backlinks</code> · <code>getBacklinks</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Backlinks</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get backlink count for note</h3><p><code>GET /api/note-map/{noteId}/backlink-count</code> · <code>getBacklinkCount</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Backlink count</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>count</code></td><td><code>integer</code> <br>Number of backlinks to this note</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"count\": 0\n}</code></pre></div></div></div></section></div><h3>Get relation map data</h3><p><code>POST /api/relation-map</code> · <code>getRelationMap</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>maxDepth</code></td><td><code>integer</code></td></tr><tr><td><code>excludeArchived</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"string\",\n \"maxDepth\": 0,\n \"excludeArchived\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Relation map data</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre></div></section></div><h2><span class=\"tn-icon bx bx-globe\"></span> External</h2><p>External integrations (clipper, sender)</p><h3>Clipper handshake</h3><p><code>GET /api/clipper/handshake</code> · <code>clipperHandshake</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Handshake successful</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>protocolVersion</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"protocolVersion\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Add web clipping</h3><p><code>POST /api/clipper/clippings</code> · <code>addClipping</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code></td></tr><tr><td><code>url</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"content\": \"string\",\n \"url\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Clipping created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Create clipper note</h3><p><code>POST /api/clipper/notes</code> · <code>createClipperNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"content\": \"string\",\n \"parentNoteId\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Note created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Open note in clipper</h3><p><code>POST /api/clipper/open/{noteId}</code> · <code>openNoteInClipper</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note opened in clipper</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>url</code></td><td><code>string</code> <br>URL to open in clipper</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"url\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Sender login</h3><p><code>POST /api/sender/login</code> · <code>senderLogin</code></p><p><strong>Authorization</strong>: none</p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>username</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>password</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"username\": \"string\",\n \"password\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Login successful</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"token\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Upload image from sender</h3><p><code>POST /api/sender/image</code> · <code>uploadSenderImage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Image uploaded</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Save note from sender</h3><p><code>POST /api/sender/note</code> · <code>saveSenderNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"content\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Note saved</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-wrench\"></span> Utilities</h2><p>Miscellaneous utilities</p><h3>Get system metrics</h3><p><code>GET /api/metrics</code> · <code>getMetrics</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>format</code></td><td><code>string</code> <br>One of <code>prometheus</code>, <code>json</code>.</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: System metrics</p><div class=\"trilium-tab-panel\"><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>application/json</code>: <code>object</code></p><div class=\"trilium-tab-panel\"><pre><code class=\"language-application-json\">{}</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>text/plain</code>: <code>string</code></p><div class=\"trilium-tab-panel\"><p>&nbsp;</p></div></section></div></div></section></div><h3>Run system diagnostics</h3><p><code>GET /api/system-checks</code> · <code>runSystemChecks</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: System check results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"name\": \"string\",\n \"status\": \"pass\",\n \"message\": \"string\"\n }\n]</code></pre></div></section></div><h3>Health check endpoint</h3><p><code>GET /api/health-check</code> · <code>healthCheck</code></p><p><strong>Authorization</strong>: none</p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Service is healthy</p><div class=\"trilium-tab-panel\"><ul><li><code>text/plain</code>: <code>string</code></li></ul></div></section></div><h3>Get backend log</h3><p><code>GET /api/backend-log</code> · <code>getBackendLog</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Backend log entries</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"timestamp\": \"2019-08-24T14:15:22Z\",\n \"level\": \"string\",\n \"message\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get note size</h3><p><code>GET /api/stats/note-size/{noteId}</code> · <code>getNoteSize</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note size</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>size</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"size\": 0\n}</code></pre></div></div></div></section></div><h3>Get subtree size</h3><p><code>GET /api/stats/subtree-size/{noteId}</code> · <code>getSubtreeSize</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Subtree size</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>size</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"size\": 0\n}</code></pre></div></div></div></section></div><h3>Get keyboard actions</h3><p><code>GET /api/keyboard-actions</code> · <code>getKeyboardActions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Keyboard actions</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"actionName\": \"string\",\n \"shortcut\": \"string\",\n \"description\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get keyboard shortcuts for notes</h3><p><code>GET /api/keyboard-shortcuts-for-notes</code> · <code>getKeyboardShortcutsForNotes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Keyboard shortcuts for notes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"shortcut\": \"string\",\n \"title\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get font CSS</h3><p><code>GET /api/fonts</code> · <code>getFonts</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Font CSS</p><div class=\"trilium-tab-panel\"><ul><li><code>text/css</code>: <code>string</code></li></ul></div></section></div><h3>Add recent note</h3><p><code>POST /api/recent-notes</code> · <code>addRecentNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Note added to recent</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get recent changes</h3><p><code>GET /api/recent-changes/{ancestorNoteId}</code> · <code>getRecentChanges</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>ancestorNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Recent changes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\"\n }\n]</code></pre></div></section></div><h3>Get icon usage statistics</h3><p><code>GET /api/other/icon-usage</code> · <code>getIconUsage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Icon usage stats</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre></div></section></div><h3>Render markdown to HTML</h3><p><code>POST /api/other/render-markdown</code> · <code>renderMarkdown</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>markdownContent</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"markdownContent\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Rendered HTML</p><div class=\"trilium-tab-panel\"><ul><li><code>text/html</code>: <code>string</code></li></ul></div></section></div><h3>Renders given HTML to Markdown</h3><p><code>POST /api/other/to-markdown</code> · <code>toMarkdown</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>htmlContent</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"htmlContent\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Rendered Markdown</p><div class=\"trilium-tab-panel\"><ul><li><code>text/plain</code>: <code>string</code></li></ul></div></section></div><h2><span class=\"tn-icon bx bx-cube\"></span> Schemas</h2><h3><a id=\"schema-Note\"></a><code>Note</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure><h3><a id=\"schema-NoteType\"></a><code>NoteType</code></h3><p>Type: <code>string</code></p><p>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</p><h3><a id=\"schema-Branch\"></a><code>Branch</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code> <br>Branch ID (parentNoteId_noteId)</td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>notePosition</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>prefix</code></td><td><code>string | null</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr></tbody></table></figure><h3><a id=\"schema-Attribute\"></a><code>Attribute</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr></tbody></table></figure><h3><a id=\"schema-Attachment\"></a><code>Attachment</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>ownerId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>role</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>image</code>, <code>file</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure><h3><a id=\"schema-Revision\"></a><code>Revision</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code></td><td><code>string</code></td></tr><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>type</code></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure><h3><a id=\"schema-SearchResult\"></a><code>SearchResult</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>path</code></td><td><code>string</code></td></tr><tr><td><code>score</code></td><td><code>number</code></td></tr><tr><td><code>highlights</code></td><td><code>array of string</code></td></tr></tbody></table></figure><h3><a id=\"schema-EntityChange\"></a><code>EntityChange</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>entityChange</code></td><td><code>object</code></td></tr><tr><td><code>entityChange.entityName</code></td><td><code>string</code></td></tr><tr><td><code>entityChange.changeId</code></td><td><code>string</code></td></tr><tr><td><code>entity</code></td><td><code>object</code></td></tr></tbody></table></figure><h3><a id=\"schema-Timestamps\"></a><code>Timestamps</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure><h3><a id=\"schema-CreateNoteRequest\"></a><code>CreateNoteRequest</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>isProtected</code></td><td><code>boolean</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer</code></td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code></td><td><code>string</code></td></tr><tr><td><code>templateNoteId</code></td><td><code>string</code></td></tr></tbody></table></figure><h3><a id=\"schema-ScriptBundle\"></a><code>ScriptBundle</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>script</code></td><td><code>string</code></td></tr><tr><td><code>html</code></td><td><code>string</code></td></tr><tr><td><code>css</code></td><td><code>string</code></td></tr></tbody></table></figure><h3><a id=\"schema-AppInfo\"></a><code>AppInfo</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>appVersion</code></td><td><code>string</code></td></tr><tr><td><code>dbVersion</code></td><td><code>integer</code></td></tr><tr><td><code>nodeVersion</code></td><td><code>string</code></td></tr><tr><td><code>syncVersion</code></td><td><code>integer</code></td></tr><tr><td><code>buildDate</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>buildRevision</code></td><td><code>string</code></td></tr><tr><td><code>dataDirectory</code></td><td><code>string</code></td></tr><tr><td><code>clipperProtocolVersion</code></td><td><code>string</code></td></tr><tr><td><code>utcDateTime</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure><h3><a id=\"schema-ChatSession\"></a><code>ChatSession</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>messages</code></td><td><code>array of object</code></td></tr><tr><td><code>messages[].role</code></td><td><code>string</code> <br>One of <code>user</code>, <code>assistant</code>, <code>system</code>.</td></tr><tr><td><code>messages[].content</code></td><td><code>string</code></td></tr><tr><td><code>messages[].timestamp</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>createdAt</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>lastActive</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>messageCount</code></td><td><code>integer</code></td></tr></tbody></table></figure><h3><a id=\"schema-EtapiToken\"></a><code>EtapiToken</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>etapiTokenId</code></td><td><code>string</code></td></tr><tr><td><code>name</code></td><td><code>string</code></td></tr><tr><td><code>token</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>isDeleted</code></td><td><code>boolean</code></td></tr></tbody></table></figure>",
+ "_help_z8O2VG4ZZJD7": "<p>This is the internal API used by the Trilium Notes client application.</p><p><strong>Important:</strong> This API is primarily intended for internal use by the Trilium client. For external integrations, please use the <a href=\"https://github.com/TriliumNext/Trilium/blob/main/docs/User%20Guide/User%20Guide/Advanced%20Usage/ETAPI%20(REST%20API).md#etapi-rest-api\">ETAPI (External Trilium API)</a> instead.</p><h2>Signing in</h2><p>Most endpoints require session-based authentication. You can authenticate using:</p><ul><li><strong>Password login</strong>: POST to <code>/api/login</code> with password</li><li><strong>Token authentication</strong>: Generate a token via <code>/api/login/token</code></li><li><strong>Sync authentication</strong>: Use document secret for sync operations</li></ul><h2>Rate Limiting</h2><p>Authentication endpoints are rate-limited to prevent brute force attacks.</p><h2>CSRF Protection</h2><p>State-changing operations require CSRF tokens when using session authentication.</p><h2><span class=\"tn-icon bx bx-lock-alt\"></span> Authentication</h2><h3><code>sessionAuth</code></h3><p>API key in the <code>trilium.sid</code> cookie.</p><p>Session cookie obtained from login</p><h3><code>tokenAuth</code></h3><p>API key in the <code>Authorization</code> header.</p><p>API token in format \"Bearer {token}\"</p><h2><span class=\"tn-icon bx bx-log-in\"></span> Sessions</h2><p>Login, logout, and session management</p><h3>Login with password</h3><p><code>POST /api/login</code> · <code>login</code></p><p>Responds with 401 when the password is wrong or, with two-factor authentication enabled, the TOTP token is missing or wrong.</p><p><strong>Authorization</strong>: none</p><p><strong>Request body</strong> (required)</p><ul><li><code>application/x-www-form-urlencoded</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>password</code> <br><em>required</em></td><td><code>string (password)</code></td></tr><tr><td><code>totpToken</code></td><td><code>string</code> <br>TOTP token if 2FA is enabled</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Login successful</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Set-Cookie</code></td><td><code>string</code> <br>Example: <code>trilium.sid=s%3A...</code></td></tr></tbody></table></figure><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">401: Invalid credentials</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Generate API token</h3><p><code>POST /api/login/token</code> · <code>generateToken</code></p><p><strong>Authorization</strong>: none</p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>password</code> <br><em>required</em></td><td><code>string (password)</code></td></tr><tr><td><code>tokenName</code></td><td><code>string</code> <br>Optional name for the token</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"password\": \"string\",\n \"tokenName\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Token created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>authToken</code></td><td><code>string</code> <br>API authentication token</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"authToken\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Sync login using document secret</h3><p><code>POST /api/login/sync</code> · <code>loginSync</code></p><p><strong>Authorization</strong>: none</p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>timestamp</code> <br><em>required</em></td><td><code>string (date-time)</code></td></tr><tr><td><code>hash</code> <br><em>required</em></td><td><code>string</code> <br>HMAC hash of document secret and timestamp</td></tr><tr><td><code>syncVersion</code> <br><em>required</em></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"timestamp\": \"2019-08-24T14:15:22Z\",\n \"hash\": \"string\",\n \"syncVersion\": 0\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Login successful</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>instanceId</code></td><td><code>string</code></td></tr><tr><td><code>maxEntityChangeId</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"instanceId\": \"string\",\n \"maxEntityChangeId\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Enter protected session</h3><p><code>POST /api/login/protected</code> · <code>enterProtectedSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>password</code> <br><em>required</em></td><td><code>string (password)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"password\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Protected session entered</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">401: Invalid password</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Exit protected session</h3><p><code>POST /api/logout/protected</code> · <code>exitProtectedSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Protected session exited</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Keep protected session alive</h3><p><code>POST /api/login/protected/touch</code> · <code>touchProtectedSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Session refreshed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get OAuth status</h3><p><code>GET /api/oauth/status</code> · <code>getOAuthStatus</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: OAuth status</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>enabled</code></td><td><code>boolean</code></td></tr><tr><td><code>configured</code></td><td><code>boolean</code></td></tr><tr><td><code>providers</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"enabled\": true,\n \"configured\": true,\n \"providers\": [\n \"string\"\n ]\n}</code></pre></div></div></div></section></div><h3>Validate OAuth configuration</h3><p><code>GET /api/oauth/validate</code> · <code>validateOAuth</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: OAuth validation result</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>valid</code></td><td><code>boolean</code></td></tr><tr><td><code>errors</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"valid\": true,\n \"errors\": [\n \"string\"\n ]\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-note\"></span> Notes</h2><p>Core note operations</p><h3>Get note metadata</h3><p><code>GET /api/notes/{noteId}</code> · <code>getNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note metadata</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Delete note</h3><p><code>DELETE /api/notes/{noteId}</code> · <code>deleteNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>taskId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>eraseNotes</code></td><td><code>boolean</code></td></tr><tr><td><code>last</code> <br><em>required</em></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Note deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get note content</h3><p><code>GET /api/notes/{noteId}/blob</code> · <code>getNoteContent</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note content</p><div class=\"trilium-tab-panel\"><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>text/html</code>: <code>string</code></p><div class=\"trilium-tab-panel\"><p>&nbsp;</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>text/plain</code>: <code>string</code></p><div class=\"trilium-tab-panel\"><p>&nbsp;</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>application/json</code>: <code>object</code></p><div class=\"trilium-tab-panel\"><pre><code class=\"language-application-json\">{}</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>application/octet-stream</code>: <code>string (binary)</code></p><div class=\"trilium-tab-panel\"><p>&nbsp;</p></div></section></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Update note content</h3><p><code>PUT /api/notes/{noteId}/data</code> · <code>updateNoteContent</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>content</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>attachments</code></td><td>array of <a href=\"#schema-Attachment\"><code>Attachment</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"content\": \"string\",\n \"attachments\": [\n {\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Content updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get note timestamps</h3><p><code>GET /api/notes/{noteId}/metadata</code> · <code>getNoteMetadata</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note timestamps</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Timestamps\"><code>Timestamps</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Change note title</h3><p><code>PUT /api/notes/{noteId}/title</code> · <code>updateNoteTitle</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Title updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Change note type and MIME</h3><p><code>PUT /api/notes/{noteId}/type</code> · <code>updateNoteType</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"type\": \"text\",\n \"mime\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Type updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Protect or unprotect note</h3><p><code>PUT /api/notes/{noteId}/protect/{isProtected}</code> · <code>protectNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>subtree</code></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Protection status updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Undelete note</h3><p><code>PUT /api/notes/{noteId}/undelete</code> · <code>undeleteNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Note undeleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: Note not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Create new note</h3><p><code>POST /api/notes/{parentNoteId}/children</code> · <code>createNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>target</code></td><td><code>string</code> <br>One of <code>after</code>, <code>into</code>.</td></tr><tr><td><code>targetBranchId</code></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-CreateNoteRequest\"><code>CreateNoteRequest</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>isProtected</code></td><td><code>boolean</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer</code></td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code></td><td><code>string</code></td></tr><tr><td><code>templateNoteId</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"content\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"isExpanded\": true,\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"parentNoteId\": \"string\",\n \"templateNoteId\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Note created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>note</code></td><td><a href=\"#schema-Note\"><code>Note</code></a></td></tr><tr><td><code>branch</code></td><td><a href=\"#schema-Branch\"><code>Branch</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"note\": {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n },\n \"branch\": {\n \"branchId\": \"string\",\n \"noteId\": \"string\",\n \"parentNoteId\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true\n }\n}</code></pre></div></div></div></section></div><h3>Duplicate note subtree</h3><p><code>POST /api/notes/{noteId}/duplicate/{parentNoteId}</code> · <code>duplicateNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Note duplicated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Force save revision</h3><p><code>POST /api/notes/{noteId}/revision</code> · <code>saveRevision</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Revision saved</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Revision\"><code>Revision</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code></td><td><code>string</code></td></tr><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>type</code></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"revisionId\": \"string\",\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Sort child notes</h3><p><code>PUT /api/notes/{noteId}/sort-children</code> · <code>sortChildren</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>sortBy</code></td><td><code>string</code> <br>One of <code>title</code>, <code>dateCreated</code>, <code>dateModified</code>.</td></tr><tr><td><code>sortDirection</code></td><td><code>string</code> <br>One of <code>asc</code>, <code>desc</code>.</td></tr><tr><td><code>foldersFirst</code></td><td><code>boolean</code></td></tr><tr><td><code>sortNatural</code></td><td><code>boolean</code></td></tr><tr><td><code>sortLocale</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"sortBy\": \"title\",\n \"sortDirection\": \"asc\",\n \"foldersFirst\": true,\n \"sortNatural\": true,\n \"sortLocale\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Children sorted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Convert note to attachment</h3><p><code>POST /api/notes/{noteId}/convert-to-attachment</code> · <code>convertToAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note converted to attachment</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>ownerId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>role</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>image</code>, <code>file</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Upload file to note</h3><p><code>PUT /api/notes/{noteId}/file</code> · <code>uploadFileToNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: File uploaded</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Open file note</h3><p><code>GET /api/notes/{noteId}/open</code> · <code>openFileNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: File content</p><div class=\"trilium-tab-panel\"><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Download file note</h3><p><code>GET /api/notes/download/{noteId}</code> · <code>downloadFileNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: File content</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Disposition</code></td><td><code>string</code> <br>Example: <code>attachment; filename=\"document.pdf\"</code></td></tr></tbody></table></figure><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Download file note (alternative path)</h3><p><code>GET /api/notes/{noteId}/download</code> · <code>downloadFileNoteAlt</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: File content</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Disposition</code></td><td><code>string</code> <br>Example: <code>attachment; filename=\"document.pdf\"</code></td></tr></tbody></table></figure><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Save note to temp directory</h3><p><code>POST /api/notes/{noteId}/save-to-tmp-dir</code> · <code>saveToTmpDir</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: File saved to temp directory</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>filePath</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"filePath\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Update note from modified temp file</h3><p><code>POST /api/notes/{noteId}/upload-modified-file</code> · <code>uploadModifiedFile</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>filePath</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"filePath\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Note updated from file</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get image from note</h3><p><code>GET /api/images/{noteId}/{filename}</code> · <code>getNoteImage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>filename</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Image content</p><div class=\"trilium-tab-panel\"><ul><li><code>image/*</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Update image note</h3><p><code>PUT /api/images/{noteId}</code> · <code>updateImageNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Image updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Execute bulk action</h3><p><code>POST /api/bulk-action/execute</code> · <code>executeBulkAction</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>action</code></td><td><code>string</code></td></tr><tr><td><code>noteIds</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"action\": \"string\",\n \"noteIds\": [\n \"string\"\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Bulk action results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get affected notes count</h3><p><code>POST /api/bulk-action/affected-notes</code> · <code>getAffectedNotesCount</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>action</code></td><td><code>string</code></td></tr><tr><td><code>noteIds</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"action\": \"string\",\n \"noteIds\": [\n \"string\"\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Affected notes count</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>count</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"count\": 0\n}</code></pre></div></div></div></section></div><h3>Preview note deletion</h3><p><code>POST /api/delete-notes-preview</code> · <code>previewNoteDeletion</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>branchIdsToDelete</code></td><td><code>array of string</code></td></tr><tr><td><code>deleteAllClones</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchIdsToDelete\": [\n \"string\"\n ],\n \"deleteAllClones\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Deletion preview</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>notesToDelete</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"notesToDelete\": [\n \"string\"\n ]\n}</code></pre></div></div></div></section></div><h3>Erase deleted notes</h3><p><code>POST /api/notes/erase-deleted-notes-now</code> · <code>eraseDeletedNotes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Deleted notes erased</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h2><span class=\"tn-icon bx bx-sitemap\"></span> Tree</h2><p>Note tree structure and branches</p><h3>Get tree structure</h3><p><code>GET /api/tree</code> · <code>getTree</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>subTreeNoteId</code></td><td><code>string</code> <br>Limit tree to this note and descendants</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Tree structure</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>notes</code></td><td>array of <a href=\"#schema-Note\"><code>Note</code></a></td></tr><tr><td><code>branches</code></td><td>array of <a href=\"#schema-Branch\"><code>Branch</code></a></td></tr><tr><td><code>attributes</code></td><td>array of <a href=\"#schema-Attribute\"><code>Attribute</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"notes\": [\n {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n ],\n \"branches\": [\n {\n \"branchId\": \"string\",\n \"noteId\": \"string\",\n \"parentNoteId\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true\n }\n ],\n \"attributes\": [\n {\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n }\n ]\n}</code></pre></div></div></div></section></div><h3>Load specific notes</h3><p><code>POST /api/tree/load</code> · <code>loadNotes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteIds</code> <br><em>required</em></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteIds\": [\n \"string\"\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Loaded notes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>notes</code></td><td>array of <a href=\"#schema-Note\"><code>Note</code></a></td></tr><tr><td><code>branches</code></td><td>array of <a href=\"#schema-Branch\"><code>Branch</code></a></td></tr><tr><td><code>attributes</code></td><td>array of <a href=\"#schema-Attribute\"><code>Attribute</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"notes\": [\n {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n ],\n \"branches\": [\n {\n \"branchId\": \"string\",\n \"noteId\": \"string\",\n \"parentNoteId\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true\n }\n ],\n \"attributes\": [\n {\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n }\n ]\n}</code></pre></div></div></div></section></div><h3>Delete branch</h3><p><code>DELETE /api/branches/{branchId}</code> · <code>deleteBranch</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>taskId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>eraseNotes</code></td><td><code>boolean</code></td></tr><tr><td><code>last</code> <br><em>required</em></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Branch deleted</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteDeleted</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteDeleted\": true\n}</code></pre></div></div></div></section></div><h3>Move branch to new parent</h3><p><code>PUT /api/branches/{branchId}/move-to/{parentBranchId}</code> · <code>moveBranchToParent</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>parentBranchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Branch moved</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Move branch before another</h3><p><code>PUT /api/branches/{branchId}/move-before/{beforeBranchId}</code> · <code>moveBranchBefore</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>beforeBranchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Branch moved</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Move branch after another</h3><p><code>PUT /api/branches/{branchId}/move-after/{afterBranchId}</code> · <code>moveBranchAfter</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>afterBranchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Branch moved</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Set branch expanded state</h3><p><code>PUT /api/branches/{branchId}/expanded/{expanded}</code> · <code>setBranchExpanded</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>expanded</code> <br><em>required</em></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Expanded state updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Set subtree expanded state</h3><p><code>PUT /api/branches/{branchId}/expanded-subtree/{expanded}</code> · <code>setSubtreeExpanded</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>expanded</code> <br><em>required</em></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Subtree expanded state updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Set branch prefix</h3><p><code>PUT /api/branches/{branchId}/set-prefix</code> · <code>setBranchPrefix</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>prefix</code></td><td><code>string | null</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"prefix\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Prefix updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Clone note to branch</h3><p><code>PUT /api/notes/{noteId}/clone-to-branch/{parentBranchId}</code> · <code>cloneToBranch</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>parentBranchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note cloned</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Branch\"><code>Branch</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code> <br>Branch ID (parentNoteId_noteId)</td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>notePosition</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>prefix</code></td><td><code>string | null</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"string\",\n \"noteId\": \"string\",\n \"parentNoteId\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true\n}</code></pre></div></div></div></section></div><h3>Clone note to parent note</h3><p><code>PUT /api/notes/{noteId}/clone-to-note/{parentNoteId}</code> · <code>cloneToNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note cloned</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Branch\"><code>Branch</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code> <br>Branch ID (parentNoteId_noteId)</td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>notePosition</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>prefix</code></td><td><code>string | null</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"string\",\n \"noteId\": \"string\",\n \"parentNoteId\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true\n}</code></pre></div></div></div></section></div><h3>Clone note after branch</h3><p><code>PUT /api/notes/{noteId}/clone-after/{afterBranchId}</code> · <code>cloneAfterBranch</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>afterBranchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note cloned</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Branch\"><code>Branch</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code> <br>Branch ID (parentNoteId_noteId)</td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>notePosition</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>prefix</code></td><td><code>string | null</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"string\",\n \"noteId\": \"string\",\n \"parentNoteId\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true\n}</code></pre></div></div></div></section></div><h3>Clone note before branch</h3><p><code>PUT /api/notes/{noteId}/clone-before/{beforeBranchId}</code> · <code>cloneBeforeBranch</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>beforeBranchId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note cloned</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Branch\"><code>Branch</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code> <br>Branch ID (parentNoteId_noteId)</td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>notePosition</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>prefix</code></td><td><code>string | null</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"string\",\n \"noteId\": \"string\",\n \"parentNoteId\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true\n}</code></pre></div></div></div></section></div><h3>Toggle note presence in parent</h3><p><code>PUT /api/notes/{noteId}/toggle-in-parent/{parentNoteId}/{present}</code> · <code>toggleInParent</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>present</code> <br><em>required</em></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Presence toggled</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h2><span class=\"tn-icon bx bx-purchase-tag\"></span> Attributes</h2><p>Note attributes and metadata</p><h3>Get effective note attributes</h3><p><code>GET /api/notes/{noteId}/attributes</code> · <code>getNoteAttributes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note attributes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-Attribute\"><code>Attribute</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n }\n]</code></pre></div></section></div><h3>Update all note attributes</h3><p><code>PUT /api/notes/{noteId}/attributes</code> · <code>updateNoteAttributes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: array of <a href=\"#schema-Attribute\"><code>Attribute</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n }\n]</code></pre><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attributes updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Add note attribute</h3><p><code>POST /api/notes/{noteId}/attributes</code> · <code>addNoteAttribute</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-Attribute\"><code>Attribute</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Attribute added</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Attribute\"><code>Attribute</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n}</code></pre></div></div></div></section></div><h3>Delete attribute</h3><p><code>DELETE /api/notes/{noteId}/attributes/{attributeId}</code> · <code>deleteAttribute</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>attributeId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attribute deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Update single attribute</h3><p><code>PUT /api/notes/{noteId}/attribute</code> · <code>updateAttribute</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-Attribute\"><code>Attribute</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attribute updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Set attribute value</h3><p><code>PUT /api/notes/{noteId}/set-attribute</code> · <code>setAttribute</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attribute set</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Create relation</h3><p><code>PUT /api/notes/{noteId}/relations/{name}/to/{targetNoteId}</code> · <code>createRelation</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>targetNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Relation created</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Delete relation</h3><p><code>DELETE /api/notes/{noteId}/relations/{name}/to/{targetNoteId}</code> · <code>deleteRelation</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>targetNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Relation deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get attribute name suggestions</h3><p><code>GET /api/attribute-names</code> · <code>getAttributeNames</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>query</code></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attribute names</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of string</code></li></ul><pre><code class=\"language-application-json\">[\n \"string\"\n]</code></pre></div></section></div><h3>Get values for attribute</h3><p><code>GET /api/attribute-values/{attributeName}</code> · <code>getAttributeValues</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeName</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attribute values</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of string</code></li></ul><pre><code class=\"language-application-json\">[\n \"string\"\n]</code></pre></div></section></div><h2><span class=\"tn-icon bx bx-paperclip\"></span> Attachments</h2><p>File attachments</p><h3>Stream file with partial content support</h3><p><code>GET /api/attachments/{attachmentId}/open-partial</code> · <code>openPartialFileAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Header parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Range</code></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">206: Partial content</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Range</code></td><td><code>string</code> <br>Example: <code>bytes 0-1023/146515</code></td></tr></tbody></table></figure><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Get note attachments</h3><p><code>GET /api/notes/{noteId}/attachments</code> · <code>getNoteAttachments</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note attachments</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n]</code></pre></div></section></div><h3>Save attachment</h3><p><code>POST /api/notes/{noteId}/attachments</code> · <code>saveAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>matchBy</code></td><td><code>string</code> <br>One of <code>attachmentId</code>, <code>title</code>.</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>ownerId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>role</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>image</code>, <code>file</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Attachment saved</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>ownerId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>role</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>image</code>, <code>file</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Upload attachment file</h3><p><code>POST /api/notes/{noteId}/attachments/upload</code> · <code>uploadAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>link</code></td><td><code>boolean</code> <br><code>true</code> answers with a link to the attachment instead of an image URL, and stores a picture as uploaded, without compressing it or shortening its name.</td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Attachment uploaded</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>ownerId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>role</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>image</code>, <code>file</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get attachment metadata</h3><p><code>GET /api/attachments/{attachmentId}</code> · <code>getAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment metadata</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>ownerId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>role</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>image</code>, <code>file</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"string\",\n \"ownerId\": \"string\",\n \"role\": \"image\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Delete attachment</h3><p><code>DELETE /api/attachments/{attachmentId}</code> · <code>deleteAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attachment deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get attachment content</h3><p><code>GET /api/attachments/{attachmentId}/blob</code> · <code>getAttachmentBlob</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>preview</code></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment content</p><div class=\"trilium-tab-panel\"><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Rename attachment</h3><p><code>PUT /api/attachments/{attachmentId}/rename</code> · <code>renameAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attachment renamed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Convert attachment to note</h3><p><code>POST /api/attachments/{attachmentId}/convert-to-note</code> · <code>convertAttachmentToNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment converted to note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Update attachment file</h3><p><code>PUT /api/attachments/{attachmentId}/file</code> · <code>updateAttachmentFile</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Attachment file updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Open attachment</h3><p><code>GET /api/attachments/{attachmentId}/open</code> · <code>openAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment content</p><div class=\"trilium-tab-panel\"><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Download attachment</h3><p><code>GET /api/attachments/download/{attachmentId}</code> · <code>downloadAttachment</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment content</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Disposition</code></td><td><code>string</code> <br>Example: <code>attachment; filename=\"document.pdf\"</code></td></tr></tbody></table></figure><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Download attachment (alternative path)</h3><p><code>GET /api/attachments/{attachmentId}/download</code> · <code>downloadAttachmentAlt</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment content</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Disposition</code></td><td><code>string</code> <br>Example: <code>attachment; filename=\"document.pdf\"</code></td></tr></tbody></table></figure><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Get all attachment information</h3><p><code>GET /api/attachments/{attachmentId}/all</code> · <code>getAllAttachmentInfo</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment information</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>isProtected</code></td><td><code>boolean</code></td></tr><tr><td><code>position</code></td><td><code>integer</code></td></tr><tr><td><code>contentLength</code></td><td><code>integer</code></td></tr><tr><td><code>ownerId</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"string\",\n \"title\": \"string\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"position\": 0,\n \"contentLength\": 0,\n \"ownerId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Save attachment to temporary directory</h3><p><code>POST /api/attachments/{attachmentId}/save-to-tmp-dir</code> · <code>saveAttachmentToTmpDir</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Attachment saved</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>tmpPath</code></td><td><code>string</code> <br>Path to temporary file</td></tr><tr><td><code>success</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"tmpPath\": \"string\",\n \"success\": true\n}</code></pre></div></div></div></section></div><h3>Upload modified attachment file</h3><p><code>POST /api/attachments/{attachmentId}/upload-modified-file</code> · <code>uploadModifiedAttachmentFile</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Modified file uploaded</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true\n}</code></pre></div></div></div></section></div><h3>Get attached image</h3><p><code>GET /api/attachments/{attachmentId}/image/{filename}</code> · <code>getAttachmentImage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>filename</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Image content</p><div class=\"trilium-tab-panel\"><ul><li><code>image/*</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Erase unused attachments</h3><p><code>POST /api/notes/erase-unused-attachments-now</code> · <code>eraseUnusedAttachments</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Unused attachments erased</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h2><span class=\"tn-icon bx bx-history\"></span> Revisions</h2><p>Note revision history</p><h3>Get note revisions</h3><p><code>GET /api/notes/{noteId}/revisions</code> · <code>getNoteRevisions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note revisions</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-Revision\"><code>Revision</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"revisionId\": \"string\",\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\"\n }\n]</code></pre></div></section></div><h3>Erase all note revisions</h3><p><code>DELETE /api/notes/{noteId}/revisions</code> · <code>eraseNoteRevisions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Revisions erased</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get revision details</h3><p><code>GET /api/revisions/{revisionId}</code> · <code>getRevision</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Revision details</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Revision\"><code>Revision</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code></td><td><code>string</code></td></tr><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>type</code></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"revisionId\": \"string\",\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Erase revision</h3><p><code>DELETE /api/revisions/{revisionId}</code> · <code>eraseRevision</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Revision erased</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get revision content</h3><p><code>GET /api/revisions/{revisionId}/blob</code> · <code>getRevisionBlob</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>preview</code></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Revision content</p><div class=\"trilium-tab-panel\"><ul><li><code>text/html</code>: <code>string</code></li><li><code>text/plain</code>: <code>string</code></li><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Restore revision</h3><p><code>POST /api/revisions/{revisionId}/restore</code> · <code>restoreRevision</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Revision restored</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Download revision</h3><p><code>GET /api/revisions/{revisionId}/download</code> · <code>downloadRevision</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Revision content</p><div class=\"trilium-tab-panel\"><p><strong>Response headers</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Disposition</code></td><td><code>string</code></td></tr></tbody></table></figure><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Cleanup old revisions</h3><p><code>POST /api/revisions/erase-all-excess-revisions</code> · <code>eraseExcessRevisions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong></p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>snapshotsToKeep</code></td><td><code>integer</code> <br>Snapshots to keep per note, standing in for the revisionSnapshotNumberLimit option. -1 keeps every snapshot, 0 keeps none. Omitted, the option applies. A note carrying a valid #versioningLimit follows its own label instead.</td></tr><tr><td><code>keepNamedSnapshots</code></td><td><code>boolean</code> <br>Spare named snapshots (those with a description) from erasure and leave them out of the count, so the limit governs the automatic snapshots alone.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"snapshotsToKeep\": 0,\n \"keepNamedSnapshots\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Excess revisions erased</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>erasedCount</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"erasedCount\": 0\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">400: Invalid options</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get notes edited on date</h3><p><code>GET /api/edited-notes/{date}</code> · <code>getEditedNotes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>date</code> <br><em>required</em></td><td><code>string (date)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Edited notes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-Note\"><code>Note</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n]</code></pre></div></section></div><h3>Get image from revision</h3><p><code>GET /api/revisions/{revisionId}/image/{filename}</code> · <code>getRevisionImage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>filename</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Image content</p><div class=\"trilium-tab-panel\"><ul><li><code>image/*</code>: <code>string (binary)</code></li></ul></div></section></div><h2><span class=\"tn-icon bx bx-search\"></span> Search</h2><p>Search and discovery</p><h3>Full text search</h3><p><code>GET /api/search</code> · <code>search</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>searchString</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Search results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-SearchResult\"><code>SearchResult</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"path\": \"string\",\n \"score\": 0,\n \"highlights\": [\n \"string\"\n ]\n }\n]</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">400: Missing or empty search string</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Quick search with highlighting</h3><p><code>GET /api/quick-search</code> · <code>quickSearch</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>searchString</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Quick search results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-SearchResult\"><code>SearchResult</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"path\": \"string\",\n \"score\": 0,\n \"highlights\": [\n \"string\"\n ]\n }\n]</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">400: Missing or empty search string</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Execute search note</h3><p><code>GET /api/search-note/{noteId}</code> · <code>executeSearchNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Search results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-SearchResult\"><code>SearchResult</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"path\": \"string\",\n \"score\": 0,\n \"highlights\": [\n \"string\"\n ]\n }\n]</code></pre></div></section></div><h3>Search and execute actions</h3><p><code>POST /api/search-and-execute-note/{noteId}</code> · <code>searchAndExecute</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Execution results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Find related notes by attributes</h3><p><code>POST /api/search-related</code> · <code>searchRelated</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-Attribute\"><code>Attribute</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"string\",\n \"noteId\": \"string\",\n \"type\": \"label\",\n \"name\": \"string\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Related notes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>count</code> <br><em>required</em></td><td><code>integer</code> <br>Distinct notes matching, counted before the twenty-result cap.</td></tr><tr><td><code>results</code> <br><em>required</em></td><td><code>array of object</code> <br>At most twenty, name-and-value matches ahead of name-only ones.</td></tr><tr><td><code>results[].notePathArray</code> <br><em>required</em></td><td><code>array of string</code> <br>Note IDs from the root down to the matched note.</td></tr><tr><td><code>results[].score</code> <br><em>required</em></td><td><code>number</code> <br>Search relevance, higher is better.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"count\": 0,\n \"results\": [\n {\n \"notePathArray\": [\n \"string\"\n ],\n \"score\": 0\n }\n ]\n}</code></pre></div></div></div></section></div><h3>Search template notes</h3><p><code>GET /api/search-templates</code> · <code>searchTemplates</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Template notes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-Note\"><code>Note</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n]</code></pre></div></section></div><h3>Get autocomplete suggestions</h3><p><code>GET /api/autocomplete</code> · <code>autocomplete</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>query</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>fastSearch</code></td><td><code>boolean</code></td></tr><tr><td><code>activeNoteId</code></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Autocomplete suggestions</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"path\": \"string\"\n }\n]</code></pre></div></section></div><h3>Find similar notes</h3><p><code>GET /api/similar-notes/{noteId}</code> · <code>findSimilarNotes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Similar notes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"similarity\": 0\n }\n]</code></pre></div></section></div><h2><span class=\"tn-icon bx bx-transfer\"></span> Import/Export</h2><p>Import and export operations</p><h3>Export branch</h3><p><code>GET /api/branches/{branchId}/export/{type}/{format}/{taskId}</code> · <code>exportBranch</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>subtree</code>, <code>single</code>.</td></tr><tr><td><code>format</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>html</code>, <code>markdown</code>, <code>opml</code>.</td></tr><tr><td><code>taskId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Exported content</p><div class=\"trilium-tab-panel\"><ul><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Import notes</h3><p><code>POST /api/notes/{parentNoteId}/notes-import</code> · <code>importNotes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr><tr><td><code>safeImport</code></td><td><code>boolean</code></td></tr><tr><td><code>shrinkImages</code></td><td><code>boolean</code></td></tr><tr><td><code>textImportedAsText</code></td><td><code>boolean</code></td></tr><tr><td><code>codeImportedAsCode</code></td><td><code>boolean</code></td></tr><tr><td><code>explodeArchives</code></td><td><code>boolean</code></td></tr><tr><td><code>replaceUnderscoresWithSpaces</code></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Import results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>note</code></td><td><a href=\"#schema-Note\"><code>Note</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"string\",\n \"note\": {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n}</code></pre></div></div></div></section></div><h3>Import attachments</h3><p><code>POST /api/notes/{parentNoteId}/attachments-import</code> · <code>importAttachments</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>array of string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Import results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h2><span class=\"tn-icon bx bx-sync\"></span> Sync</h2><p>Synchronization between instances</p><h3>Test sync connection</h3><p><code>POST /api/sync/test</code> · <code>testSync</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync test results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Trigger sync now</h3><p><code>POST /api/sync/now</code> · <code>syncNow</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync started</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get sync status</h3><p><code>GET /api/sync/check</code> · <code>checkSync</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync status</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>synced</code></td><td><code>boolean</code></td></tr><tr><td><code>lastSyncedPush</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>lastSyncedPull</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"synced\": true,\n \"lastSyncedPush\": \"2019-08-24T14:15:22Z\",\n \"lastSyncedPull\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get sync changes</h3><p><code>GET /api/sync/changed</code> · <code>getSyncChanges</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>instanceId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>lastEntityChangeId</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>logMarkerId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync changes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>entityChanges</code></td><td>array of <a href=\"#schema-EntityChange\"><code>EntityChange</code></a></td></tr><tr><td><code>lastEntityChangeId</code></td><td><code>integer</code></td></tr><tr><td><code>outstandingPullCount</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"entityChanges\": [\n {\n \"entityChange\": {\n \"entityName\": \"string\",\n \"changeId\": \"string\"\n },\n \"entity\": {}\n }\n ],\n \"lastEntityChangeId\": 0,\n \"outstandingPullCount\": 0\n}</code></pre></div></div></div></section></div><h3>Push sync changes</h3><p><code>PUT /api/sync/update</code> · <code>pushSyncChanges</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>logMarkerId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Header parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>pageCount</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>pageIndex</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>requestId</code></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>instanceId</code></td><td><code>string</code></td></tr><tr><td><code>entities</code></td><td>array of <a href=\"#schema-EntityChange\"><code>EntityChange</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"instanceId\": \"string\",\n \"entities\": [\n {\n \"entityChange\": {\n \"entityName\": \"string\",\n \"changeId\": \"string\"\n },\n \"entity\": {}\n }\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Changes processed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Mark sync as finished</h3><p><code>POST /api/sync/finished</code> · <code>finishSync</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Sync finished</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get sync statistics</h3><p><code>GET /api/sync/stats</code> · <code>getSyncStats</code></p><p><strong>Authorization</strong>: none</p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync statistics</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>initialized</code></td><td><code>boolean</code></td></tr><tr><td><code>stats</code></td><td><code>object</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"initialized\": true,\n \"stats\": {}\n}</code></pre></div></div></div></section></div><h3>Fill entity changes</h3><p><code>POST /api/sync/fill-entity-changes</code> · <code>fillEntityChanges</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Entity changes filled</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Force full sync</h3><p><code>POST /api/sync/force-full-sync</code> · <code>forceFullSync</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Full sync forced</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Check entity changes consistency</h3><p><code>POST /api/sync/check-entity-changes</code> · <code>checkEntityChanges</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Consistency check results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Queue sector for sync</h3><p><code>POST /api/sync/queue-sector/{entityName}/{sector}</code> · <code>queueSyncSector</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>entityName</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>sector</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Sector queued</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h2><span class=\"tn-icon bx bx-code-alt\"></span> Scripting</h2><p>Script execution and automation</p><h3>Execute script</h3><p><code>POST /api/script/exec</code> · <code>executeScript</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>script</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>params</code></td><td><code>array of string</code></td></tr><tr><td><code>startNoteId</code></td><td><code>string</code></td></tr><tr><td><code>currentNoteId</code></td><td><code>string</code></td></tr><tr><td><code>originEntityName</code></td><td><code>string</code></td></tr><tr><td><code>originEntityId</code></td><td><code>string</code></td></tr><tr><td><code>transactional</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"script\": \"string\",\n \"params\": [\n \"string\"\n ],\n \"startNoteId\": \"string\",\n \"currentNoteId\": \"string\",\n \"originEntityName\": \"string\",\n \"originEntityId\": \"string\",\n \"transactional\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Script execution results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre></div></section></div><h3>Run script note</h3><p><code>POST /api/script/run/{noteId}</code> · <code>runScriptNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Script execution results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get startup script bundles</h3><p><code>GET /api/script/startup</code> · <code>getStartupScripts</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>mobile</code></td><td><code>boolean</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Startup scripts</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-ScriptBundle\"><code>ScriptBundle</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"script\": \"string\",\n \"html\": \"string\",\n \"css\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get widget script bundles</h3><p><code>GET /api/script/widgets</code> · <code>getWidgetScripts</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Widget scripts</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-ScriptBundle\"><code>ScriptBundle</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"script\": \"string\",\n \"html\": \"string\",\n \"css\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get script bundle for note</h3><p><code>POST /api/script/bundle/{noteId}</code> · <code>getScriptBundle</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Script bundle</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-ScriptBundle\"><code>ScriptBundle</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>script</code></td><td><code>string</code></td></tr><tr><td><code>html</code></td><td><code>string</code></td></tr><tr><td><code>css</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"string\",\n \"script\": \"string\",\n \"html\": \"string\",\n \"css\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Get relation script bundles</h3><p><code>GET /api/script/relation/{noteId}/{relationName}</code> · <code>getRelationScripts</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>relationName</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Relation scripts</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-ScriptBundle\"><code>ScriptBundle</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"script\": \"string\",\n \"html\": \"string\",\n \"css\": \"string\"\n }\n]</code></pre></div></section></div><h2><span class=\"tn-icon bx bx-cog\"></span> Configuration</h2><p>System options and settings</p><h3>Get application information</h3><p><code>GET /api/app-info</code> · <code>getAppInfo</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Application information</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-AppInfo\"><code>AppInfo</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>appVersion</code></td><td><code>string</code></td></tr><tr><td><code>dbVersion</code></td><td><code>integer</code></td></tr><tr><td><code>nodeVersion</code></td><td><code>string</code></td></tr><tr><td><code>syncVersion</code></td><td><code>integer</code></td></tr><tr><td><code>buildDate</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>buildRevision</code></td><td><code>string</code></td></tr><tr><td><code>dataDirectory</code></td><td><code>string</code></td></tr><tr><td><code>clipperProtocolVersion</code></td><td><code>string</code></td></tr><tr><td><code>utcDateTime</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"appVersion\": \"0.91.6\",\n \"dbVersion\": 228,\n \"nodeVersion\": \"string\",\n \"syncVersion\": 34,\n \"buildDate\": \"2019-08-24T14:15:22Z\",\n \"buildRevision\": \"string\",\n \"dataDirectory\": \"string\",\n \"clipperProtocolVersion\": \"string\",\n \"utcDateTime\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get setup status</h3><p><code>GET /api/setup/status</code> · <code>getSetupStatus</code></p><p><strong>Authorization</strong>: none</p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Setup status</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>isInitialized</code></td><td><code>boolean</code></td></tr><tr><td><code>schemaExists</code></td><td><code>boolean</code></td></tr><tr><td><code>syncVersion</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"isInitialized\": true,\n \"schemaExists\": true,\n \"syncVersion\": 0\n}</code></pre></div></div></div></section></div><h3>Initialize new document</h3><p><code>POST /api/setup/new-document</code> · <code>initNewDocument</code></p><p><strong>Authorization</strong>: none</p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>password</code> <br><em>required</em></td><td><code>string (password)</code></td></tr><tr><td><code>theme</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"password\": \"string\",\n \"theme\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Document initialized</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Setup sync from server</h3><p><code>POST /api/setup/sync-from-server</code> · <code>setupSyncFromServer</code></p><p><strong>Authorization</strong>: none</p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>syncServerHost</code> <br><em>required</em></td><td><code>string (uri)</code></td></tr><tr><td><code>syncProxy</code></td><td><code>string</code></td></tr><tr><td><code>password</code> <br><em>required</em></td><td><code>string (password)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"syncServerHost\": \"string\",\n \"syncProxy\": \"string\",\n \"password\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync setup successful</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get sync seed for setup</h3><p><code>GET /api/setup/sync-seed</code> · <code>getSyncSeed</code></p><p><strong>Authorization</strong>: none</p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Sync seed information</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>syncVersion</code></td><td><code>integer</code></td></tr><tr><td><code>schemaVersion</code></td><td><code>integer</code></td></tr><tr><td><code>documentSecret</code></td><td><code>string</code></td></tr><tr><td><code>maxSyncId</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"syncVersion\": 0,\n \"schemaVersion\": 0,\n \"documentSecret\": \"string\",\n \"maxSyncId\": 0\n}</code></pre></div></div></div></section></div><h3>Get system options</h3><p><code>GET /api/options</code> · <code>getOptions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: System options</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre></div></section></div><h3>Update multiple options</h3><p><code>PUT /api/options</code> · <code>updateOptions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Options updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Update single option</h3><p><code>PUT /api/options/{name}/{value}</code> · <code>updateOption</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Option updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get user-defined themes</h3><p><code>GET /api/options/user-themes</code> · <code>getUserThemes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: User themes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"name\": \"string\",\n \"label\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get supported locales</h3><p><code>GET /api/options/locales</code> · <code>getLocales</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Supported locales</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"code\": \"string\",\n \"name\": \"string\"\n }\n]</code></pre></div></section></div><h2><span class=\"tn-icon bx bx-data\"></span> Database</h2><p>Database operations</p><h3>Get database schema</h3><p><code>GET /api/sql/schema</code> · <code>getDatabaseSchema</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Database schema</p><div class=\"trilium-tab-panel\"><ul><li><code>text/plain</code>: <code>string</code></li></ul></div></section></div><h3>Execute SQL from note</h3><p><code>POST /api/sql/execute/{noteId}</code> · <code>executeSql</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: SQL execution results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {}\n]</code></pre></div></section></div><h3>Create database backup</h3><p><code>POST /api/database/backup-database</code> · <code>backupDatabase</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Backup created</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>List existing backups</h3><p><code>GET /api/database/backups</code> · <code>listBackups</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Backup list</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>backupFolderPath</code></td><td><code>string | null</code> <br>Directory where the backups are stored, or null if there is no user-accessible location.</td></tr><tr><td><code>backups</code></td><td><code>array of object</code></td></tr><tr><td><code>backups[].fileName</code></td><td><code>string</code></td></tr><tr><td><code>backups[].filePath</code></td><td><code>string</code></td></tr><tr><td><code>backups[].mtime</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>backups[].fileSize</code></td><td><code>integer</code> <br>Size of the backup file, in bytes.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"backupFolderPath\": \"string\",\n \"backups\": [\n {\n \"fileName\": \"string\",\n \"filePath\": \"string\",\n \"mtime\": \"2019-08-24T14:15:22Z\",\n \"fileSize\": 0\n }\n ]\n}</code></pre></div></div></div></section></div><h3>Vacuum database</h3><p><code>POST /api/database/vacuum-database</code> · <code>vacuumDatabase</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Database vacuumed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Anonymize database</h3><p><code>POST /api/database/anonymize/{type}</code> · <code>anonymizeDatabase</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>save-as-file</code>, <code>save-and-send</code>.</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Anonymization results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>List anonymized databases</h3><p><code>GET /api/database/anonymized-databases</code> · <code>listAnonymizedDatabases</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Anonymized database list</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>anonymizedFolderPath</code></td><td><code>string</code> <br>Directory where the anonymized databases are stored.</td></tr><tr><td><code>databases</code></td><td><code>array of object</code></td></tr><tr><td><code>databases[].fileName</code></td><td><code>string</code></td></tr><tr><td><code>databases[].filePath</code></td><td><code>string</code></td></tr><tr><td><code>databases[].mtime</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>databases[].fileSize</code></td><td><code>integer</code> <br>Size of the anonymized database file, in bytes.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"anonymizedFolderPath\": \"string\",\n \"databases\": [\n {\n \"fileName\": \"string\",\n \"filePath\": \"string\",\n \"mtime\": \"2019-08-24T14:15:22Z\",\n \"fileSize\": 0\n }\n ]\n}</code></pre></div></div></div></section></div><h3>Download an anonymized database file</h3><p><code>GET /api/database/anonymized/download</code> · <code>downloadAnonymizedDatabase</code></p><p>Only files inside the anonymized database directory can be downloaded; any other path is refused with 403.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>filePath</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Anonymized database file</p><div class=\"trilium-tab-panel\"><ul><li><code>application/x-sqlite3</code>: <code>string (binary)</code></li></ul></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">400: Missing filePath</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">403: Path not allowed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">404: File not found</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Fix consistency issues</h3><p><code>POST /api/database/find-and-fix-consistency-issues</code> · <code>fixConsistencyIssues</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Consistency check results</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Check database integrity</h3><p><code>GET /api/database/check-integrity</code> · <code>checkIntegrity</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Integrity check results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>results</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"results\": [\n \"string\"\n ]\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-bot\"></span> LLM</h2><p>AI/LLM integration</p><h3>List all chat sessions</h3><p><code>GET /api/llm/chat</code> · <code>listChatSessions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Chat sessions</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-ChatSession\"><code>ChatSession</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"sessionId\": \"string\",\n \"title\": \"string\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"string\",\n \"timestamp\": \"2019-08-24T14:15:22Z\"\n }\n ],\n \"createdAt\": \"2019-08-24T14:15:22Z\",\n \"lastActive\": \"2019-08-24T14:15:22Z\",\n \"messageCount\": 0\n }\n]</code></pre></div></section></div><h3>Create new chat session</h3><p><code>POST /api/llm/chat</code> · <code>createChatSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>systemPrompt</code></td><td><code>string</code></td></tr><tr><td><code>temperature</code></td><td><code>number</code></td></tr><tr><td><code>maxTokens</code></td><td><code>integer</code></td></tr><tr><td><code>model</code></td><td><code>string</code></td></tr><tr><td><code>provider</code></td><td><code>string</code> <br>One of <code>openai</code>, <code>anthropic</code>, <code>ollama</code>.</td></tr><tr><td><code>contextNoteId</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"systemPrompt\": \"string\",\n \"temperature\": 0,\n \"maxTokens\": 0,\n \"model\": \"string\",\n \"provider\": \"openai\",\n \"contextNoteId\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Chat session created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-ChatSession\"><code>ChatSession</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>messages</code></td><td><code>array of object</code></td></tr><tr><td><code>messages[].role</code></td><td><code>string</code> <br>One of <code>user</code>, <code>assistant</code>, <code>system</code>.</td></tr><tr><td><code>messages[].content</code></td><td><code>string</code></td></tr><tr><td><code>messages[].timestamp</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>createdAt</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>lastActive</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>messageCount</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"sessionId\": \"string\",\n \"title\": \"string\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"string\",\n \"timestamp\": \"2019-08-24T14:15:22Z\"\n }\n ],\n \"createdAt\": \"2019-08-24T14:15:22Z\",\n \"lastActive\": \"2019-08-24T14:15:22Z\",\n \"messageCount\": 0\n}</code></pre></div></div></div></section></div><h3>Get specific chat session</h3><p><code>GET /api/llm/chat/{sessionId}</code> · <code>getChatSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Chat session details</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-ChatSession\"><code>ChatSession</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>messages</code></td><td><code>array of object</code></td></tr><tr><td><code>messages[].role</code></td><td><code>string</code> <br>One of <code>user</code>, <code>assistant</code>, <code>system</code>.</td></tr><tr><td><code>messages[].content</code></td><td><code>string</code></td></tr><tr><td><code>messages[].timestamp</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>createdAt</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>lastActive</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>messageCount</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"sessionId\": \"string\",\n \"title\": \"string\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"string\",\n \"timestamp\": \"2019-08-24T14:15:22Z\"\n }\n ],\n \"createdAt\": \"2019-08-24T14:15:22Z\",\n \"lastActive\": \"2019-08-24T14:15:22Z\",\n \"messageCount\": 0\n}</code></pre></div></div></div></section></div><h3>Update chat session</h3><p><code>PATCH /api/llm/chat/{sessionId}</code> · <code>updateChatSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>systemPrompt</code></td><td><code>string</code></td></tr><tr><td><code>temperature</code></td><td><code>number</code></td></tr><tr><td><code>maxTokens</code></td><td><code>integer</code></td></tr><tr><td><code>model</code></td><td><code>string</code></td></tr><tr><td><code>provider</code></td><td><code>string</code></td></tr><tr><td><code>contextNoteId</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"systemPrompt\": \"string\",\n \"temperature\": 0,\n \"maxTokens\": 0,\n \"model\": \"string\",\n \"provider\": \"string\",\n \"contextNoteId\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Session updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-ChatSession\"><code>ChatSession</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>messages</code></td><td><code>array of object</code></td></tr><tr><td><code>messages[].role</code></td><td><code>string</code> <br>One of <code>user</code>, <code>assistant</code>, <code>system</code>.</td></tr><tr><td><code>messages[].content</code></td><td><code>string</code></td></tr><tr><td><code>messages[].timestamp</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>createdAt</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>lastActive</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>messageCount</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"sessionId\": \"string\",\n \"title\": \"string\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"string\",\n \"timestamp\": \"2019-08-24T14:15:22Z\"\n }\n ],\n \"createdAt\": \"2019-08-24T14:15:22Z\",\n \"lastActive\": \"2019-08-24T14:15:22Z\",\n \"messageCount\": 0\n}</code></pre></div></div></div></section></div><h3>Delete chat session</h3><p><code>DELETE /api/llm/chat/{chatNoteId}</code> · <code>deleteChatSession</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>chatNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Session deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Send message to LLM</h3><p><code>POST /api/llm/chat/{chatNoteId}/messages</code> · <code>sendChatMessage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>options</code></td><td><code>object</code></td></tr><tr><td><code>options.temperature</code></td><td><code>number</code></td></tr><tr><td><code>options.maxTokens</code></td><td><code>integer</code></td></tr><tr><td><code>options.model</code></td><td><code>string</code></td></tr><tr><td><code>options.provider</code></td><td><code>string</code></td></tr><tr><td><code>includeContext</code></td><td><code>boolean</code></td></tr><tr><td><code>useNoteContext</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"message\": \"string\",\n \"options\": {\n \"temperature\": 0,\n \"maxTokens\": 0,\n \"model\": \"string\",\n \"provider\": \"string\"\n },\n \"includeContext\": true,\n \"useNoteContext\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: LLM response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>response</code></td><td><code>string</code></td></tr><tr><td><code>sources</code></td><td><code>array of object</code></td></tr><tr><td><code>sources[].noteId</code></td><td><code>string</code></td></tr><tr><td><code>sources[].title</code></td><td><code>string</code></td></tr><tr><td><code>sources[].similarity</code></td><td><code>number</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"response\": \"string\",\n \"sources\": [\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"similarity\": 0\n }\n ]\n}</code></pre></div></div></div></section></div><h3>Stream message to LLM</h3><p><code>POST /api/llm/chat/{chatNoteId}/messages/stream</code> · <code>streamChatMessage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>content</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>useAdvancedContext</code></td><td><code>boolean</code></td></tr><tr><td><code>showThinking</code></td><td><code>boolean</code></td></tr><tr><td><code>mentions</code></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"content\": \"string\",\n \"useAdvancedContext\": true,\n \"showThinking\": true,\n \"mentions\": [\n \"string\"\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Streaming started</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>List Ollama models</h3><p><code>GET /api/llm/providers/ollama/models</code> · <code>listOllamaModels</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>baseUrl</code></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Ollama models</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>models</code></td><td><code>array of object</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"models\": [\n {}\n ]\n}</code></pre></div></div></div></section></div><h3>List OpenAI models</h3><p><code>GET /api/llm/providers/openai/models</code> · <code>listOpenAIModels</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: OpenAI models</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>chatModels</code></td><td><code>array of object</code></td></tr><tr><td><code>chatModels[].id</code></td><td><code>string</code></td></tr><tr><td><code>chatModels[].name</code></td><td><code>string</code></td></tr><tr><td><code>chatModels[].type</code></td><td><code>string</code></td></tr><tr><td><code>embeddingModels</code></td><td><code>array of object</code></td></tr><tr><td><code>embeddingModels[].id</code></td><td><code>string</code></td></tr><tr><td><code>embeddingModels[].name</code></td><td><code>string</code></td></tr><tr><td><code>embeddingModels[].type</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"chatModels\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"type\": \"string\"\n }\n ],\n \"embeddingModels\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"type\": \"string\"\n }\n ]\n}</code></pre></div></div></div></section></div><h3>List Anthropic models</h3><p><code>GET /api/llm/providers/anthropic/models</code> · <code>listAnthropicModels</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Anthropic models</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>chatModels</code></td><td><code>array of object</code></td></tr><tr><td><code>chatModels[].id</code></td><td><code>string</code></td></tr><tr><td><code>chatModels[].name</code></td><td><code>string</code></td></tr><tr><td><code>chatModels[].type</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"chatModels\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"type\": \"string\"\n }\n ]\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-shield-quarter\"></span> Security</h2><p>Security features (2FA, tokens)</p><h3>Change password</h3><p><code>POST /api/password/change</code> · <code>changePassword</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>current_password</code></td><td><code>string (password)</code></td></tr><tr><td><code>new_password</code> <br><em>required</em></td><td><code>string (password)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"current_password\": \"string\",\n \"new_password\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Password changed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Reset password (destructive)</h3><p><code>POST /api/password/reset</code> · <code>resetPassword</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>really</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Password reset</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Generate a TOTP secret</h3><p><code>GET /api/totp/generate</code> · <code>generateTotpSecret</code></p><p>Generates a fresh TOTP secret without persisting it. The caller must verify a code for this secret (see <code>/api/totp/verify</code>) and commit it (see <code>/api/totp/enable</code>) before it becomes active.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: TOTP secret generated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>message</code></td><td><code>string</code> <br>The bare TOTP secret (for manual entry), or an error message on failure.</td></tr><tr><td><code>url</code></td><td><code>string</code> <br>The <code>otpauth://</code> URL the authenticator expects, rendered as a QR code by the client.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"message\": \"string\",\n \"url\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Verify a generated TOTP secret</h3><p><code>POST /api/totp/verify</code> · <code>verifyTotpSecret</code></p><p>Verifies a freshly generated secret against a code the user produced for it, without persisting anything. On success, issues (unpersisted) recovery codes to be shown as the next enrollment step.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>secret</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>token</code> <br><em>required</em></td><td><code>string</code> <br>A TOTP code the user generated for the supplied secret.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"secret\": \"string\",\n \"token\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Verification result</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>recoveryCodes</code></td><td><code>array of string</code> <br>One-time recovery codes, present only when verification succeeds.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"recoveryCodes\": [\n \"string\"\n ]\n}</code></pre></div></div></div></section></div><h3>Enable TOTP with a verified secret</h3><p><code>POST /api/totp/enable</code> · <code>enableTotp</code></p><p>Commits a verified secret together with its recovery codes, activating TOTP. This is the final enrollment step and the only point at which the secret and recovery codes are persisted.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>secret</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>recoveryCodes</code> <br><em>required</em></td><td><code>array of string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"secret\": \"string\",\n \"recoveryCodes\": [\n \"string\"\n ]\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Result of enabling TOTP</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true\n}</code></pre></div></div></div></section></div><h3>Get TOTP status</h3><p><code>GET /api/totp/status</code> · <code>getTotpStatus</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: TOTP status</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>message</code></td><td><code>boolean</code> <br>Whether TOTP is the active second factor and a secret is set.</td></tr><tr><td><code>set</code></td><td><code>boolean</code> <br>Whether a TOTP secret is currently stored.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"message\": true,\n \"set\": true\n}</code></pre></div></div></div></section></div><h3>Get the stored TOTP secret</h3><p><code>GET /api/totp/get</code> · <code>getTotpSecret</code></p><p>Returns <code>null</code> when no secret is set.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: TOTP secret</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>string | null</code></li></ul><pre><code class=\"language-application-json\">\"string\"</code></pre></div></section></div><h3>Reset (disable) TOTP</h3><p><code>POST /api/totp/reset</code> · <code>resetTotp</code></p><p>Clears the stored TOTP secret and its recovery codes, disabling TOTP.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Result of resetting TOTP</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true\n}</code></pre></div></div></div></section></div><h3>Check if TOTP recovery codes are set</h3><p><code>GET /api/totp_recovery/enabled</code> · <code>isTotpRecoveryEnabled</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: TOTP recovery status</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>keysExist</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"keysExist\": true\n}</code></pre></div></div></div></section></div><h3>Regenerate TOTP recovery codes</h3><p><code>POST /api/totp_recovery/regenerate</code> · <code>regenerateTotpRecoveryCodes</code></p><p>Issues a fresh batch of recovery codes for the already-enrolled TOTP secret, replacing any existing ones, and returns them for one-time display. Refuses when no TOTP secret is set.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Generated recovery codes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>recoveryCodes</code></td><td><code>array of string</code> <br>New recovery codes, present only when regeneration succeeds.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"recoveryCodes\": [\n \"string\"\n ]\n}</code></pre></div></div></div></section></div><h3>Get used TOTP recovery codes</h3><p><code>GET /api/totp_recovery/used</code> · <code>getUsedTotpRecoveryCodes</code></p><p>Returns an empty array if no recovery codes are set, otherwise an object listing each code's status.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Recovery code status</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of any | object</code></li></ul><pre><code class=\"language-application-json\">[\n null\n]</code></pre></div></section></div><h3>Verify a TOTP recovery code</h3><p><code>POST /api/totp_recovery/verify</code> · <code>verifyTotpRecoveryCode</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>recovery_code_guess</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"recovery_code_guess\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Verification result</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true\n}</code></pre></div></div></div></section></div><h3>List ETAPI tokens</h3><p><code>GET /api/etapi-tokens</code> · <code>listEtapiTokens</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: ETAPI tokens</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-EtapiToken\"><code>EtapiToken</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"etapiTokenId\": \"string\",\n \"name\": \"string\",\n \"token\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"isDeleted\": true\n }\n]</code></pre></div></section></div><h3>Create ETAPI token</h3><p><code>POST /api/etapi-tokens</code> · <code>createEtapiToken</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"name\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Token created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-EtapiToken\"><code>EtapiToken</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>etapiTokenId</code></td><td><code>string</code></td></tr><tr><td><code>name</code></td><td><code>string</code></td></tr><tr><td><code>token</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>isDeleted</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"etapiTokenId\": \"string\",\n \"name\": \"string\",\n \"token\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"isDeleted\": true\n}</code></pre></div></div></div></section></div><h3>Delete ETAPI token</h3><p><code>DELETE /api/etapi-tokens/{etapiTokenId}</code> · <code>deleteEtapiToken</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>etapiTokenId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Token deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Update ETAPI token</h3><p><code>PATCH /api/etapi-tokens/{etapiTokenId}</code> · <code>updateEtapiToken</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>etapiTokenId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"name\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Token updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-EtapiToken\"><code>EtapiToken</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>etapiTokenId</code></td><td><code>string</code></td></tr><tr><td><code>name</code></td><td><code>string</code></td></tr><tr><td><code>token</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>isDeleted</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"etapiTokenId\": \"string\",\n \"name\": \"string\",\n \"token\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"isDeleted\": true\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-star\"></span> Special Notes</h2><p>Special note types (calendar, inbox)</p><h3>Get/create inbox note</h3><p><code>GET /api/special-notes/inbox/{date}</code> · <code>getInboxNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>date</code> <br><em>required</em></td><td><code>string (date)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Inbox note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Resolve where an inbox capture would go</h3><p><code>GET /api/special-notes/inbox-target</code> · <code>getInboxTarget</code></p><p>Reports the destination <code>/api/special-notes/inbox/{date}</code> would use, without creating anything. Honours the hoisted note, read from the <code>trilium-hoisted-note-id</code> header.</p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: The resolved destination</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>kind</code> <br><em>required</em></td><td><code>string</code> <br>Which rule decided the destination. <code>dayNote</code> names no note, because the day note is created when the capture happens. One of <code>inbox</code>, <code>workspaceInbox</code>, <code>workspaceRoot</code>, <code>dayNote</code>, <code>root</code>.</td></tr><tr><td><code>noteId</code></td><td><code>string</code> <br>Absent for <code>dayNote</code>.</td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Absent for <code>dayNote</code>.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"kind\": \"inbox\",\n \"noteId\": \"string\",\n \"title\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Get/create day note</h3><p><code>GET /api/special-notes/days/{date}</code> · <code>getDayNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>date</code> <br><em>required</em></td><td><code>string (date)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Day note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get/create week note</h3><p><code>GET /api/special-notes/weeks/{week}</code> · <code>getWeekNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>week</code> <br><em>required</em></td><td><code>string</code> <br>Matches <code>^\\d{4}-\\d{2}$</code>.</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Week note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get/create month note</h3><p><code>GET /api/special-notes/months/{month}</code> · <code>getMonthNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>month</code> <br><em>required</em></td><td><code>string</code> <br>Matches <code>^\\d{4}-\\d{2}$</code>.</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Month note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get/create year note</h3><p><code>GET /api/special-notes/years/{year}</code> · <code>getYearNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>year</code> <br><em>required</em></td><td><code>string</code> <br>Matches <code>^\\d{4}$</code>.</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Year note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Create SQL console note</h3><p><code>POST /api/special-notes/sql-console</code> · <code>createSqlConsole</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: SQL console created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Create search note</h3><p><code>POST /api/special-notes/search-note</code> · <code>createSearchNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Search note created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Create launcher</h3><p><code>POST /api/special-notes/launchers/{parentNoteId}/{launcherType}</code> · <code>createLauncher</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>launcherType</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Launcher created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get notes for specific month</h3><p><code>GET /api/special-notes/notes-for-month/{month}</code> · <code>getNotesForMonth</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>month</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Notes for the month</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: array of <a href=\"#schema-Note\"><code>Note</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n }\n]</code></pre></div></section></div><h3>Get quarter note</h3><p><code>GET /api/special-notes/quarters/{quarter}</code> · <code>getQuarter</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>quarter</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Quarter note</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Get first day of week for date</h3><p><code>GET /api/special-notes/week-first-day/{date}</code> · <code>getWeekFirstDay</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>date</code> <br><em>required</em></td><td><code>string (date)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: First day of week</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>date</code></td><td><code>string (date)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"date\": \"2019-08-24\"\n}</code></pre></div></div></div></section></div><h3>Reset launcher note</h3><p><code>POST /api/special-notes/launchers/{noteId}/reset</code> · <code>resetLauncher</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Launcher reset</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Save search note</h3><p><code>POST /api/special-notes/save-search-note</code> · <code>saveSearchNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>query</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"query\": \"string\",\n \"title\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Search note saved</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Save SQL console note</h3><p><code>POST /api/special-notes/save-sql-console</code> · <code>saveSqlConsole</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>sql</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"sql\": \"string\",\n \"title\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: SQL console saved</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Update API script launcher</h3><p><code>PUT /api/special-notes/api-script-launcher</code> · <code>updateApiScriptLauncher</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>code</code></td><td><code>string</code> <br>Script code</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"code\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: API script launcher updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-map-alt\"></span> Visualization</h2><p>Maps and visualizations</p><h3>Get tree map</h3><p><code>POST /api/note-map/{noteId}/tree</code> · <code>getTreeMap</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Tree map data</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre></div></section></div><h3>Get link map</h3><p><code>POST /api/note-map/{noteId}/link</code> · <code>getLinkMap</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Link map data</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre></div></section></div><h3>Get backlinks</h3><p><code>GET /api/note-map/{noteId}/backlinks</code> · <code>getBacklinks</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Backlinks</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get backlink count for note</h3><p><code>GET /api/note-map/{noteId}/backlink-count</code> · <code>getBacklinkCount</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Backlink count</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>count</code></td><td><code>integer</code> <br>Number of backlinks to this note</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"count\": 0\n}</code></pre></div></div></div></section></div><h3>Get relation map data</h3><p><code>POST /api/relation-map</code> · <code>getRelationMap</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>maxDepth</code></td><td><code>integer</code></td></tr><tr><td><code>excludeArchived</code></td><td><code>boolean</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"string\",\n \"maxDepth\": 0,\n \"excludeArchived\": true\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Relation map data</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre></div></section></div><h2><span class=\"tn-icon bx bx-globe\"></span> External</h2><p>External integrations (clipper, sender)</p><h3>Clipper handshake</h3><p><code>GET /api/clipper/handshake</code> · <code>clipperHandshake</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Handshake successful</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>protocolVersion</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"protocolVersion\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Add web clipping</h3><p><code>POST /api/clipper/clippings</code> · <code>addClipping</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code></td></tr><tr><td><code>url</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"content\": \"string\",\n \"url\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Clipping created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Create clipper note</h3><p><code>POST /api/clipper/notes</code> · <code>createClipperNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"content\": \"string\",\n \"parentNoteId\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Note created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Open note in clipper</h3><p><code>POST /api/clipper/open/{noteId}</code> · <code>openNoteInClipper</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note opened in clipper</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td><code>boolean</code></td></tr><tr><td><code>url</code></td><td><code>string</code> <br>URL to open in clipper</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"success\": true,\n \"url\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Sender login</h3><p><code>POST /api/sender/login</code> · <code>senderLogin</code></p><p><strong>Authorization</strong>: none</p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>username</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>password</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"username\": \"string\",\n \"password\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Login successful</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"token\": \"string\"\n}</code></pre></div></div></div></section></div><h3>Upload image from sender</h3><p><code>POST /api/sender/image</code> · <code>uploadSenderImage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>multipart/form-data</code>: <code>object</code></li></ul><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>upload</code></td><td><code>string (binary)</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Image uploaded</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h3>Save note from sender</h3><p><code>POST /api/sender/note</code> · <code>saveSenderNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"content\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: Note saved</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <a href=\"#schema-Note\"><code>Note</code></a></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"ur11rSfHkzeV\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"text/html\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"dateCreated\": \"2019-08-24T14:15:22Z\",\n \"dateModified\": \"2019-08-24T14:15:22Z\",\n \"utcDateCreated\": \"2019-08-24T14:15:22Z\",\n \"utcDateModified\": \"2019-08-24T14:15:22Z\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-wrench\"></span> Utilities</h2><p>Miscellaneous utilities</p><h3>Get system metrics</h3><p><code>GET /api/metrics</code> · <code>getMetrics</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Query parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>format</code></td><td><code>string</code> <br>One of <code>prometheus</code>, <code>json</code>.</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: System metrics</p><div class=\"trilium-tab-panel\"><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>application/json</code>: <code>object</code></p><div class=\"trilium-tab-panel\"><pre><code class=\"language-application-json\">{}</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>text/plain</code>: <code>string</code></p><div class=\"trilium-tab-panel\"><p>&nbsp;</p></div></section></div></div></section></div><h3>Run system diagnostics</h3><p><code>GET /api/system-checks</code> · <code>runSystemChecks</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: System check results</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"name\": \"string\",\n \"status\": \"pass\",\n \"message\": \"string\"\n }\n]</code></pre></div></section></div><h3>Health check endpoint</h3><p><code>GET /api/health-check</code> · <code>healthCheck</code></p><p><strong>Authorization</strong>: none</p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Service is healthy</p><div class=\"trilium-tab-panel\"><ul><li><code>text/plain</code>: <code>string</code></li></ul></div></section></div><h3>Get backend log</h3><p><code>GET /api/backend-log</code> · <code>getBackendLog</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Backend log entries</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"timestamp\": \"2019-08-24T14:15:22Z\",\n \"level\": \"string\",\n \"message\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get note size</h3><p><code>GET /api/stats/note-size/{noteId}</code> · <code>getNoteSize</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Note size</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>size</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"size\": 0\n}</code></pre></div></div></div></section></div><h3>Get subtree size</h3><p><code>GET /api/stats/subtree-size/{noteId}</code> · <code>getSubtreeSize</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Subtree size</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>size</code></td><td><code>integer</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"size\": 0\n}</code></pre></div></div></div></section></div><h3>Get keyboard actions</h3><p><code>GET /api/keyboard-actions</code> · <code>getKeyboardActions</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Keyboard actions</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"actionName\": \"string\",\n \"shortcut\": \"string\",\n \"description\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get keyboard shortcuts for notes</h3><p><code>GET /api/keyboard-shortcuts-for-notes</code> · <code>getKeyboardShortcutsForNotes</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Keyboard shortcuts for notes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"shortcut\": \"string\",\n \"title\": \"string\"\n }\n]</code></pre></div></section></div><h3>Get font CSS</h3><p><code>GET /api/fonts</code> · <code>getFonts</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Font CSS</p><div class=\"trilium-tab-panel\"><ul><li><code>text/css</code>: <code>string</code></li></ul></div></section></div><h3>Add recent note</h3><p><code>POST /api/recent-notes</code> · <code>addRecentNote</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: Note added to recent</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Get recent changes</h3><p><code>GET /api/recent-changes/{ancestorNoteId}</code> · <code>getRecentChanges</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Path parameters</strong></p><figure class=\"table\"><table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>ancestorNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Recent changes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>array of object</code></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"string\",\n \"title\": \"string\",\n \"dateModified\": \"2019-08-24T14:15:22Z\"\n }\n]</code></pre></div></section></div><h3>Get icon usage statistics</h3><p><code>GET /api/other/icon-usage</code> · <code>getIconUsage</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Icon usage stats</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json</code>: <code>object</code></li></ul><pre><code class=\"language-application-json\">{}</code></pre></div></section></div><h3>Render markdown to HTML</h3><p><code>POST /api/other/render-markdown</code> · <code>renderMarkdown</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>markdownContent</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"markdownContent\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Rendered HTML</p><div class=\"trilium-tab-panel\"><ul><li><code>text/html</code>: <code>string</code></li></ul></div></section></div><h3>Renders given HTML to Markdown</h3><p><code>POST /api/other/to-markdown</code> · <code>toMarkdown</code></p><p><strong>Authorization</strong>: <code>sessionAuth</code> or <code>tokenAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <code>object</code></li></ul><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>htmlContent</code> <br><em>required</em></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"htmlContent\": \"string\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: Rendered Markdown</p><div class=\"trilium-tab-panel\"><ul><li><code>text/plain</code>: <code>string</code></li></ul></div></section></div><h2><span class=\"tn-icon bx bx-cube\"></span> Schemas</h2><h3><a id=\"schema-Note\"></a><code>Note</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code> <br>12-character note ID</td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code> <br>Note title</td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code> <br>MIME type</td></tr><tr><td><code>isProtected</code> <br><em>required</em></td><td><code>boolean</code> <br>Whether note is protected</td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of content blob</td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure><h3><a id=\"schema-NoteType\"></a><code>NoteType</code></h3><p>Type: <code>string</code></p><p>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</p><h3><a id=\"schema-Branch\"></a><code>Branch</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code> <br><em>required</em></td><td><code>string</code> <br>Branch ID (parentNoteId_noteId)</td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>notePosition</code> <br><em>required</em></td><td><code>integer</code></td></tr><tr><td><code>prefix</code></td><td><code>string | null</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr></tbody></table></figure><h3><a id=\"schema-Attribute\"></a><code>Attribute</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>noteId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>value</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr></tbody></table></figure><h3><a id=\"schema-Attachment\"></a><code>Attachment</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>ownerId</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>role</code> <br><em>required</em></td><td><code>string</code> <br>One of <code>image</code>, <code>file</code>.</td></tr><tr><td><code>mime</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure><h3><a id=\"schema-Revision\"></a><code>Revision</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code></td><td><code>string</code></td></tr><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>type</code></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure><h3><a id=\"schema-SearchResult\"></a><code>SearchResult</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>path</code></td><td><code>string</code></td></tr><tr><td><code>score</code></td><td><code>number</code></td></tr><tr><td><code>highlights</code></td><td><code>array of string</code></td></tr></tbody></table></figure><h3><a id=\"schema-EntityChange\"></a><code>EntityChange</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>entityChange</code></td><td><code>object</code></td></tr><tr><td><code>entityChange.entityName</code></td><td><code>string</code></td></tr><tr><td><code>entityChange.changeId</code></td><td><code>string</code></td></tr><tr><td><code>entity</code></td><td><code>object</code></td></tr></tbody></table></figure><h3><a id=\"schema-Timestamps\"></a><code>Timestamps</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>dateModified</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>utcDateModified</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure><h3><a id=\"schema-CreateNoteRequest\"></a><code>CreateNoteRequest</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>title</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code></td></tr><tr><td><code>type</code> <br><em>required</em></td><td><a href=\"#schema-NoteType\"><code>NoteType</code></a> <br>One of <code>text</code>, <code>code</code>, <code>render</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>relationMap</code>, <code>book</code>, <code>noteMap</code>, <code>mermaid</code>, <code>canvas</code>, <code>webView</code>, <code>launcher</code>, <code>doc</code>, <code>contentWidget</code>, <code>mindMap</code>, <code>geoMap</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>isProtected</code></td><td><code>boolean</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer</code></td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>parentNoteId</code></td><td><code>string</code></td></tr><tr><td><code>templateNoteId</code></td><td><code>string</code></td></tr></tbody></table></figure><h3><a id=\"schema-ScriptBundle\"></a><code>ScriptBundle</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code></td><td><code>string</code></td></tr><tr><td><code>script</code></td><td><code>string</code></td></tr><tr><td><code>html</code></td><td><code>string</code></td></tr><tr><td><code>css</code></td><td><code>string</code></td></tr></tbody></table></figure><h3><a id=\"schema-AppInfo\"></a><code>AppInfo</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>appVersion</code></td><td><code>string</code></td></tr><tr><td><code>dbVersion</code></td><td><code>integer</code></td></tr><tr><td><code>nodeVersion</code></td><td><code>string</code></td></tr><tr><td><code>syncVersion</code></td><td><code>integer</code></td></tr><tr><td><code>buildDate</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>buildRevision</code></td><td><code>string</code></td></tr><tr><td><code>dataDirectory</code></td><td><code>string</code></td></tr><tr><td><code>clipperProtocolVersion</code></td><td><code>string</code></td></tr><tr><td><code>utcDateTime</code></td><td><code>string (date-time)</code></td></tr></tbody></table></figure><h3><a id=\"schema-ChatSession\"></a><code>ChatSession</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>sessionId</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>messages</code></td><td><code>array of object</code></td></tr><tr><td><code>messages[].role</code></td><td><code>string</code> <br>One of <code>user</code>, <code>assistant</code>, <code>system</code>.</td></tr><tr><td><code>messages[].content</code></td><td><code>string</code></td></tr><tr><td><code>messages[].timestamp</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>createdAt</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>lastActive</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>messageCount</code></td><td><code>integer</code></td></tr></tbody></table></figure><h3><a id=\"schema-EtapiToken\"></a><code>EtapiToken</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>etapiTokenId</code></td><td><code>string</code></td></tr><tr><td><code>name</code></td><td><code>string</code></td></tr><tr><td><code>token</code></td><td><code>string</code></td></tr><tr><td><code>dateCreated</code></td><td><code>string (date-time)</code></td></tr><tr><td><code>isDeleted</code></td><td><code>boolean</code></td></tr></tbody></table></figure>",
"_help_2mUhVmZK8RF3": "<figure class=\"image image-style-align-right\"><img style=\"aspect-ratio:263/445;\" src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Hidden%20Notes_image.png\" width=\"263\" height=\"445\"></figure><p>For easy extensibility, a lot of features in Trilium make use of actual notes to store information as opposed to having them stored in a separate location in the database. This allows some functions such as&nbsp;<a class=\"reference-link\" href=\"#root/_help_zEY4DaJG4YT5\">Attributes</a>,&nbsp;<a class=\"reference-link\" href=\"#root/_help_Cq5X6iKQop6R\">Relations</a>&nbsp;or even&nbsp;<a class=\"reference-link\" href=\"#root/_help_eIg8jdvaoNNd\">Search</a>&nbsp;and&nbsp;<a class=\"reference-link\" href=\"#root/_help_QEAPj01N5f7w\">Links</a>&nbsp;to be able to operate on them.</p><p>As the name suggests, these notes are hidden to the user by default to prevent cluttering the note tree and to prevent them from being accidentally deleted.</p><p>The hidden notes are stored in the user's&nbsp;<a class=\"reference-link\" href=\"#root/_help_wX4HbRucYSDD\">Database</a>&nbsp;just like normal notes, but they have a unique&nbsp;<a class=\"reference-link\" href=\"#root/_help_m1lbrzyKDaRB\">Note ID</a>&nbsp;which allows them to be distinguished from the normal ones.</p><h2>Accessing the hidden note tree</h2><p>From the&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>, select <em>Advanced</em> → <em>Hidden notes</em>.</p><h2>Contents of the hidden note tree</h2><p>Here is a brief summary of all the notes within the hidden tree:</p><figure class=\"table\"><table class=\"ck-table-resized\"><colgroup><col style=\"width:19.93%;\"><col style=\"width:80.07%;\"></colgroup><thead><tr><th>Note</th><th>Description</th></tr></thead><tbody><tr><td><a class=\"reference-link\" href=\"#root/_hidden/_globalNoteMap\">Note Map</a></td><td><p>This note is actually opened when the&nbsp;<a class=\"reference-link\" href=\"#root/_help_bdUJEHsAPYQR\">Note Map</a>&nbsp;feature that is accessed from the&nbsp;<a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>.</p><p>It is possible to create any child notes in it without any additional meaning. For example, it can be used to store a list of note maps which can be linked to from other notes or <a href=\"#root/_help_u3YFHC9tQlpm\">bookmarked</a>.</p></td></tr><tr><td><a class=\"reference-link\" href=\"#root/_hidden/_sqlConsole\">SQL Console History</a></td><td><p>When SQL queries or commands are executed in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_YKWqdJhzi2VY\">SQL Console</a>, they are stored here, grouped by month. Only the query is stored and not the results.</p><p>This section can be accessed without going to the hidden tree by simply going to the&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>&nbsp;and selecting Advanced → SQL console history.</p><p>Notes can be added as children of this tree, but it's generally not recommended to do so to not interfere with the normal history process.</p></td></tr><tr><td><a class=\"reference-link\" href=\"#root/_hidden/_search\">Search History</a></td><td><p>Whenever a search is executed from the full&nbsp;<a class=\"reference-link\" href=\"#root/_help_eIg8jdvaoNNd\">Search</a>, the query will be stored here, grouped by month. Only the search parameters are stored and not the results themselves.</p><p>This section can be accessed without going to the hidden tree by simply going to the&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>&nbsp;and selecting Advanced → Search history.</p><p>Notes can be added as children of this tree, but it's generally not recommended to do so to not interfere with the normal history process.</p></td></tr><tr><td><a class=\"reference-link\" href=\"#root/_hidden/_bulkAction\">Bulk Action</a></td><td><p>This section is used for&nbsp;<a class=\"reference-link\" href=\"#root/_help_ivYnonVFBxbQ\">Bulk Actions</a>. The last configuration for bulk actions will be stored as part of this note, each action in its own <code>action</code> label.</p><p>Notes can be added as children of this tree, but there won't be any benefit in doing so.</p></td></tr><tr><td><a class=\"reference-link\" href=\"#root/_hidden/_backendLog\">Backend Log</a></td><td><p>This note corresponds to the backend log feature (see&nbsp;<a class=\"reference-link\" href=\"#root/_help_qzNzp9LYQyPT\">Error logs</a>).</p><p>This item can be accessed without going to the hidden try by going to the&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>&nbsp;and selecting Advanced → Backend log.</p></td></tr><tr><td><a class=\"reference-link\" href=\"#root/_hidden/_userHidden\">User Hidden</a></td><td>This section can be used by <a href=\"#root/_help_CdNpE2pqjmI6\">scripts</a> to create their own notes that should not be directly visible to the user. The note can be identified by scripts by its unique ID: <code>_userHidden</code></td></tr><tr><td><a class=\"reference-link\" href=\"#root/_hidden/_lbTplRoot\">Launch Bar Templates</a></td><td><p>This section contains the templates for the creation of launchers in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>. It is not possible to create child notes here.</p><p>Theoretically some of the notes here can be customized, but there's not much benefit to be had in doing so.</p></td></tr><tr><td><a class=\"reference-link\" href=\"#root/_hidden/_share\">Shared Notes</a></td><td><p>This tree lists all of the notes that are <a href=\"#root/_help_R9pX4DGra2Vt\">shared</a> publicly. It can be useful to track down which notes are shared regardless of their position in the note tree.</p><p>This section can be accessed without going to the hidden tree simply by going to the&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>&nbsp;and selecting <em>Advanced</em> → <em>Shared notes</em>.</p><p>Sub-notes cannot be created here.</p></td></tr><tr><td><a class=\"reference-link\" href=\"#root/_hidden/_lbRoot\">Launch Bar</a></td><td><p>The tree contains both available and displayed items of the&nbsp;<a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>.</p><p>This section can be accessed without going to the hidden tree by:</p><ul><li>Going to the&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>&nbsp;and selecting <em>Configure launch bar…</em>.</li><li>Right-clicking an empty space on the&nbsp;<a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>&nbsp;and selecting <em>Configure launch bar…</em>.</li></ul><p>Sub-notes cannot be created here.</p></td></tr><tr><td><a class=\"reference-link\" href=\"#root/_hidden/_options\">Options</a></td><td><p>This section stores the list of&nbsp;<a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a>.</p><p>This section can be accessed without going to the hidden tree by:</p><ul><li>Going to the&nbsp;<a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a>&nbsp;and selecting <em>Options</em>.</li><li>Pressing the dedicated Options icon in the&nbsp;<a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>.</li></ul></td></tr><tr><td><a class=\"reference-link\" href=\"#root/_hidden/_lbMobileRoot\">Mobile Launch Bar</a></td><td><p>This is very similar to the <em>Launch Bar</em>, but is dedicated for the mobile UI only.</p><p>Accessing it outside the <em>Launch Bar</em> is the same as the Launch Bar, but needs to be done so from the mobile interface.</p></td></tr><tr><td><a class=\"reference-link\" href=\"#root/_hidden/_help\">User Guide</a></td><td>This is where the User Guide appears in the note tree. Its notes are not stored in the database: Trilium builds them from files that ship with the application each time it starts, so they cannot be edited, moved or cloned, and they are not synchronized.</td></tr></tbody></table></figure>",
"_help_uYF7pmepw27K": "<p>The Trilium Metrics API provides comprehensive monitoring data about your Trilium instance, designed for external monitoring systems like Prometheus.</p><h2>Endpoint</h2><ul><li><strong>URL</strong>: <code>/etapi/metrics</code></li><li><strong>Method</strong>: <code>GET</code></li><li><strong>Authentication</strong>: ETAPI token required</li><li><strong>Default Format</strong>: Prometheus text format</li></ul><h2>Authentication</h2><p>You need an ETAPI token to access the metrics endpoint. Get one by:</p><pre><code class=\"language-text-x-trilium-auto\"># Get an ETAPI token\ncurl -X POST http://localhost:8080/etapi/auth/login \\\n -H \"Content-Type: application/json\" \\\n -d '{\"password\": \"your_password\"}'\n</code></pre><h2>Usage</h2><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">Prometheus Format (Default)</p><div class=\"trilium-tab-panel\"><pre><code class=\"language-text-x-trilium-auto\">curl -H \"Authorization: YOUR_ETAPI_TOKEN\" \\\n http://localhost:8080/etapi/metrics\n</code></pre><p>Returns metrics in Prometheus text format:</p><pre><code class=\"language-text-x-trilium-auto\"># HELP trilium_info Trilium instance information\n# TYPE trilium_info gauge\ntrilium_info{version=\"0.91.6\",db_version=\"231\",node_version=\"v18.17.0\"} 1 1701432000\n\n# HELP trilium_notes_total Total number of notes including deleted\n# TYPE trilium_notes_total gauge\ntrilium_notes_total 1234 1701432000</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">JSON Format</p><div class=\"trilium-tab-panel\"><pre><code class=\"language-text-x-trilium-auto\">curl -H \"Authorization: YOUR_ETAPI_TOKEN\" \\\n \"http://localhost:8080/etapi/metrics?format=json\"\n</code></pre><p>Returns detailed metrics in JSON format for debugging or custom integrations.</p></div></section></div><h2>Available Metrics</h2><h3>Instance Information</h3><ul><li><code>trilium_info</code> - Version and build information with labels</li></ul><h3>Database Metrics</h3><ul><li><code>trilium_notes_total</code> - Total notes (including deleted)</li><li><code>trilium_notes_deleted</code> - Number of deleted notes</li><li><code>trilium_notes_active</code> - Number of active notes</li><li><code>trilium_notes_protected</code> - Number of protected notes</li><li><code>trilium_attachments_total</code> - Total attachments</li><li><code>trilium_attachments_active</code> - Active attachments</li><li><code>trilium_revisions_total</code> - Total note revisions</li><li><code>trilium_branches_total</code> - Active branches</li><li><code>trilium_attributes_total</code> - Active attributes</li><li><code>trilium_blobs_total</code> - Total blob records</li><li><code>trilium_etapi_tokens_total</code> - Active ETAPI tokens</li><li><code>trilium_embeddings_total</code> - Note embeddings (if available)</li></ul><h3>Categorized Metrics</h3><ul><li><code>trilium_notes_by_type{type=\"text|code|image|file\"}</code> - Notes by type</li><li><code>trilium_attachments_by_type{mime_type=\"...\"}</code> - Attachments by MIME type</li></ul><h3>Statistics</h3><ul><li><code>trilium_database_size_bytes</code> - Database size in bytes</li><li><code>trilium_oldest_note_timestamp</code> - Timestamp of oldest note</li><li><code>trilium_newest_note_timestamp</code> - Timestamp of newest note</li><li><code>trilium_last_modified_timestamp</code> - Last modification timestamp</li></ul><h2>Prometheus Configuration</h2><p>Add to your <code>prometheus.yml</code>:</p><pre><code class=\"language-text-x-trilium-auto\">scrape_configs:\n - job_name: 'trilium'\n static_configs:\n - targets: ['localhost:8080']\n metrics_path: '/etapi/metrics'\n bearer_token: 'YOUR_ETAPI_TOKEN'\n scrape_interval: 30s\n</code></pre><h2>Error Responses</h2><ul><li><code>400</code> - Invalid format parameter</li><li><code>401</code> - Missing or invalid ETAPI token</li><li><code>500</code> - Internal server error</li></ul><h2>Grafana Dashboard</h2><figure class=\"image\"><img style=\"aspect-ratio:2594/1568;\" src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/1_Metrics_image.png\" width=\"2594\" height=\"1568\"></figure><p>You can also use the Grafana Dashboard that has been created for TriliumNext - just take the JSON from&nbsp;<a class=\"reference-link\" href=\"#root/_help_bOP3TB56fL1V\">grafana-dashboard.json</a>&nbsp;and then import the dashboard, following these screenshots:</p><figure class=\"image\"><img style=\"aspect-ratio:1881/282;\" src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/2_Metrics_image.png\" width=\"1881\" height=\"282\"></figure><p>Then paste the JSON, and hit load:</p><figure class=\"image\"><img style=\"aspect-ratio:1055/830;\" src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Metrics_image.png\" width=\"1055\" height=\"830\"></figure>",
"_help_bOP3TB56fL1V": "{\n \"annotations\": {\n \"list\": [\n {\n \"builtIn\": 1,\n \"datasource\": {\n \"type\": \"grafana\",\n \"uid\": \"-- Grafana --\"\n },\n \"enable\": true,\n \"hide\": true,\n \"iconColor\": \"rgba(0, 211, 255, 1)\",\n \"name\": \"Annotations & Alerts\",\n \"type\": \"dashboard\"\n }\n ]\n },\n \"editable\": true,\n \"fiscalYearStartMonth\": 0,\n \"graphTooltip\": 1,\n \"id\": 549,\n \"links\": [],\n \"panels\": [\n {\n \"collapsed\": false,\n \"gridPos\": {\n \"h\": 1,\n \"w\": 24,\n \"x\": 0,\n \"y\": 0\n },\n \"id\": 100,\n \"panels\": [],\n \"title\": \"🏠 Trilium Overview\",\n \"type\": \"row\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Current Trilium version and build information\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"thresholds\"\n },\n \"custom\": {\n \"align\": \"auto\",\n \"cellOptions\": {\n \"type\": \"auto\"\n },\n \"filterable\": false,\n \"inspect\": false\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"green\"\n }\n ]\n }\n },\n \"overrides\": []\n },\n \"gridPos\": {\n \"h\": 6,\n \"w\": 12,\n \"x\": 0,\n \"y\": 1\n },\n \"id\": 101,\n \"options\": {\n \"cellHeight\": \"sm\",\n \"footer\": {\n \"countRows\": false,\n \"fields\": \"\",\n \"reducer\": [\n \"sum\"\n ],\n \"show\": false\n },\n \"showHeader\": true\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_info{job=~'$job',instance=~'$instance'}\",\n \"format\": \"table\",\n \"instant\": true,\n \"refId\": \"A\"\n }\n ],\n \"title\": \"📋 Instance Information\",\n \"transformations\": [\n {\n \"id\": \"organize\",\n \"options\": {\n \"excludeByName\": {\n \"Time\": true,\n \"Value\": true,\n \"__name__\": true,\n \"instance\": true,\n \"job\": true\n },\n \"indexByName\": {},\n \"renameByName\": {\n \"build_date\": \"Build Date\",\n \"build_revision\": \"Git Revision\",\n \"db_version\": \"DB Version\",\n \"node_version\": \"Node.js\",\n \"sync_version\": \"Sync Version\",\n \"version\": \"Version\"\n }\n }\n }\n ],\n \"type\": \"table\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Database file size in human-readable format\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"thresholds\"\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"green\"\n },\n {\n \"color\": \"yellow\",\n \"value\": 500000000\n },\n {\n \"color\": \"red\",\n \"value\": 1000000000\n }\n ]\n },\n \"unit\": \"decbytes\"\n },\n \"overrides\": []\n },\n \"gridPos\": {\n \"h\": 6,\n \"w\": 6,\n \"x\": 12,\n \"y\": 1\n },\n \"id\": 102,\n \"options\": {\n \"colorMode\": \"background\",\n \"graphMode\": \"area\",\n \"justifyMode\": \"center\",\n \"orientation\": \"auto\",\n \"percentChangeColorMode\": \"standard\",\n \"reduceOptions\": {\n \"calcs\": [\n \"lastNotNull\"\n ],\n \"fields\": \"\",\n \"values\": false\n },\n \"showPercentChange\": false,\n \"textMode\": \"auto\",\n \"wideLayout\": true\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_database_size_bytes{job=~'$job',instance=~'$instance'}\",\n \"refId\": \"A\"\n }\n ],\n \"title\": \"💾 Database Size\",\n \"type\": \"stat\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Total active notes in your Trilium instance\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"thresholds\"\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"green\"\n },\n {\n \"color\": \"yellow\",\n \"value\": 1000\n },\n {\n \"color\": \"red\",\n \"value\": 5000\n }\n ]\n },\n \"unit\": \"short\"\n },\n \"overrides\": []\n },\n \"gridPos\": {\n \"h\": 6,\n \"w\": 6,\n \"x\": 18,\n \"y\": 1\n },\n \"id\": 103,\n \"options\": {\n \"colorMode\": \"background\",\n \"graphMode\": \"area\",\n \"justifyMode\": \"center\",\n \"orientation\": \"auto\",\n \"percentChangeColorMode\": \"standard\",\n \"reduceOptions\": {\n \"calcs\": [\n \"lastNotNull\"\n ],\n \"fields\": \"\",\n \"values\": false\n },\n \"showPercentChange\": false,\n \"textMode\": \"auto\",\n \"wideLayout\": true\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_notes_active{job=~'$job',instance=~'$instance'}\",\n \"refId\": \"A\"\n }\n ],\n \"title\": \"📝 Active Notes\",\n \"type\": \"stat\"\n },\n {\n \"collapsed\": false,\n \"gridPos\": {\n \"h\": 1,\n \"w\": 24,\n \"x\": 0,\n \"y\": 7\n },\n \"id\": 200,\n \"panels\": [],\n \"title\": \"📊 Key Metrics\",\n \"type\": \"row\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Total notes including deleted ones\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"palette-classic\"\n },\n \"custom\": {\n \"hideFrom\": {\n \"legend\": false,\n \"tooltip\": false,\n \"viz\": false\n }\n },\n \"mappings\": [],\n \"unit\": \"short\"\n },\n \"overrides\": []\n },\n \"gridPos\": {\n \"h\": 8,\n \"w\": 6,\n \"x\": 0,\n \"y\": 8\n },\n \"id\": 201,\n \"options\": {\n \"legend\": {\n \"displayMode\": \"list\",\n \"placement\": \"bottom\",\n \"showLegend\": true,\n \"values\": []\n },\n \"pieType\": \"pie\",\n \"reduceOptions\": {\n \"calcs\": [\n \"lastNotNull\"\n ],\n \"fields\": \"\",\n \"values\": false\n },\n \"tooltip\": {\n \"hideZeros\": false,\n \"mode\": \"single\",\n \"sort\": \"none\"\n }\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_notes_active{job=~'$job',instance=~'$instance'}\",\n \"legendFormat\": \"Active Notes\",\n \"refId\": \"A\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_notes_deleted{job=~'$job',instance=~'$instance'}\",\n \"legendFormat\": \"Deleted Notes\",\n \"refId\": \"B\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_notes_protected{job=~'$job',instance=~'$instance'}\",\n \"legendFormat\": \"Protected Notes\",\n \"refId\": \"C\"\n }\n ],\n \"title\": \"📝 Notes Distribution\",\n \"type\": \"piechart\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Breakdown of attachments by MIME type\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"palette-classic\"\n },\n \"custom\": {\n \"hideFrom\": {\n \"legend\": false,\n \"tooltip\": false,\n \"viz\": false\n }\n },\n \"mappings\": [],\n \"unit\": \"short\"\n },\n \"overrides\": []\n },\n \"gridPos\": {\n \"h\": 8,\n \"w\": 6,\n \"x\": 6,\n \"y\": 8\n },\n \"id\": 202,\n \"options\": {\n \"legend\": {\n \"displayMode\": \"list\",\n \"placement\": \"bottom\",\n \"showLegend\": true,\n \"values\": []\n },\n \"pieType\": \"donut\",\n \"reduceOptions\": {\n \"calcs\": [\n \"lastNotNull\"\n ],\n \"fields\": \"\",\n \"values\": false\n },\n \"tooltip\": {\n \"hideZeros\": false,\n \"mode\": \"single\",\n \"sort\": \"none\"\n }\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_attachments_by_type{job=~'$job',instance=~'$instance'}\",\n \"legendFormat\": \"{{mime_type}}\",\n \"refId\": \"A\"\n }\n ],\n \"title\": \"🖼️ Attachments by Type\",\n \"type\": \"piechart\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Distribution of notes by their content type\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"palette-classic\"\n },\n \"custom\": {\n \"hideFrom\": {\n \"legend\": false,\n \"tooltip\": false,\n \"viz\": false\n }\n },\n \"mappings\": [],\n \"unit\": \"short\"\n },\n \"overrides\": []\n },\n \"gridPos\": {\n \"h\": 8,\n \"w\": 12,\n \"x\": 12,\n \"y\": 8\n },\n \"id\": 203,\n \"options\": {\n \"legend\": {\n \"displayMode\": \"table\",\n \"placement\": \"right\",\n \"showLegend\": true,\n \"values\": [\n \"value\",\n \"percent\"\n ]\n },\n \"pieType\": \"donut\",\n \"reduceOptions\": {\n \"calcs\": [\n \"lastNotNull\"\n ],\n \"fields\": \"\",\n \"values\": false\n },\n \"tooltip\": {\n \"hideZeros\": false,\n \"mode\": \"single\",\n \"sort\": \"none\"\n }\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_notes_by_type{job=~'$job',instance=~'$instance'}\",\n \"legendFormat\": \"{{type}}\",\n \"refId\": \"A\"\n }\n ],\n \"title\": \"📄 Notes by Content Type\",\n \"type\": \"piechart\"\n },\n {\n \"collapsed\": false,\n \"gridPos\": {\n \"h\": 1,\n \"w\": 24,\n \"x\": 0,\n \"y\": 16\n },\n \"id\": 300,\n \"panels\": [],\n \"title\": \"📈 Trends & Time Series\",\n \"type\": \"row\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Growth of notes over time\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"palette-classic\"\n },\n \"custom\": {\n \"axisBorderShow\": false,\n \"axisCenteredZero\": false,\n \"axisColorMode\": \"text\",\n \"axisLabel\": \"\",\n \"axisPlacement\": \"auto\",\n \"barAlignment\": 0,\n \"barWidthFactor\": 0.6,\n \"drawStyle\": \"line\",\n \"fillOpacity\": 20,\n \"gradientMode\": \"hue\",\n \"hideFrom\": {\n \"legend\": false,\n \"tooltip\": false,\n \"viz\": false\n },\n \"insertNulls\": false,\n \"lineInterpolation\": \"smooth\",\n \"lineWidth\": 3,\n \"pointSize\": 8,\n \"scaleDistribution\": {\n \"type\": \"linear\"\n },\n \"showPoints\": \"auto\",\n \"spanNulls\": false,\n \"stacking\": {\n \"group\": \"A\",\n \"mode\": \"none\"\n },\n \"thresholdsStyle\": {\n \"mode\": \"off\"\n }\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"green\"\n }\n ]\n },\n \"unit\": \"short\"\n },\n \"overrides\": [\n {\n \"matcher\": {\n \"id\": \"byName\",\n \"options\": \"Active Notes\"\n },\n \"properties\": [\n {\n \"id\": \"color\",\n \"value\": {\n \"fixedColor\": \"blue\",\n \"mode\": \"fixed\"\n }\n }\n ]\n },\n {\n \"matcher\": {\n \"id\": \"byName\",\n \"options\": \"Total Notes\"\n },\n \"properties\": [\n {\n \"id\": \"color\",\n \"value\": {\n \"fixedColor\": \"green\",\n \"mode\": \"fixed\"\n }\n }\n ]\n }\n ]\n },\n \"gridPos\": {\n \"h\": 8,\n \"w\": 12,\n \"x\": 0,\n \"y\": 17\n },\n \"id\": 301,\n \"options\": {\n \"legend\": {\n \"calcs\": [\n \"last\",\n \"max\"\n ],\n \"displayMode\": \"table\",\n \"placement\": \"bottom\",\n \"showLegend\": true\n },\n \"tooltip\": {\n \"hideZeros\": false,\n \"mode\": \"multi\",\n \"sort\": \"desc\"\n }\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_notes_active{job=~'$job',instance=~'$instance'}\",\n \"legendFormat\": \"Active Notes\",\n \"refId\": \"A\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_notes_total{job=~'$job',instance=~'$instance'}\",\n \"legendFormat\": \"Total Notes\",\n \"refId\": \"B\"\n }\n ],\n \"title\": \"📈 Notes Growth Over Time\",\n \"type\": \"timeseries\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Attachment storage trends\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"palette-classic\"\n },\n \"custom\": {\n \"axisBorderShow\": false,\n \"axisCenteredZero\": false,\n \"axisColorMode\": \"text\",\n \"axisLabel\": \"\",\n \"axisPlacement\": \"auto\",\n \"barAlignment\": 0,\n \"barWidthFactor\": 0.6,\n \"drawStyle\": \"line\",\n \"fillOpacity\": 20,\n \"gradientMode\": \"hue\",\n \"hideFrom\": {\n \"legend\": false,\n \"tooltip\": false,\n \"viz\": false\n },\n \"insertNulls\": false,\n \"lineInterpolation\": \"smooth\",\n \"lineWidth\": 3,\n \"pointSize\": 8,\n \"scaleDistribution\": {\n \"type\": \"linear\"\n },\n \"showPoints\": \"auto\",\n \"spanNulls\": false,\n \"stacking\": {\n \"group\": \"A\",\n \"mode\": \"none\"\n },\n \"thresholdsStyle\": {\n \"mode\": \"off\"\n }\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"green\"\n }\n ]\n },\n \"unit\": \"short\"\n },\n \"overrides\": [\n {\n \"matcher\": {\n \"id\": \"byName\",\n \"options\": \"Active Attachments\"\n },\n \"properties\": [\n {\n \"id\": \"color\",\n \"value\": {\n \"fixedColor\": \"purple\",\n \"mode\": \"fixed\"\n }\n }\n ]\n },\n {\n \"matcher\": {\n \"id\": \"byName\",\n \"options\": \"Total Attachments\"\n },\n \"properties\": [\n {\n \"id\": \"color\",\n \"value\": {\n \"fixedColor\": \"orange\",\n \"mode\": \"fixed\"\n }\n }\n ]\n }\n ]\n },\n \"gridPos\": {\n \"h\": 8,\n \"w\": 12,\n \"x\": 12,\n \"y\": 17\n },\n \"id\": 302,\n \"options\": {\n \"legend\": {\n \"calcs\": [\n \"last\",\n \"max\"\n ],\n \"displayMode\": \"table\",\n \"placement\": \"bottom\",\n \"showLegend\": true\n },\n \"tooltip\": {\n \"hideZeros\": false,\n \"mode\": \"multi\",\n \"sort\": \"desc\"\n }\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_attachments_active{job=~'$job',instance=~'$instance'}\",\n \"legendFormat\": \"Active Attachments\",\n \"refId\": \"A\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_attachments_total{job=~'$job',instance=~'$instance'}\",\n \"legendFormat\": \"Total Attachments\",\n \"refId\": \"B\"\n }\n ],\n \"title\": \"📎 Attachments Growth Over Time\",\n \"type\": \"timeseries\"\n },\n {\n \"collapsed\": false,\n \"gridPos\": {\n \"h\": 1,\n \"w\": 24,\n \"x\": 0,\n \"y\": 25\n },\n \"id\": 400,\n \"panels\": [],\n \"title\": \"🔧 Advanced Metrics\",\n \"type\": \"row\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Number of branches connecting notes\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"thresholds\"\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"green\"\n }\n ]\n },\n \"unit\": \"short\"\n },\n \"overrides\": []\n },\n \"gridPos\": {\n \"h\": 4,\n \"w\": 6,\n \"x\": 0,\n \"y\": 26\n },\n \"id\": 401,\n \"options\": {\n \"colorMode\": \"value\",\n \"graphMode\": \"none\",\n \"justifyMode\": \"center\",\n \"orientation\": \"auto\",\n \"percentChangeColorMode\": \"standard\",\n \"reduceOptions\": {\n \"calcs\": [\n \"lastNotNull\"\n ],\n \"fields\": \"\",\n \"values\": false\n },\n \"showPercentChange\": false,\n \"textMode\": \"auto\",\n \"wideLayout\": true\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_branches_total{job=~'$job',instance=~'$instance'}\",\n \"refId\": \"A\"\n }\n ],\n \"title\": \"🌳 Total Branches\",\n \"type\": \"stat\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Number of note attributes\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"thresholds\"\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"green\"\n }\n ]\n },\n \"unit\": \"short\"\n },\n \"overrides\": []\n },\n \"gridPos\": {\n \"h\": 4,\n \"w\": 6,\n \"x\": 6,\n \"y\": 26\n },\n \"id\": 402,\n \"options\": {\n \"colorMode\": \"value\",\n \"graphMode\": \"none\",\n \"justifyMode\": \"center\",\n \"orientation\": \"auto\",\n \"percentChangeColorMode\": \"standard\",\n \"reduceOptions\": {\n \"calcs\": [\n \"lastNotNull\"\n ],\n \"fields\": \"\",\n \"values\": false\n },\n \"showPercentChange\": false,\n \"textMode\": \"auto\",\n \"wideLayout\": true\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_attributes_total{job=~'$job',instance=~'$instance'}\",\n \"refId\": \"A\"\n }\n ],\n \"title\": \"🏷️ Attributes\",\n \"type\": \"stat\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Number of note revisions\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"thresholds\"\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"green\"\n }\n ]\n },\n \"unit\": \"short\"\n },\n \"overrides\": []\n },\n \"gridPos\": {\n \"h\": 4,\n \"w\": 6,\n \"x\": 12,\n \"y\": 26\n },\n \"id\": 403,\n \"options\": {\n \"colorMode\": \"value\",\n \"graphMode\": \"none\",\n \"justifyMode\": \"center\",\n \"orientation\": \"auto\",\n \"percentChangeColorMode\": \"standard\",\n \"reduceOptions\": {\n \"calcs\": [\n \"lastNotNull\"\n ],\n \"fields\": \"\",\n \"values\": false\n },\n \"showPercentChange\": false,\n \"textMode\": \"auto\",\n \"wideLayout\": true\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_revisions_total{job=~'$job',instance=~'$instance'}\",\n \"refId\": \"A\"\n }\n ],\n \"title\": \"🔄 Revisions\",\n \"type\": \"stat\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Number of ETAPI tokens\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"thresholds\"\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"green\"\n }\n ]\n },\n \"unit\": \"short\"\n },\n \"overrides\": []\n },\n \"gridPos\": {\n \"h\": 4,\n \"w\": 6,\n \"x\": 18,\n \"y\": 26\n },\n \"id\": 404,\n \"options\": {\n \"colorMode\": \"value\",\n \"graphMode\": \"none\",\n \"justifyMode\": \"center\",\n \"orientation\": \"auto\",\n \"percentChangeColorMode\": \"standard\",\n \"reduceOptions\": {\n \"calcs\": [\n \"lastNotNull\"\n ],\n \"fields\": \"\",\n \"values\": false\n },\n \"showPercentChange\": false,\n \"textMode\": \"auto\",\n \"wideLayout\": true\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_etapi_tokens_total{job=~'$job',instance=~'$instance'}\",\n \"refId\": \"A\"\n }\n ],\n \"title\": \"🔑 API Tokens\",\n \"type\": \"stat\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Various storage and system metrics\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"palette-classic\"\n },\n \"custom\": {\n \"axisBorderShow\": false,\n \"axisCenteredZero\": false,\n \"axisColorMode\": \"text\",\n \"axisLabel\": \"\",\n \"axisPlacement\": \"auto\",\n \"barAlignment\": 0,\n \"barWidthFactor\": 0.6,\n \"drawStyle\": \"line\",\n \"fillOpacity\": 10,\n \"gradientMode\": \"none\",\n \"hideFrom\": {\n \"legend\": false,\n \"tooltip\": false,\n \"viz\": false\n },\n \"insertNulls\": false,\n \"lineInterpolation\": \"linear\",\n \"lineWidth\": 2,\n \"pointSize\": 5,\n \"scaleDistribution\": {\n \"type\": \"linear\"\n },\n \"showPoints\": \"auto\",\n \"spanNulls\": false,\n \"stacking\": {\n \"group\": \"A\",\n \"mode\": \"none\"\n },\n \"thresholdsStyle\": {\n \"mode\": \"off\"\n }\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"green\"\n }\n ]\n },\n \"unit\": \"short\"\n },\n \"overrides\": [\n {\n \"matcher\": {\n \"id\": \"byName\",\n \"options\": \"Recent Notes\"\n },\n \"properties\": [\n {\n \"id\": \"color\",\n \"value\": {\n \"fixedColor\": \"yellow\",\n \"mode\": \"fixed\"\n }\n }\n ]\n }\n ]\n },\n \"gridPos\": {\n \"h\": 8,\n \"w\": 12,\n \"x\": 0,\n \"y\": 30\n },\n \"id\": 405,\n \"options\": {\n \"legend\": {\n \"calcs\": [\n \"last\"\n ],\n \"displayMode\": \"table\",\n \"placement\": \"bottom\",\n \"showLegend\": true\n },\n \"tooltip\": {\n \"hideZeros\": false,\n \"mode\": \"multi\",\n \"sort\": \"desc\"\n }\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_blobs_total{job=~'$job',instance=~'$instance'}\",\n \"legendFormat\": \"Blob Records\",\n \"refId\": \"A\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_recent_notes_total{job=~'$job',instance=~'$instance'}\",\n \"legendFormat\": \"Recent Notes\",\n \"refId\": \"B\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_embeddings_total{job=~'$job',instance=~'$instance'}\",\n \"legendFormat\": \"Embeddings\",\n \"refId\": \"C\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_embedding_providers_total{job=~'$job',instance=~'$instance'}\",\n \"legendFormat\": \"Embedding Providers\",\n \"refId\": \"D\"\n }\n ],\n \"title\": \"📊 Storage & System Metrics\",\n \"type\": \"timeseries\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"description\": \"Timeline showing when content was created and last modified\",\n \"fieldConfig\": {\n \"defaults\": {\n \"color\": {\n \"mode\": \"palette-classic\"\n },\n \"custom\": {\n \"axisBorderShow\": false,\n \"axisCenteredZero\": false,\n \"axisColorMode\": \"text\",\n \"axisLabel\": \"\",\n \"axisPlacement\": \"auto\",\n \"barAlignment\": 0,\n \"barWidthFactor\": 0.6,\n \"drawStyle\": \"points\",\n \"fillOpacity\": 0,\n \"gradientMode\": \"none\",\n \"hideFrom\": {\n \"legend\": false,\n \"tooltip\": false,\n \"viz\": false\n },\n \"insertNulls\": false,\n \"lineInterpolation\": \"linear\",\n \"lineWidth\": 1,\n \"pointSize\": 8,\n \"scaleDistribution\": {\n \"type\": \"linear\"\n },\n \"showPoints\": \"always\",\n \"spanNulls\": false,\n \"stacking\": {\n \"group\": \"A\",\n \"mode\": \"none\"\n },\n \"thresholdsStyle\": {\n \"mode\": \"off\"\n }\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"green\"\n }\n ]\n },\n \"unit\": \"dateTimeAsIso\"\n },\n \"overrides\": []\n },\n \"gridPos\": {\n \"h\": 8,\n \"w\": 12,\n \"x\": 12,\n \"y\": 30\n },\n \"id\": 406,\n \"options\": {\n \"legend\": {\n \"calcs\": [],\n \"displayMode\": \"list\",\n \"placement\": \"bottom\",\n \"showLegend\": true\n },\n \"tooltip\": {\n \"hideZeros\": false,\n \"mode\": \"single\",\n \"sort\": \"none\"\n }\n },\n \"pluginVersion\": \"12.0.1\",\n \"targets\": [\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_oldest_note_timestamp{job=~'$job',instance=~'$instance'} * 1000\",\n \"legendFormat\": \"Oldest Note\",\n \"refId\": \"A\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_newest_note_timestamp{job=~'$job',instance=~'$instance'} * 1000\",\n \"legendFormat\": \"Newest Note\",\n \"refId\": \"B\"\n },\n {\n \"datasource\": {\n \"uid\": \"${datasource}\"\n },\n \"expr\": \"trilium_last_modified_timestamp{job=~'$job',instance=~'$instance'} * 1000\",\n \"legendFormat\": \"Last Modified\",\n \"refId\": \"C\"\n }\n ],\n \"title\": \"⏰ Content Timeline\",\n \"type\": \"timeseries\"\n }\n ],\n \"preload\": false,\n \"refresh\": \"1m\",\n \"schemaVersion\": 41,\n \"tags\": [\n \"trilium\",\n \"notes\",\n \"monitoring\",\n \"enhanced\"\n ],\n \"templating\": {\n \"list\": [\n {\n \"current\": {\n \"text\": \"myprom\",\n \"value\": \"PA04845DA3A4B088E\"\n },\n \"includeAll\": false,\n \"label\": \"Datasource\",\n \"name\": \"datasource\",\n \"options\": [],\n \"query\": \"prometheus\",\n \"refresh\": 1,\n \"regex\": \"//\",\n \"type\": \"datasource\"\n },\n {\n \"allValue\": \".*\",\n \"current\": {\n \"text\": \"All\",\n \"value\": \"$__all\"\n },\n \"datasource\": {\n \"UID\": \"\",\n \"type\": \"\"\n },\n \"includeAll\": true,\n \"label\": \"Job\",\n \"multi\": true,\n \"name\": \"job\",\n \"options\": [],\n \"query\": \"query_result(up)\",\n \"refresh\": 1,\n \"regex\": \"/job=\\\"([^\\\"]+)\\\"/\",\n \"sort\": 1,\n \"type\": \"query\"\n },\n {\n \"allValue\": \".*\",\n \"current\": {\n \"text\": [\n \"All\"\n ],\n \"value\": [\n \"$__all\"\n ]\n },\n \"datasource\": {\n \"type\": \"prometheus\",\n \"uid\": \"${datasource}\"\n },\n \"includeAll\": true,\n \"label\": \"Instance\",\n \"multi\": true,\n \"name\": \"instance\",\n \"options\": [],\n \"query\": \"trilium_database_size_bytes\",\n \"refresh\": 1,\n \"regex\": \"/instance=\\\"([^\\\"]+)\\\"/\",\n \"sort\": 1,\n \"type\": \"query\"\n }\n ]\n },\n \"time\": {\n \"from\": \"now-1h\",\n \"to\": \"now\"\n },\n \"timepicker\": {},\n \"timezone\": \"browser\",\n \"title\": \"TriliumNext Dashboard\",\n \"uid\": \"06993f9b-a477-4723-bf18-47743393b382\",\n \"version\": 5\n}",
diff --git a/docs/User Guide/User Guide/Advanced Usage/Internal API/API Reference.md b/docs/User Guide/User Guide/Advanced Usage/Internal API/API Reference.md
index 4b11283a27..2992e2ad96 100644
--- a/docs/User Guide/User Guide/Advanced Usage/Internal API/API Reference.md
+++ b/docs/User Guide/User Guide/Advanced Usage/Internal API/API Reference.md
@@ -1849,6 +1849,54 @@ Note tree structure and branches
**Responses**
+=== "200: Note cloned"
+
+ * `application/json`: [`Branch`](#schema-Branch)
+
+ <div class="trilium-multicolumn-layout" data-trilium-column-ratios="1-1">
+ <div class="trilium-multicolumn-column">
+
+ | Property | Description |
+ | --- | --- |
+ | `branchId` <br>_required_ | `string` <br>Branch ID (parentNoteId\_noteId) |
+ | `noteId` <br>_required_ | `string` |
+ | `parentNoteId` <br>_required_ | `string` |
+ | `notePosition` <br>_required_ | `integer` |
+ | `prefix` | `string \| null` |
+ | `isExpanded` | `boolean` |
+
+ </div>
+ <div class="trilium-multicolumn-column">
+
+ ```json
+ {
+ "branchId": "string",
+ "noteId": "string",
+ "parentNoteId": "string",
+ "notePosition": 0,
+ "prefix": "string",
+ "isExpanded": true
+ }
+ ```
+
+ </div>
+ </div>
+
+### Clone note before branch
+
+`PUT /api/notes/{noteId}/clone-before/{beforeBranchId}` · `cloneBeforeBranch`
+
+**Authorization**: `sessionAuth` or `tokenAuth`
+
+**Path parameters**
+
+| Name | Description |
+| --- | --- |
+| `noteId` <br>_required_ | `string` <br>12-character note ID |
+| `beforeBranchId` <br>_required_ | `string` |
+
+**Responses**
+
=== "200: Note cloned"
* `application/json`: [`Branch`](#schema-Branch)
diff --git a/docs/User Guide/User Guide/Basic Concepts and Features/UI Elements/Launch Bar.md b/docs/User Guide/User Guide/Basic Concepts and Features/UI Elements/Launch Bar.md
index b3d7e9df4d..b4f1af5913 100644
--- a/docs/User Guide/User Guide/Basic Concepts and Features/UI Elements/Launch Bar.md
+++ b/docs/User Guide/User Guide/Basic Concepts and Features/UI Elements/Launch Bar.md
@@ -42,6 +42,15 @@ Similarly, to remove it from the launch bar, simply look for it in _Visible Laun
Drag-and-drop the items in the tree in order to change their order. See <a class="reference-link" href="Note%20Tree.md">Note Tree</a> for more interaction options, including using keyboard shortcuts.
+### Adding a note by drag and drop
+
+To add a note to the launch bar, drag it from the <a class="reference-link" href="Note%20Tree.md">Note Tree</a> onto the launch bar. A line between the launchers shows where the note will be placed. If the launch bar is scrollable, hold the note near either end to scroll it. Dropping the note adds a button with the note's title and icon, which opens the note when clicked.
+
+* Several notes selected in the tree can be dropped at once; they keep their order.
+* A note that is already on the launch bar, or a launcher dragged from the _Available Launchers_ section, is moved to the new place instead of being added again.
+
+The button is a clone of the note in the _Visible Launchers_ section (see <a class="reference-link" href="../Notes/Cloning%20Notes.md">Cloning Notes</a>), so it always shows the note's current title and icon. Right click it and select _Remove from launch bar_ to move it to the _Available Launchers_, like any other launcher; the note itself stays where it is in the tree.
+
## Customizing the launcher
* The icon of a launcher can be changed just like a normal note. See [note icons](../Notes/Note%20Icons%20%26%20Colors.md) for more information.
diff --git a/packages/trilium-core/src/routes/api/cloning.spec.ts b/packages/trilium-core/src/routes/api/cloning.spec.ts
index c07fcdd996..b9ee90ee8b 100644
--- a/packages/trilium-core/src/routes/api/cloning.spec.ts
+++ b/packages/trilium-core/src/routes/api/cloning.spec.ts
@@ -165,6 +165,45 @@ describe("Cloning API (core)", () => {
});
});
+ describe("clone-before", () => {
+ it("clones a note before an existing sibling branch", async () => {
+ const host = await createTextNote(api, { title: "Clone-before host" });
+ const sibling = await createTextNote(api, {
+ parentNoteId: host.noteId,
+ title: "Existing sibling"
+ });
+ const child = await createTextNote(api, { title: "Before cloneable" });
+
+ const res = await api.put<CloneResult>(
+ `/api/notes/${child.noteId}/clone-before/${sibling.branchId}`
+ );
+
+ expect(res.status).toBe(200);
+ expect(res.body.success).toBe(true);
+ expect(branchRow(res.body.branchId ?? "")).toMatchObject({
+ noteId: child.noteId,
+ parentNoteId: host.noteId,
+ isDeleted: 0
+ });
+ expect(getSql().getColumn<string>(/*sql*/`
+ SELECT noteId FROM branches
+ WHERE parentNoteId = ? AND isDeleted = 0
+ ORDER BY notePosition`, [ host.noteId ])).toEqual([ child.noteId, sibling.noteId ]);
+ });
+
+ it("reports failure for a missing before-branch", async () => {
+ const child = await createTextNote(api, { title: "Before missing" });
+
+ const res = await api.put<CloneResult>(
+ `/api/notes/${child.noteId}/clone-before/missingBefore123`
+ );
+
+ expect(res.status).toBe(200);
+ expect(res.body.success).toBe(false);
+ expect(res.body.message).toBeTruthy();
+ });
+ });
+
describe("toggle-in-parent", () => {
it("adds and then removes a note from a parent", async () => {
const child = await createTextNote(api, { title: "Toggleable" });
diff --git a/packages/trilium-core/src/routes/api/cloning.ts b/packages/trilium-core/src/routes/api/cloning.ts
index a9b9405ae0..4af31f6c7c 100644
--- a/packages/trilium-core/src/routes/api/cloning.ts
+++ b/packages/trilium-core/src/routes/api/cloning.ts
@@ -22,6 +22,12 @@ function cloneNoteAfter(req: Request<{ noteId: string; afterBranchId: string }>)
return cloningService.cloneNoteAfter(noteId, afterBranchId);
}
+function cloneNoteBefore(req: Request<{ noteId: string; beforeBranchId: string }>) {
+ const { noteId, beforeBranchId } = req.params;
+
+ return cloningService.cloneNoteBefore(noteId, beforeBranchId);
+}
+
function toggleNoteInParent(req: Request<{ noteId: string; parentNoteId: string; present: string }>) {
const { noteId, parentNoteId, present } = req.params;
@@ -32,5 +38,6 @@ export default {
cloneNoteToBranch,
cloneNoteToParentNote,
cloneNoteAfter,
+ cloneNoteBefore,
toggleNoteInParent
};
diff --git a/packages/trilium-core/src/routes/index.ts b/packages/trilium-core/src/routes/index.ts
index 75afc3a7d3..b89a690008 100644
--- a/packages/trilium-core/src/routes/index.ts
+++ b/packages/trilium-core/src/routes/index.ts
@@ -265,6 +265,8 @@ export function buildSharedApiRoutes({ route, asyncRoute, asyncRouteWithoutTrans
apiRoute(PUT, "/api/notes/:noteId/toggle-in-parent/:parentNoteId/:present", cloningApiRoute.toggleNoteInParent);
apiRoute(PUT, "/api/notes/:noteId/clone-to-note/:parentNoteId", cloningApiRoute.cloneNoteToParentNote);
apiRoute(PUT, "/api/notes/:noteId/clone-after/:afterBranchId", cloningApiRoute.cloneNoteAfter);
+ apiRoute(PUT, "/api/notes/:noteId/clone-before/:beforeBranchId",
+ cloningApiRoute.cloneNoteBefore);
asyncApiRoute(GET, "/api/special-notes/inbox/:date", specialNotesRoute.getInboxNote);
apiRoute(GET, "/api/special-notes/inbox-target", specialNotesRoute.getInboxTarget);
diff --git a/packages/trilium-core/src/services/cloning.spec.ts b/packages/trilium-core/src/services/cloning.spec.ts
index 51a62b2ca5..324ba58332 100644
--- a/packages/trilium-core/src/services/cloning.spec.ts
+++ b/packages/trilium-core/src/services/cloning.spec.ts
@@ -306,4 +306,76 @@ describe("cloning service (real DB)", () => {
expect(typeof res.message).toBe("string");
});
});
+
+ describe("cloneNoteBefore", () => {
+ /** The notes under the parent, in the order of their stored positions. */
+ function childOrder(parentNoteId: string) {
+ return getSql().getColumn<string>(/*sql*/`
+ SELECT noteId FROM branches
+ WHERE parentNoteId = ? AND isDeleted = 0
+ ORDER BY notePosition`, [ parentNoteId ]);
+ }
+
+ function branchIdOf({ branch }: { branch: BBranch }) {
+ if (!branch.branchId) {
+ throw new Error("The created branch has no ID.");
+ }
+ return branch.branchId;
+ }
+
+ it("clones the note right before the reference branch", () => {
+ const parent = createNote("root");
+ const first = createNote(parent.note.noteId);
+ const second = createNote(parent.note.noteId);
+ const source = createNote("root");
+
+ const res = getContext().init(() =>
+ cloningService.cloneNoteBefore(source.note.noteId, branchIdOf(second))
+ );
+
+ expect(res.success).toBe(true);
+ const branchId = "branchId" in res ? res.branchId : undefined;
+ expect(becca.getBranch(branchId ?? "")?.parentNoteId).toBe(parent.note.noteId);
+ expect(childOrder(parent.note.noteId))
+ .toEqual([ first.note.noteId, source.note.noteId, second.note.noteId ]);
+ });
+
+ it("keeps the order of several notes cloned before the same branch", () => {
+ const parent = createNote("root");
+ const reference = createNote(parent.note.noteId);
+ const a = createNote("root");
+ const b = createNote("root");
+
+ getContext().init(() => {
+ cloningService.cloneNoteBefore(a.note.noteId, branchIdOf(reference));
+ cloningService.cloneNoteBefore(b.note.noteId, branchIdOf(reference));
+ });
+
+ expect(childOrder(parent.note.noteId))
+ .toEqual([ a.note.noteId, b.note.noteId, reference.note.noteId ]);
+ // becca agrees with the database, which the next clone or move relies on.
+ const beccaOrder = becca.getNoteOrThrow(parent.note.noteId).getChildBranches()
+ .sort((x, y) => x.notePosition - y.notePosition)
+ .map((branch) => branch.noteId);
+ expect(beccaOrder).toEqual(childOrder(parent.note.noteId));
+ });
+
+ it("refuses what cloning after refuses", () => {
+ const source = createNote("root");
+ const parent = createNote("root");
+ const existing = createNote(parent.note.noteId);
+
+ expect(cloningService.cloneNoteBefore("root", branchIdOf(existing))).toMatchObject({
+ success: false,
+ message: "Cloning the note 'root' is forbidden."
+ });
+ expect(cloningService.cloneNoteBefore(source.note.noteId, "missing123")).toMatchObject({
+ success: false,
+ message: "Branch 'missing123' does not exist."
+ });
+ // Already under the parent, which validateParentChild() rejects.
+ const res = cloningService.cloneNoteBefore(existing.note.noteId, branchIdOf(existing));
+ expect(res.success).toBe(false);
+ });
+ });
});
diff --git a/packages/trilium-core/src/services/cloning.ts b/packages/trilium-core/src/services/cloning.ts
index 741723bfa7..22b80c6418 100644
--- a/packages/trilium-core/src/services/cloning.ts
+++ b/packages/trilium-core/src/services/cloning.ts
@@ -125,29 +125,44 @@ function toggleNoteInParent(present: boolean, noteId: string, parentNoteId: stri
}
function cloneNoteAfter(noteId: string, afterBranchId: string) {
+ return cloneNoteNextToBranch(noteId, afterBranchId, "after");
+}
+
+/** Clones the note into the parent of `beforeBranchId`, placed right before that branch. */
+function cloneNoteBefore(noteId: string, beforeBranchId: string) {
+ return cloneNoteNextToBranch(noteId, beforeBranchId, "before");
+}
+
+function cloneNoteNextToBranch(noteId: string, siblingBranchId: string, side: "before" | "after") {
if (["_hidden", "root"].includes(noteId)) {
return { success: false, message: `Cloning the note '${noteId}' is forbidden.` };
}
- const afterBranch = becca.getBranch(afterBranchId);
+ const siblingBranch = becca.getBranch(siblingBranchId);
- if (!afterBranch) {
- return { success: false, message: `Branch '${afterBranchId}' does not exist.` };
+ if (!siblingBranch) {
+ return { success: false, message: `Branch '${siblingBranchId}' does not exist.` };
}
- if (afterBranch.noteId === "_hidden") {
- return { success: false, message: "Cannot clone after the hidden branch." };
+ if (siblingBranch.noteId === "_hidden") {
+ return { success: false, message: `Cannot clone ${side} the hidden branch.` };
}
- const afterNote = becca.getBranch(afterBranchId);
+ const { parentNoteId } = siblingBranch;
if (!(noteId in becca.notes)) {
- return { success: false, message: `Note to be cloned '${noteId}' is deleted or does not exist.` };
- } else if (!afterNote || !(afterNote.parentNoteId in becca.notes)) {
- return { success: false, message: `After note '${afterNote?.parentNoteId}' is deleted or does not exist.` };
+ return {
+ success: false,
+ message: `Note to be cloned '${noteId}' is deleted or does not exist.`
+ };
+ } else if (!(parentNoteId in becca.notes)) {
+ return {
+ success: false,
+ message: `Parent note '${parentNoteId}' is deleted or does not exist.`
+ };
}
- const parentNote = becca.getNote(afterNote.parentNoteId);
+ const parentNote = becca.getNote(parentNoteId);
if (!parentNote || parentNote.type === "search") {
return {
@@ -156,26 +171,37 @@ function cloneNoteAfter(noteId: string, afterBranchId: string) {
};
}
- const validationResult = treeService.validateParentChild(afterNote.parentNoteId, noteId);
+ const validationResult = treeService.validateParentChild(parentNoteId, noteId);
if (!validationResult.success) {
return validationResult;
}
+ // Before: the clone takes the sibling's position and the sibling moves down with the rest.
+ // After: the sibling stays and the clone takes the position below it.
+ const siblingPosition = siblingBranch.notePosition;
+ const notePosition = side === "after" ? siblingPosition + 10 : siblingPosition;
+ const movedPositions = side === "after" ? "notePosition > ?" : "notePosition >= ?";
+
// we don't change utcDateModified, so other changes are prioritized in case of conflict
// also we would have to sync all those modified branches otherwise hash checks would fail
- getSql().execute("UPDATE branches SET notePosition = notePosition + 10 WHERE parentNoteId = ? AND notePosition > ? AND isDeleted = 0", [afterNote.parentNoteId, afterNote.notePosition]);
+ getSql().execute(/*sql*/`
+ UPDATE branches SET notePosition = notePosition + 10
+ WHERE parentNoteId = ? AND ${movedPositions} AND isDeleted = 0`,
+ [parentNoteId, siblingPosition]);
- eventChangesService.putNoteReorderingEntityChange(afterNote.parentNoteId);
+ // Also copies the new positions into becca, which the next clone next to a sibling reads.
+ eventChangesService.putNoteReorderingEntityChange(parentNoteId);
const branch = new BBranch({
noteId: noteId,
- parentNoteId: afterNote.parentNoteId,
- notePosition: afterNote.notePosition + 10,
+ parentNoteId,
+ notePosition,
isExpanded: false
}).save();
- getLog().info(`Cloned note '${noteId}' into parent note '${afterNote.parentNoteId}' after note '${afterNote.noteId}', branch '${afterBranchId}'`);
+ getLog().info(`Cloned note '${noteId}' into parent note '${parentNoteId}' ${side} note `
+ + `'${siblingBranch.noteId}', branch '${siblingBranchId}'`);
return { success: true, branchId: branch.branchId };
}
@@ -186,5 +212,6 @@ export default {
ensureNoteIsPresentInParent,
ensureNoteIsAbsentFromParent,
toggleNoteInParent,
- cloneNoteAfter
+ cloneNoteAfter,
+ cloneNoteBefore
};