Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(etapi): require the second factor for password login
Elian Doranfcd9144fc18d
diff --git a/apps/server/spec/etapi/auth-login.spec.ts b/apps/server/spec/etapi/auth-login.spec.tsindex b5f43054a1..606920a397 100644--- a/apps/server/spec/etapi/auth-login.spec.ts+++ b/apps/server/spec/etapi/auth-login.spec.ts@@ -1,7 +1,12 @@+import { cls, options } from "@triliumnext/core";import { Application } from "express";-import { beforeAll, describe, expect, it } from "vitest";import supertest from "supertest";+import { generateConfig, Totp } from "time2fa";+import { afterAll, beforeAll, describe, expect, it } from "vitest";+import config from "../../src/services/config.js";+import recoveryCodeService from "../../src/services/encryption/recovery_codes.js";+import totp from "../../src/services/totp.js";let app: Application;@@ -45,12 +50,14 @@ describe("etapi/auth/login", () => {expect(response.body.authToken).toBeUndefined();});- it("reports a 500 when the password is missing and cannot be verified", async () => {- // No password field → verifyPassword throws → caught by the middleware.- await supertest(app)+ it("rejects a missing password and issues no token", async () => {+ const response = await supertest(app).post(LOGIN_URL).send({ tokenName: "test" })- .expect(500);+ .expect(401);++ expect(response.body.code).toBe("WRONG_PASSWORD");+ expect(response.body.authToken).toBeUndefined();});// A token must never be issued from a failed login, and even if one were, it must not@@ -69,4 +76,59 @@ describe("etapi/auth/login", () => {.expect(401);}});+ describe("with TOTP enabled", () => {+ const RECOVERY_CODE = "AAAAAAAAAAAAAAAAAAAAAA==";+ const { secret } = Totp.generateKey({ issuer: "Trilium", user: "spec" });++ beforeAll(() => {+ cls.init(() => {+ options.setOption("mfaMethod", "totp");+ totp.setSecret(secret);+ recoveryCodeService.setRecoveryCodes(RECOVERY_CODE);+ });+ });++ afterAll(() => {+ cls.init(() => {+ totp.resetTotp();+ options.setOption("totpLastUsedStep", "");+ });+ });++ function login(body: Record<string, unknown>) {+ return supertest(app).post(LOGIN_URL).send({ tokenName: "test", ...body });+ }++ it("requires the second factor and checks it after the password", async () => {+ const missing = await login({ password: CORRECT_PASSWORD }).expect(401);+ expect(missing.body.code).toBe("TOTP_REQUIRED");+ expect(missing.body.authToken).toBeUndefined();++ const wrongCode = await login({ password: CORRECT_PASSWORD, totpToken: "000000" }).expect(401);+ expect(wrongCode.body.code).toBe("WRONG_TOTP");+ expect(wrongCode.body.authToken).toBeUndefined();++ // A wrong password is reported as such and does not spend the recovery code.+ const wrongPassword = await login({ password: "wrong", totpToken: RECOVERY_CODE }).expect(401);+ expect(wrongPassword.body.code).toBe("WRONG_PASSWORD");+ });++ it("issues a token for a valid TOTP code, once", async () => {+ const [ code ] = Totp.generatePasscodes({ secret }, generateConfig());++ const response = await login({ password: CORRECT_PASSWORD, totpToken: code }).expect(201);+ expect(response.body.authToken).toBeTruthy();++ const replay = await login({ password: CORRECT_PASSWORD, totpToken: code }).expect(401);+ expect(replay.body.code).toBe("WRONG_TOTP");+ });++ it("issues a token for a recovery code, once", async () => {+ const response = await login({ password: CORRECT_PASSWORD, totpToken: RECOVERY_CODE }).expect(201);+ expect(response.body.authToken).toBeTruthy();++ const replay = await login({ password: CORRECT_PASSWORD, totpToken: RECOVERY_CODE }).expect(401);+ expect(replay.body.code).toBe("WRONG_TOTP");+ });+ });});diff --git a/apps/server/src/assets/etapi.openapi.yaml b/apps/server/src/assets/etapi.openapi.yamlindex 38701e4390..a742f2b80e 100644--- a/apps/server/src/assets/etapi.openapi.yaml+++ b/apps/server/src/assets/etapi.openapi.yaml@@ -1081,6 +1081,12 @@ paths:password:type: stringdescription: user's password used to e.g. login to Trilium server and/or protect notes+ totpToken:+ type: string+ description: the current TOTP code, or one of the recovery codes; required when multi-factor authentication with TOTP is enabled. Each code is accepted once.+ tokenName:+ type: string+ description: name of the created token, shown in the list of ETAPI tokensresponses:"201":description: auth token@@ -1091,6 +1097,12 @@ paths:authToken:type: stringexample: Bc4bFn0Ffiok_4NpbVCDnFz7B2WU+pdhW8B5Ne3DiR5wXrEyqdjgRIsk=+ "401":+ description: "wrong credentials: `WRONG_PASSWORD`, `TOTP_REQUIRED` (TOTP is enabled and no `totpToken` was sent) or `WRONG_TOTP`"+ content:+ application/json; charset=utf-8:+ schema:+ $ref: "#/components/schemas/Error""429":description: too many requestsdefault:diff --git a/apps/server/src/assets/help/help_content.json b/apps/server/src/assets/help/help_content.jsonindex a23eedebf6..1de0bde0b2 100644--- a/apps/server/src/assets/help/help_content.json+++ b/apps/server/src/assets/help/help_content.json@@ -23,7 +23,7 @@"_help_l2VkvOwUNfZj": "<p>Configuring TLS is essential for <a href=\"#root/_help_WOcw2SLH6tbX\">server installation</a> in Trilium. This guide details the steps to set up TLS within Trilium itself.</p><aside class=\"admonition tip\"><p>While Trilium supports HTTPS on its own, it's generally a good idea to use a <a href=\"#root/_help_vcjrb3VVYPZI\">reverse proxy</a> instead with TLS termination. You can follow a <a href=\"https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04\">guide like this</a> for such setups.</p></aside><h2>Obtaining a TLS Certificate</h2><p>You have two options for obtaining a TLS certificate:</p><ul><li><strong>Recommended</strong>: Obtain a TLS certificate signed by a root certificate authority. For personal use, <a href=\"https://letsencrypt.org\">Let's Encrypt</a> is an excellent choice. It is free, automated, and straightforward. Certbot can facilitate automatic TLS setup.</li><li>Generate a self-signed certificate. This option is not recommended due to the additional complexity of importing the certificate into all machines connecting to the server.</li></ul><h2>Modifying <code>config.ini</code></h2><p>Once you have your certificate, modify the <code>config.ini</code> file in the <a href=\"#root/_help_tAassRL4RSQL\">data directory</a> to configure Trilium to use it:</p><pre><code class=\"language-text-x-trilium-auto\">[Network]\nport=8080\n# Set to true for TLS/SSL/HTTPS (secure), false for HTTP (insecure).\nhttps=true\n# Path to the certificate (run \"bash bin/generate-cert.sh\" to generate a self-signed certificate).\n# Relevant only if https=true\ncertPath=/[username]/.acme.sh/[hostname]/fullchain.cer\nkeyPath=/[username]/.acme.sh/[hostname]/example.com.key</code></pre><p>You can also review the <a href=\"#root/_help_Gzjqa934BdH4\">configuration</a> file to provide all <code>config.ini</code> values as environment variables instead. For example, you can configure TLS using environment variables:</p><pre><code class=\"language-text-x-trilium-auto\">export TRILIUM_NETWORK_HTTPS=true\nexport TRILIUM_NETWORK_CERTPATH=/path/to/cert.pem\nexport TRILIUM_NETWORK_KEYPATH=/path/to/key.pem</code></pre><p>The above example shows how this is set up in an environment where the certificate was generated using Let's Encrypt's ACME utility. Your paths may differ. For Docker installations, ensure these paths are within a volume or another directory accessible by the Docker container, such as <code>/home/node/trilium-data/[DIR IN DATA DIRECTORY]</code>.</p><p>After configuring <code>config.ini</code>, restart Trilium and access the hostname using \"https\".</p><h2>Self-Signed Certificate</h2><p>If you opt to use a self-signed certificate for your server instance, note that the desktop instance will not trust it by default.</p><p>To bypass this, disable certificate validation by setting the following environment variable (for Linux):</p><pre><code class=\"language-text-x-trilium-auto\">export NODE_TLS_REJECT_UNAUTHORIZED=0\ntrilium</code></pre><p>Trilium provides scripts to start in this mode, such as <code>trilium-no-cert-check.bat</code> for Windows.</p><p><strong>Warning</strong>: Disabling TLS certificate validation is insecure. Proceed only if you fully understand the implications.</p>","_help_0hzsNCP31IAB": "<h2>Disabling authentication</h2><p>If you are running Trilium on <code>localhost</code> only or if authentication is handled by another component, you can disable Trilium’s authentication by adding the following to <code>config.ini</code>:</p><pre><code class=\"language-text-x-trilium-auto\">[General]\nnoAuthentication=true</code></pre><p>Disabling authentication will bypass even the <a class=\"reference-link\" href=\"#root/_help_7DAiwaf8Z7Rz\">Multi-Factor Authentication</a> since v0.94.1.</p><h2>Brute-force protection</h2><p>Trilium limits each IP address to 10 failed sign-in attempts in 15 minutes. Once an address reaches the limit, Trilium rejects every further attempt from it, including correct ones, until the 15 minutes have passed. The sign-in page then shows <em>Too many login attempts</em>; other clients receive HTTP status 429.</p><p>The limit applies to every way of signing in with the password:</p><ul><li>The sign-in page.</li><li>Setting up <a class=\"reference-link\" href=\"#root/_help_cbkrhQjrkKrh\">Synchronization</a> from a desktop or mobile app.</li><li>Connecting the <a class=\"reference-link\" href=\"#root/_help_MtPxeAWVAzMg\">Web Clipper</a> or the Android sender app.</li><li>Requesting a token through <a class=\"reference-link\" href=\"#root/_help_pgxEVkzLl1OP\">ETAPI (REST API)</a>.</li></ul><p>All of these count toward the same limit, and a wrong password, a wrong one-time password and a wrong recovery code each count as one failed attempt. Successful sign-ins are not counted.</p><p>The limit is per IP address, not per account, so an attacker cannot lock you out by failing to sign in from their own address. The count is kept in memory: restarting the server clears it.</p><aside class=\"admonition important\"><p>Behind a reverse proxy, Trilium sees every request as coming from the proxy unless it is configured as a <a class=\"reference-link\" href=\"#root/_help_LLzSMXACKhUs\">Trusted proxy</a>. All clients then share a single limit, so a few wrong attempts from anyone block everyone.</p></aside><h3>Blocking repeated failures with fail2ban</h3><p>A failed attempt on the sign-in page is answered with HTTP status 401 and recorded in the <a class=\"reference-link\" href=\"#root/_help_bnyigUA2UK7s\">Backend (server) logs</a> as:</p><pre><code class=\"language-text-x-trilium-auto\">WARNING: Wrong password from 203.0.113.7, rejecting.</code></pre><p>When <a class=\"reference-link\" href=\"#root/_help_7DAiwaf8Z7Rz\">Multi-Factor Authentication</a> is enabled, a wrong one-time password or recovery code is logged as <code>Wrong totp</code> instead. Tools such as fail2ban can match either the log line or the 401 responses to <code>POST /login</code> in the reverse proxy's access log to block an address for longer than 15 minutes.</p><h2>Understanding how the session works</h2><p>Once logged into Trilium, the application will store this information about the login into a cookie on the browser, but also as a session on the server.</p><p>If “Remember me” is checked, then the login will expire in 21 days. This period can be adjusted by modifying the <code>Session.cookieMaxAge</code> value in <code>config.ini</code>. For example, to have the session expire in one day:</p><pre><code class=\"language-text-x-trilium-auto\">[Session]\ncookieMaxAge=86400</code></pre><p>When “Remember me” is unchecked, the behavior is different. At client/browser level the authentication does not have any expiration date, but it will be automatically cleared as soon as the user closes the browser. Nevertheless, the server will also dismiss this authentication in around 24 hours from the <em>last interaction with the application</em>.</p><h2>Viewing active sessions</h2><p>The login sessions are now stored in the same <a class=\"reference-link\" href=\"#root/_help_wX4HbRucYSDD\">Database</a> as the user data. In order to view which sessions are active, open the <a class=\"reference-link\" href=\"#root/_help_YKWqdJhzi2VY\">SQL Console</a> and run the following query:</p><pre><code class=\"language-text-x-trilium-auto\">SELECT * FROM sessions</code></pre><p>Expired sessions are periodically cleaned by the server, generally an hourly interval.</p><h2>See also</h2><ul><li><a class=\"reference-link\" href=\"#root/_help_7DAiwaf8Z7Rz\">Multi-Factor Authentication</a></li><li><a class=\"reference-link\" href=\"#root/_help_LLzSMXACKhUs\">Trusted proxy</a></li></ul>","_help_lwAX5SvbrK2g": "<aside class=\"admonition important\"><p>If you forget your password:</p><ul><li>Protected notes are irretrievable without the password.</li><li>Unprotected notes can be recovered.</li></ul></aside><p>There are two options, both involving access to the device that is running your server.</p><h3>By disabling authentication</h3><ol><li>See <a class=\"reference-link\" href=\"#root/_help_0hzsNCP31IAB\">Authentication</a> on how to disable the authentication.</li><li>Restart the server.</li><li>Go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → Password → Reset password.</li><li>Re-enable authentication by following step (1) in reverse.</li><li>Restart the server.</li><li>Log in with the new password.</li></ol><h3>By altering the database</h3><ol><li><p>Access the <a href=\"#root/_help_wX4HbRucYSDD\">database</a> file in the <a href=\"#root/_help_tAassRL4RSQL\">data directory</a>. Open the <code>document.db</code> file with an SQLite client (e.g., <a href=\"https://sqlitebrowser.org/\">DB Browser</a>).</p></li><li><p>Execute the following queries:</p><pre><code class=\"language-text-x-trilium-auto\">UPDATE options SET value = '77/twC5O00cuQgNC63VK32qOKKYwj21ev3jZDXoytVU=' WHERE name = 'passwordVerificationSalt';\nUPDATE options SET value = '710BMasZCAgibzIc07X4P9Q4TeBd4ONnqJOho+pWcBM=' WHERE name = 'passwordDerivedKeySalt';\nUPDATE options SET value = 'Eb8af1/T57b89lCRuS97tPEl4CwxsAWAU7YNJ77oY+s=' WHERE name = 'passwordVerificationHash';\nUPDATE options SET value = 'QpC8XoiYYeqHPtHKRtbNxfTHsk+pEBqVBODYp0FkPBa22tlBBKBMigdLu5GNX8Uu' WHERE name = 'encryptedDataKey';</code></pre></li><li><p>After executing the changes, commit/write the changes. <strong>This sets the password to</strong> <code>**password**</code><strong>, allowing you to log in again.</strong></p></li><li><p>Go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password</em> → <em>Change password</em> and replace the unsafe password.</p></li></ol><h2>Handling protected notes</h2><p>When the password is reset, the protected notes are permanently lost due to the fact that they are encrypted with your password so there is no way for Trilium to recover them.</p><p>For pre-existing protected notes (now unrecoverable), consider deleting them or exporting the unprotected notes. Then, delete <code>document.db</code> and start fresh.</p>",- "_help_7DAiwaf8Z7Rz": "<p>Multi-factor authentication (MFA) is a security process that requires users to provide two or more verification factors to gain access to a system, application, or account. This adds an extra layer of protection beyond just using a password.</p><p>By requiring more than one verification method, MFA helps reduce the risk of unauthorized access, even if someone has obtained your password. It’s highly recommended for securing sensitive information stored in your notes.</p><h2>Relationship to OpenID Connect (OIDC)</h2><p>Multi-factor authentication makes your Trilium login safer by requiring an additional proof of identity apart from your password. <a class=\"reference-link\" href=\"#root/_help_x1lQNKQBqLcA\">Signing in with OpenID Connect</a> is a different concept which delegates your authentication to an external provider (e.g. your Google provider, or a self-hosted one such as Authelia). These authentication providers might provide their own security features such as TOTP or passkeys.</p><h2>Time-based one-time password (TOTP)</h2><p>TOTP (Time-Based One-Time Password) is a security feature that generates a unique, temporary code on your device, like a smartphone, which changes every 30 seconds. You use this code, along with your password, to log into your account, making it much harder for anyone else to access them.</p><ol><li>Go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password & Auth.</em></li><li>Make sure <em>Sign-in with</em> has <em>Local password</em> selected.</li><li>In the <em>Two-factor authentication</em> section, press <em>Set up.</em></li><li>Scan the QR code or manually enter the code in your authenticator app.</li><li>Enter the verification code from your authenticator app to confirm that the setup was successful and press <em>Verify & continue</em>.</li><li>Save the recovery codes, then tick the confirmation and press <em>Finish setup</em>.</li><li>Re-login will be required after TOTP setup is finished (after refreshing the page).</li></ol><h2>Signing in</h2><p>Once TOTP is enabled, the sign-in page asks for the code from your authenticator app in <em>One-time password or recovery code</em>, below the password.</p><p>Trilium accepts the code for the current 30-second period as well as the periods just before and after it, so a clock that is slightly off on either side still works. Since v0.106.0, each code is accepted only once: after a successful sign-in, that code and any older one are rejected, even while they are still valid.</p><p>A wrong one-time password counts toward the same limit of failed attempts as a wrong password. See <em>Brute-force protection</em> in <a class=\"reference-link\" href=\"#root/_help_0hzsNCP31IAB\">Authentication</a>.</p><h2>Connecting a device to the server</h2><p>Once TOTP is enabled, connecting a new desktop or mobile app to the server through <a class=\"reference-link\" href=\"#root/_help_cbkrhQjrkKrh\">Synchronization</a> also asks for the second factor. On the <em>Connect to an existing server</em> screen, enter a one-time password or a recovery code in <em>One-time password or recovery code</em>, below the server's password. Without it, the server refuses to set up the sync.</p><p>The second factor is only asked for when a device is first connected. A device that is already set up keeps syncing without it.</p><aside class=\"admonition note\"><p>Versions prior to v0.107.0 do not ask for the second factor when setting up the sync. Update the desktop and mobile apps along with the server, since older apps have no field to send it.</p></aside><h2>Recovery codes</h2><p>Recovery codes can be used in place of the TOTP if you lose access to your authenticator. Trilium provides 8 different recovery codes, each recovery code can be used once.</p><p>To use a recovery code, simply login with your password and use the recovery code as the security token.</p><p>The initial set of recovery codes is generated when setting up your TOTP for the first time. They can be regenerated at any time by going to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password & Auth</em> and pressing the <em>Regenerate recovery codes</em> button. This will generate a new set of recovery codes while at the same time disabling the previous ones.</p>",+ "_help_7DAiwaf8Z7Rz": "<p>Multi-factor authentication (MFA) is a security process that requires users to provide two or more verification factors to gain access to a system, application, or account. This adds an extra layer of protection beyond just using a password.</p><p>By requiring more than one verification method, MFA helps reduce the risk of unauthorized access, even if someone has obtained your password. It’s highly recommended for securing sensitive information stored in your notes.</p><h2>Relationship to OpenID Connect (OIDC)</h2><p>Multi-factor authentication makes your Trilium login safer by requiring an additional proof of identity apart from your password. <a class=\"reference-link\" href=\"#root/_help_x1lQNKQBqLcA\">Signing in with OpenID Connect</a> is a different concept which delegates your authentication to an external provider (e.g. your Google provider, or a self-hosted one such as Authelia). These authentication providers might provide their own security features such as TOTP or passkeys.</p><h2>Time-based one-time password (TOTP)</h2><p>TOTP (Time-Based One-Time Password) is a security feature that generates a unique, temporary code on your device, like a smartphone, which changes every 30 seconds. You use this code, along with your password, to log into your account, making it much harder for anyone else to access them.</p><ol><li>Go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password & Auth.</em></li><li>Make sure <em>Sign-in with</em> has <em>Local password</em> selected.</li><li>In the <em>Two-factor authentication</em> section, press <em>Set up.</em></li><li>Scan the QR code or manually enter the code in your authenticator app.</li><li>Enter the verification code from your authenticator app to confirm that the setup was successful and press <em>Verify & continue</em>.</li><li>Save the recovery codes, then tick the confirmation and press <em>Finish setup</em>.</li><li>Re-login will be required after TOTP setup is finished (after refreshing the page).</li></ol><h2>Signing in</h2><p>Once TOTP is enabled, the sign-in page asks for the code from your authenticator app in <em>One-time password or recovery code</em>, below the password.</p><p>Trilium accepts the code for the current 30-second period as well as the periods just before and after it, so a clock that is slightly off on either side still works. Since v0.106.0, each code is accepted only once: after a successful sign-in, that code and any older one are rejected, even while they are still valid.</p><p>A wrong one-time password counts toward the same limit of failed attempts as a wrong password. See <em>Brute-force protection</em> in <a class=\"reference-link\" href=\"#root/_help_0hzsNCP31IAB\">Authentication</a>.</p><h2>Connecting a device to the server</h2><p>Once TOTP is enabled, connecting a new desktop or mobile app to the server through <a class=\"reference-link\" href=\"#root/_help_cbkrhQjrkKrh\">Synchronization</a> also asks for the second factor. On the <em>Connect to an existing server</em> screen, enter a one-time password or a recovery code in <em>One-time password or recovery code</em>, below the server's password. Without it, the server refuses to set up the sync.</p><p>The second factor is only asked for when a device is first connected. A device that is already set up keeps syncing without it.</p><aside class=\"admonition note\"><p>Versions prior to v0.107.0 do not ask for the second factor when setting up the sync. Update the desktop and mobile apps along with the server, since older apps have no field to send it.</p></aside><h2>Obtaining an ETAPI token with a password</h2><p>Once TOTP is enabled, obtaining a token for the <a class=\"reference-link\" href=\"#root/_help_pgxEVkzLl1OP\">ETAPI (REST API)</a> through the <code>/auth/login</code> call also requires the second factor: send the one-time password or a recovery code as <code>totpToken</code>, next to <code>password</code>. Each code is accepted only once.</p><p>For scripts and tools that run unattended, create a token in <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>ETAPI</em> instead. Such a token works regardless of TOTP.</p><aside class=\"admonition warning\"><p>Versions prior to v0.107.0 issue an ETAPI token for the password alone, even with TOTP enabled.</p></aside><h2>Recovery codes</h2><p>Recovery codes can be used in place of the TOTP if you lose access to your authenticator. Trilium provides 8 different recovery codes, each recovery code can be used once.</p><p>To use a recovery code, simply login with your password and use the recovery code as the security token.</p><p>The initial set of recovery codes is generated when setting up your TOTP for the first time. They can be regenerated at any time by going to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password & Auth</em> and pressing the <em>Regenerate recovery codes</em> button. This will generate a new set of recovery codes while at the same time disabling the previous ones.</p>","_help_x1lQNKQBqLcA": "<p>OpenID is a standardized way to let you log into websites using an account from another service, like Google or Authelia, to verify your identity.</p><p>When OpenID is activated, the password-based authentication in Trilium is replaced with a button that connects using your provider. This means that the configuration of <a class=\"reference-link\" href=\"#root/_help_7DAiwaf8Z7Rz\">Multi-factor authentication with TOTP</a> no longer takes effect, since your provider has to handle any multi-factor authentication.</p><h2>Setup</h2><p>Setting up authentication with OpenID connect is a two-step process:</p><ol><li>First the Trilium server must be configured with information about your authentication provider such as the URL, client ID and secret.</li><li>Second, the user must connect from options to create a link between the account on the provider and the one Trilium has.</li></ol><h3>Configuring the authentication provider</h3><ol><li><p>First, make sure the authentication provider (e.g. Google, Authelia) is configured properly. See <a class=\"reference-link\" href=\"#root/_help_IgkTHSaFfq6A\">Setting up with various providers</a> for concrete examples.</p><ol><li>The redirect URL of Trilium is <code>https://<your-trilium-domain>/callback</code>.</li><li>You should obtain the base URL, client ID and client secret.</li></ol></li><li><p>Set the following information using <a class=\"reference-link\" href=\"#root/_help_Gzjqa934BdH4\">Configuration (config.ini or environment variables)</a>:</p><figure class=\"table\"><table><thead><tr><th>Configuration</th><th><code>config.ini</code> in <code>[MultiFactorAuthentication]</code> section</th><th>Environment variable</th><th>Description</th></tr></thead><tbody><tr><td>Base URL*</td><td><code>oauthBaseUrl</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHBASEURL</code></td><td>The URL of your Trilium instance (e.g. <code>https://example.com</code>).</td></tr><tr><td>Client ID*</td><td><code>oauthClientId</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTID</code></td><td>The client ID from your provider configuration.</td></tr><tr><td>Client Secret*</td><td><code>oauthClientSecret</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTSECRET</code></td><td>The client secret from your provider configuration.</td></tr><tr><td>Client auth method</td><td><code>oauthClientAuthMethod</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHCLIENTAUTHMETHOD</code></td><td>Token-endpoint auth method: <code>client_secret_basic</code> or <code>client_secret_post</code>. Empty auto-detects. Only needed if sign-in fails with a <code>WWW-Authenticate</code> or <code>invalid_client</code> error.</td></tr><tr><td>ID token algorithm</td><td><code>oauthIdTokenSigningAlg</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHIDTOKENSIGNINGALG</code></td><td><span style=\"color:rgb(32,32,32);\">The algorithm your provider signs ID tokens with, e.g.</span> <code>RS256</code><span style=\"color:rgb(32,32,32);\">,</span> <code>EdDSA</code><span style=\"color:rgb(32,32,32);\">,</span> <code>ES256</code><span style=\"color:rgb(32,32,32);\">. Empty auto-detects from the provider. Only needed if sign-in fails with an</span> <code>unexpected JWT alg</code> <span style=\"color:rgb(32,32,32);\">error.</span></td></tr></tbody></table></figure><p>Asterisk (*) marks a required field</p></li><li><p>The default OAuth issuer is Google. To use other services such as Authentik or Auth0, you can configure the settings via <code>oauthIssuerBaseUrl</code>, <code>oauthIssuerName</code>, and <code>oauthIssuerIcon</code> in the <code>config.ini</code> file. Alternatively, these values can be set using environment variables:</p><figure class=\"table\"><table><thead><tr><th>Configuration</th><th><code>config.ini</code> in <code>[MultiFactorAuthentication]</code> section</th><th>Environment variable</th><th>Description</th></tr></thead><tbody><tr><td>Issuer base URL</td><td><code>oauthIssuerBaseUrl</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERBASEURL</code></td><td>Either the issuer itself (<code>https://auth.example.com</code>) or a full discovery URL (<code>https://auth.example.com/.well-known/openid-configuration</code>). <br> <br>A URL containing <code>/.well-known/</code> is used as-is<span style=\"color:rgb(32,32,32);\">, which is convenient when your provider hands you a discovery URL to copy. A trailing slash may be included or omitted; Trilium matches whichever spelling the provider advertises.</span> <br> <br>Use the full form when your provider advertises an issuer that differs from the path serving its discovery document, such as Authentik in \"global\" issuer mode.</td></tr><tr><td>Issuer name</td><td><code>oauthIssuerName</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERNAME</code></td><td>The name of your authentication provider, used for reference on the login screen and in settings. Default is “Google”.</td></tr><tr><td>Issuer icon</td><td><code>oauthIssuerIcon</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHISSUERICON</code></td><td>Optionally, the URL to a logo of the provider. By default it will try to obtain the favicon from the website, so it's optional.</td></tr></tbody></table></figure><p>All the fields here are optional, since the default OAuth issuer is Google.</p></li><li><p>Optionally, tune the following advanced settings. All are optional and have sensible defaults:</p><figure class=\"table\"><table><thead><tr><th>Configuration</th><th><code>config.ini</code> in <code>[MultiFactorAuthentication]</code> section</th><th>Environment variable</th><th>Description</th></tr></thead><tbody><tr><td>HTTP timeout</td><td><code>oauthHttpTimeout</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHHTTPTIMEOUT</code></td><td>Timeout in milliseconds for the provider HTTP requests (discovery, token exchange, userinfo). Defaults to <code>30000</code> (30s). Raise this if your provider cold-starts slowly and you are occasionally asked to sign in twice. Minimum accepted value is <code>500</code>.</td></tr><tr><td>Scopes</td><td><code>oauthScope</code></td><td><code>TRILIUM_MULTIFACTORAUTHENTICATION_OAUTHSCOPE</code></td><td>Space-separated list of OIDC scopes requested at login. Defaults to <code>openid profile email</code>. <code>openid</code> is required and is prepended automatically if you omit it.</td></tr></tbody></table></figure><p>The OIDC session lifetime is automatically bound to Trilium's own session cookie lifetime (the <code>cookieMaxAge</code> setting in the <code>[Session]</code> section, 21 days by default), so a single sign-in stays valid for as long as your Trilium session does rather than expiring early on the OIDC library's shorter internal defaults.</p></li><li><p>Restart the server so that the changes are applied.</p></li></ol><aside class=\"admonition note\"><p>Legacy environment variables are also supported: <code>TRILIUM_OAUTH_BASE_URL</code>, <code>TRILIUM_OAUTH_CLIENT_ID</code>, <code>TRILIUM_OAUTH_CLIENT_SECRET</code>, and for customizing the provider: <code>TRILIUM_OAUTH_ISSUER_BASE_URL</code>, <code>TRILIUM_OAUTH_ISSUER_NAME</code>, <code>TRILIUM_OAUTH_ISSUER_ICON</code>, <code>TRILIUM_OAUTH_HTTP_TIMEOUT</code>, <code>TRILIUM_OAUTH_SCOPE</code>, <code>TRILIUM_OAUTH_CLIENT_AUTH_METHOD</code>, <code>TRILIUM_OAUTH_ID_TOKEN_SIGNING_ALG</code>.</p></aside><h2>Connecting to the authentication provider</h2><p>Once the server has been configured at the previous step, the next step is to create a link between your account on the authentication provider and the Trilium instance. This makes sure that only you can access the Trilium instance, and not just any other valid account.</p><p>To do so:</p><ol><li>Go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password & Auth.</em></li><li>In the <em>Sign-in with</em> field, choose <em>OpenID Connect provider.</em></li><li>In the <em>OpenID Connect</em> section, look for the <em>Connect account</em> (<span class=\"tn-icon bx bx-log-in\"></span>) button.</li><li>This will redirect you to your authentication provider, where you can sign in or confirm the action if needed.</li><li>Once you are authenticated you will be redirected back to the Trilium application.</li></ol><h2>Logging out</h2><p>When logging out of Trilium, a request is made to the authentication provider to log out from there as well. This feature depends on the authentication provider, so it may not be honored (Google and Authelia are known cases in which they don't respect the logout feature).</p><h2>Switching providers</h2><p>When switching providers (e.g. going from Google to Authelia), it's important to take the following steps:</p><ol><li>Go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Password & Auth</em>.</li><li>In the <em>OpenID Connect</em> section, press the <em>Disconnect</em> (<span class=\"tn-icon bx bx-trash\"></span>) button.</li><li>Wait for the section to indicate that you are disconnected.</li><li>Change the configuration pointing to the new provider.</li><li>Restart your server.</li><li>Repeat the normal steps to connect to the authentication provider.</li></ol><p>Failing to disconnect before switching providers might temporarily lock you in, as you will not be able to login (credentials won't match). Should this happen:</p><ol><li>Modify the server configuration again to your old provider.</li><li>Restart the server and follow the disconnect instructions above.</li><li>Modify the server configuration again to your new provider.</li><li>Restart again the server.</li></ol><h2>Deactivating OpenID Connect temporarily</h2><p>To disable the OpenID Connect authentication and instead rely on the local password temporarily, you must:</p><ol><li>Modify the <code>config.ini</code> or environment variables (depending on how you set up the provider information) and temporarily deactivate the multi-factor authentication section by renaming <code>[MultiFactorAuthentication]</code> to something else (e.g. <code>[MultiFactorAuthentication.bak]</code>.</li><li>Restart the server for the changes to take effect.</li></ol><h2>Troubleshooting</h2><h3>Setup fails with a <code>WWW-Authenticate</code> or <code>invalid_client</code> error</h3><p>Your provider disagrees with Trilium about how client credentials should be sent to the token endpoint. Set <code>oauthClientAuthMethod</code> to <code>client_secret_post</code> (or <code>client_secret_basic</code> if it's already set to post) and restart. Providers vary: some reject <code>client_secret_post</code> outright because the method is fixed when the client is registered (e.g. Authelia), so if one value doesn't work, try the other.</p><h3>Setup fails with <code>invalid user</code></h3><p>If you are running behind a <a href=\"#root/_help_vcjrb3VVYPZI\">reverse proxy</a>, a buffer overflow can also cause this issue. Here is a sample fix for <a class=\"reference-link\" href=\"#root/_help_ud6MShXL4WpO\">Nginx</a>: </p><pre><code class=\"language-text-x-trilium-auto\">proxy_buffer_size 128k;\nproxy_buffers 4 256k;\nproxy_busy_buffers_size 256k;</code></pre><h3>Setup fails with an <code>unexpected JWT alg</code> error</h3><p>Depending on your version the message reads <code>unexpected JWT \"alg\" header parameter</code> or <code>unexpected JWT alg received, expected RS256, got: EdDSA</code>. Both mean the same thing: your provider signs ID tokens with an algorithm other than RS256. Pocket ID (Ed25519) and Kanidm (ES256) do this.</p><p>From v0.104.2 Trilium detects the algorithm from your provider automatically, and the log records the outcome (<code>OAuth: the issuer does not sign ID tokens with RS256; expecting ES256</code>). If detection can't reach the provider it falls back to RS256, so check that the issuer URL is correct and reachable first. Should it still fail, set <code>oauthIdTokenSigningAlg</code> explicitly to the algorithm your provider uses.</p><h3>Setup fails with <code>OAUTH_RESPONSE_IS_NOT_CONFORM</code></h3><p>Make sure the base URL is correct and that the identity provider actually supports OpenID Connect. Some providers such as GitHub offer only OAuth 2.0.</p>","_help_IgkTHSaFfq6A": "<p>This page contains instructions on how to set up <a class=\"reference-link\" href=\"#root/_help_x1lQNKQBqLcA\">Signing in with OpenID Connect</a> with various providers such as Authelia, GitLab, Google.</p><aside class=\"admonition note\"><p>While the configuration reference is correct and up to date, the steps to create the OAuth application might differ slightly as providers change their UI.</p></aside><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">Authelia</p><div class=\"trilium-tab-panel\"><ol><li><p>Generate a client secret:</p><pre><code class=\"language-text-x-trilium-auto\">authelia crypto hash generate pbkdf2 --variant sha512 --random --random.length 72 --random.charset rfc3986\n</code></pre><p><code>Random Password</code> goes to Trilium, <code>Digest</code> (the <code>$pbkdf2-sha512$…</code> string) goes to Authelia.</p></li><li><p>Add a client under <code>identity_providers.oidc.clients</code> in Authelia's <code>configuration.yml</code>, replacing <code><server></code> with the URL of your Trilium instance:</p><pre><code class=\"language-text-x-yaml\">identity_providers:\n oidc:\n clients:\n - client_id: 'trilium'\n client_name: 'Trilium'\n client_secret: '<Digest>'\n public: false\n authorization_policy: 'two_factor'\n redirect_uris:\n - 'https://<server>/callback'\n scopes:\n - 'openid'\n - 'profile'\n - 'email'</code></pre><p>Unlike GitLab, <code>client_id</code> is a name you choose rather than one the provider generates.</p></li><li><p>Restart Authelia.</p></li></ol><p>Adjust <code>config.ini</code>, using the <code>Random Password</code> from step 1:</p><pre><code class=\"language-text-x-trilium-auto\">[MultiFactorAuthentication]\noauthBaseUrl=https://<server>\noauthClientId=<ClientId>\noauthClientSecret=<RandomPassword>\noauthIssuerBaseUrl=https://<server>\noauthIssuerName=Authelia</code></pre><aside class=\"admonition important\"><p>Do <strong>not</strong> set <code>oauthClientAuthMethod</code> for Authelia. It defaults confidential clients to <code>client_secret_basic</code> and rejects any other method with <code>invalid_client</code>, which is the default Trilium already uses. This is the opposite of the GitLab case below.</p></aside></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><span class=\"tn-icon bx bxl-gitlab\"></span> GitLab</p><div class=\"trilium-tab-panel\"><ol><li>Go to user settings on <a href=\"https://gitlab.com/-/user_settings/applications\">gitlab.com</a> or your own self-hosted instance.</li><li>Press <em>Add new application</em>.</li><li>Give it a name (e.g. Trilium).</li><li>Set <em>Redirect URI</em> to <code>https://<server>/callback</code></li><li>Make sure <em>Confidential</em> is checked and <em>Device authorization grant</em> is unchecked.</li><li>Under scopes, check <em>openid</em>, <em>profile</em> and <em>email</em> (they should be near the end).</li><li>Save the application and copy the <em>Application ID</em> and <em>Secret</em>.</li></ol><p>Adjust <code>config.ini</code> as follows, replacing <code><ApplicationId></code> and <code><Secret></code> with the values from the last step as well as the <code><server></code> with a URL to your Trilium instance.</p><pre><code class=\"language-text-x-trilium-auto\">[MultiFactorAuthentication]\noauthBaseUrl=https://<server>\noauthClientId=<ApplicationId>\noauthClientSecret=<Secret>\noauthIssuerBaseUrl=https://gitlab.com\noauthIssuerName=GitLab\noauthClientAuthMethod=client_secret_post\n</code></pre><aside class=\"admonition important\"><p>If you are using a self-hosted instance of GitLab, make sure to also update <code>oauthIssuerBaseUrl</code>, and keep the <code>oauthClientAuthMethod</code> line above.</p><p>GitLab's token endpoint does not decode credentials sent via HTTP Basic, so without <code>oauthClientAuthMethod</code>, sign-in fails with a <code>server responded with a challenge in the WWW-Authenticate HTTP Header</code> error. Trilium applies this automatically for <code>gitlab.com</code>, but a self-hosted issuer URL cannot be detected.</p></aside></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">Kanidm</p><div class=\"trilium-tab-panel\"><ol><li><p>Create the client, add the redirect URL and grant the scopes, replacing <code><server></code> with the URL of your Trilium instance and <code><group></code> with an existing Kanidm group whose members may sign in:</p><pre><code class=\"language-text-x-trilium-auto\">kanidm system oauth2 create trilium \"Trilium\" \"https://<server>\"\nkanidm system oauth2 add-redirect-url trilium \"https://<server>/callback\"\nkanidm system oauth2 update-scope-map trilium <group> openid profile email</code></pre><p>The <code>openid</code> scope is mandatory; without it Kanidm treats the client as plain OAuth 2.0.</p></li><li><p>Read the client secret:</p><pre><code class=\"language-text-x-trilium-auto\">kanidm system oauth2 show-basic-secret trilium</code></pre></li></ol><p>Adjust <code>config.ini</code> as follows, replacing <code><idm></code> with the URL of your Kanidm instance and <code><BasicSecret></code> with the value from step 2:</p><pre><code class=\"language-text-x-trilium-auto\">[MultiFactorAuthentication]\noauthBaseUrl=https://<server>\noauthClientId=trilium\noauthClientSecret=<BasicSecret>\noauthIssuerBaseUrl=https://<idm>/oauth2/openid/trilium\noauthIssuerName=Kanidm</code></pre><p>The client name you chose in step 1 is both the client ID and the last path segment of the issuer URL, so the two must match.</p><aside class=\"admonition important\"><p>Kanidm signs ID tokens with ES256, not RS256. Trilium detects this from the provider on v0.105.0 and later, so no extra configuration is needed. Do <strong>not</strong> run <code>kanidm system oauth2 warning-enable-legacy-crypto</code>, it downgrades the client to RS256 and disables ES256 entirely. On older Trilium versions sign-in fails with an <code>unexpected JWT alg</code> error.</p></aside></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">Pocket ID</p><div class=\"trilium-tab-panel\"><aside class=\"admonition important\"><p>Pocket ID is passwordless, signing in requires a passkey. Register one and confirm you can sign in to Pocket ID itself <em>before</em> switching Trilium over to OpenID Connect, otherwise you may find yourself unable to authenticate at either end.</p></aside><ol><li>Sign in to Pocket ID as an administrator and go to <em>OIDC Clients</em> → <em>Add OIDC Client</em>.</li><li>Give it a name (e.g. Trilium).</li><li>Set <em>Callback URLs</em> to <code>https://<server>/callback</code>, replacing <code><server></code> with the URL of your Trilium instance.</li><li>Save, then copy the <em>Client ID</em>, <em>Client Secret</em> and <em>OIDC Discovery URL</em>.</li></ol><p>Adjust <code>config.ini</code> as follows, using the values from step 4:</p><pre><code class=\"language-text-x-trilium-auto\">[MultiFactorAuthentication]\noauthBaseUrl=https://<server>\noauthClientId=<ClientID>\noauthClientSecret=<ClientSecret>\noauthIssuerBaseUrl=<OIDCDiscoveryURL>\noauthIssuerName=Pocket ID</code></pre><aside class=\"admonition note\"><p>Pocket ID gives you an <em>OIDC Discovery URL</em> ending in <code>/.well-known/openid-configuration</code>. On v0.105.0 and later you can paste it as-is. On earlier versions, remove that suffix and use only the part before it.</p></aside><aside class=\"admonition important\"><p>Pocket ID generates an RS256 signing key on first start, which works without further configuration. If you rotate it to Ed25519 (<code>pocket-id key-rotate --alg EdDSA --crv Ed25519</code>), ID tokens are signed with EdDSA instead. Trilium detects this automatically on v0.105.0 and later; older versions fail with <code>unexpected JWT alg received, expected RS256, got: EdDSA</code>.</p></aside></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><span style=\"--tn-color:#e64d4d;color:#e64d4d;\"><span class=\"tn-icon bx bx-x\"></span> GitHub</span></p><div class=\"trilium-tab-panel\"><p>GitHub cannot be used as an identity provider because it is plain OAuth 2.0 and not OpenID Connect, so it will fail with <code>OAUTH_RESPONSE_IS_NOT_CONFORM</code>.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><span class=\"tn-icon bx bxl-google\"></span> Google</p><div class=\"trilium-tab-panel\"><ol><li>Go to <a href=\"https://console.cloud.google.com/auth/clients\">Google Cloud's Clients</a> dashboard and select <em>Create client</em>.</li><li>For <em>Application type,</em> select <em>Web application</em>.</li><li>In <em>Authorized redirect URIs</em>, set <code>https://<server>/callback</code>.</li><li>Press <em>Create</em> and copy <em>Client ID</em> and <em>Client secret</em>.</li></ol><p>Adjust <code>config.ini</code> as follows, replacing <code><ClientID></code> and <code><ClientSecret></code> with the values from the last step as well as the <code><server></code> with a URL to your Trilium instance.</p><pre><code class=\"language-text-x-trilium-auto\">[MultiFactorAuthentication]\noauthBaseUrl=https://<server>\noauthClientId=<ClientID>\noauthClientSecret=<ClientSecret></code></pre></div></section></div>","_help_yeEaYqosGLSh": "<p>As an alternative to <a href=\"#root/_help_Dgg7bR3b6K9j\">hosting your own Trilium instance</a>, there are two services out there that provide out of the box support for Trilium.</p><aside class=\"admonition important\"><p><strong>Disclaimer</strong>: The Trilium Notes project and maintainers are not directly affiliated with either of the projects.</p><p>PikaPods have gracefully offered us free credits for testing purposes.</p></aside><h2>Cloud instance providers</h2><h3>PikaPods</h3><ol><li>Go to <a href=\"https://www.pikapods.com\">pikapods.com</a> and sign up.</li><li>In the “Available Apps” section, look for \"TriliumNext<br> and select “Run your own”.</li><li>Follow the on-screen instructions to set up your own cloud hosted instance.</li></ol><p>PikaPods generally updates their Trilium instances to the latest version within a two-week interval after a new version is released.</p><h2>Matching your version with the cloud instance</h2><p>Please note that once you set up <a class=\"reference-link\" href=\"#root/_help_cbkrhQjrkKrh\">Synchronization</a> between a cloud instance and <a href=\"#root/_help_poXkQfguuA0U\">desktop</a> clients, it's important that the version of the desktop application and the server match up.</p><p>When setting up a cloud instance, it's best to check the version of the server by accessing it via a web browser and going to the <em>About</em> section. It's best that both the desktop and the server have the same <em>App version</em>; however it's generally OK to update the desktop to a newer version than the server if it has the same <em>Sync version</em>.</p><p>If the <em>Sync version</em> between the server and the desktop application doesn't match, synchronization will not work.</p>",@@ -219,8 +219,8 @@"_help_i16PM6A7GXdU": "<p>Trilium features customizable to-do list task states. To customize them, go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Text Notes</em> → <em>Related settings</em> → <em>Custom checkbox states for to-do lists</em>. Alternatively, right-click a checkbox in an editable text note and click the pencil icon; on the <a class=\"reference-link\" href=\"#root/_help_RDslemsQ6gCp\">Mobile Frontend</a>, the pencil icon is in the row of the <em>List ›</em> button of a to-do list.</p><aside class=\"admonition warning\"><p>Changes take effect only after restarting the application.</p></aside><h2>Creating a new task state</h2><p>Click the plus icon next to Task States in the left-side pane, then define the task details as described in the next section.</p><h2>Editing a task state</h2><p>Selecting any state other than \"None\" and \"Done\" (which cannot be modified) from the side pane reveals the following editable fields:</p><ul><li><em>Icon</em> (required): The symbol shown inside the checkbox. You can pick an icon just as you would for any regular note, including from custom icon packs.</li><li><em>Title</em> (required): The name of the task state shown in the UI. For example: \"Doing\", \"Postponed\".</li><li><em>Identifier</em> (required): A short name for the state, using only letters, digits, \"<code>-</code>\" and \"<code>_</code>\". It is stored as metadata in the note's markup and used to identify the task state. Two task states cannot share the same identifier.<br>Prefix the identifiers of your custom task states with an underscore \"<code>_</code>\" or a hyphen \"<code>-</code>\" to avoid clashes with task states that may be introduced in future versions of Trilium.</li><li><em>Markdown symbol</em>: A single character used to represent the state in Markdown syntax. For example, \"<code>#</code>\" creates a task state that can be applied in Markdown using \" <code>- [#]</code> \". Make sure no other task state uses the same symbol.</li><li><em>Counts as completed</em>: If checked, the task is treated as completed.</li><li><em>Color</em>: The color of the checkbox. Its lightness and saturation are adjusted automatically to match the current color scheme or theme.</li><li><em>Hidden from toolbar</em>: The state is not listed in the UI. This is useful when you want existing notes to keep rendering the state correctly but no longer need to apply it yourself.</li></ul><aside class=\"admonition note\"><p>The task definition details are validated at startup. If errors are found, a toast provides the details and the affected task definition is ignored.</p></aside><h2>Reordering task states</h2><p>To change the order in which task states appear in the UI and when cycling through them with the keyboard, simply reorder the states in the side pane (or tree panel, if it's the case).</p><h2>Deleting task states</h2><p>Any task state other than \"None\" and \"Done\" can be deleted.</p><p>Once deleted, to-do items using that state will no longer display the custom checkbox. They fall back to either a \"None\" or \"Done\" state, depending on the state's \"Counts as completed\" setting. The identifier and title remain stored in the note until you set the checkbox to a new state.</p><h2>Transferring notes with custom task states between Trilium database instances</h2><p>Exporting notes to another Trilium database instance preserves the task states of to-do items, but does not include the custom task definitions. As a result, the destination instance won't know how to render the checkbox unless you recreate the task state there with the same identifier and Markdown symbol.</p><aside class=\"admonition note\"><p>This is a known limitation of the current version. If there is enough interest in the community for transferring notes between Trilium database instances more easily, the Trilium team may consider a better state definition mechanism.</p></aside>","_help_J5Ex1ZrMbyJ6": "<p>Trilium provides a mechanism for <a href=\"#root/_help_CdNpE2pqjmI6\">scripts</a> to open a public REST endpoint. This opens a way for various integrations with other services - a simple example would be creating new note from Slack by issuing a slash command (e.g. <code>/trilium buy milk</code>).</p><h2>Create note from outside Trilium</h2><p>Let's take a look at an example. The goal is to provide a REST endpoint to which we can send title and content and Trilium will create a note.</p><p>We'll start with creating a JavaScript backend <a href=\"#root/_help_6f9hih2hXXZk\">code note</a> containing:</p><pre><code class=\"language-text-x-trilium-auto\">const {req, res} = api;\nconst {secret, title, content} = req.body;\n\nif (req.method == 'POST' && secret === 'secret-password') {\n // notes must be saved somewhere in the tree hierarchy specified by a parent note. \n // This is defined by a relation from this code note to the \"target\" parent note\n // alternatively you can just use constant noteId for simplicity (get that from \"Note info\" dialog of the desired parent note)\n const targetParentNoteId = api.currentNote.getRelationValue('targetNote');\n \n const {note} = api.createTextNote(targetParentNoteId, title, content);\n const notePojo = note.getPojo();\n\n res.status(201).json(notePojo);\n}\nelse {\n res.send(400);\n}</code></pre><p>This script note has also following two attributes:</p><ul><li>label <code>#customRequestHandler</code> with value <code>create-note</code></li><li>relation <code>~targetNote</code> pointing to a note where new notes should be saved</li></ul><h3>Explanation</h3><p>Let's test this by using an HTTP client to send a request:</p><pre><code class=\"language-text-x-trilium-auto\">POST http://your-trilium-server/custom/create-note\nContent-Type: application/json\n\n{\n \"secret\": \"secret-password\",\n \"title\": \"hello\",\n \"content\": \"world\"\n}+++++++++++++++++++++++++++++++++++++++++++++++</code></pre><p>Notice the <code>/custom</code> part in the request path - Trilium considers any request with this prefix as \"custom\" and tries to find a matching handler by looking at all notes which have <code>customRequestHandler</code> <a href=\"#root/_help_zEY4DaJG4YT5\">label</a>. Value of this label then contains a regular expression which will match the request path (in our case trivial regex \"create-note\").</p><p>Trilium will then find our code note created above and execute it. <code>api.req</code>, <code>api.res</code> are set to <a href=\"https://expressjs.com/en/api.html#req\">request</a> and <a href=\"https://expressjs.com/en/api.html#res\">response</a>objects from which we can get details of the request and also respond.</p><p>In the code note we check the request method and then use trivial authentication - keep in mind that these endpoints are by default totally unauthenticated, and you need to take care of this yourself.</p><p>Once we pass these checks we will just create the desired note using <a href=\"#root/_help_GLks18SNjxmC\">Script API</a>.</p><h2>Custom resource provider</h2><p>Another common use case is that you want to just expose a file note - in such case you create label <code>customResourceProvider</code> (value is again path regex).</p><p>For more information, see <a href=\"#root/_help_d3fAXQ2diepH\">Custom Resource Providers</a>.</p><h2>Advanced concepts</h2><p><code>api.req</code> and <code>api.res</code> are Express.js objects - you can always look into its <a href=\"https://expressjs.com/en/api.html\">documentation</a> for details.</p><h3>Parameters</h3><p>REST request paths often contain parameters in the URL, e.g.:</p><pre><code class=\"language-text-x-trilium-auto\">http://your-trilium-server/custom/notes/123</code></pre><p>The last part is dynamic so the matching of the URL must also be dynamic - for this reason the matching is done with regular expressions. Following <code>customRequestHandler</code> value would match it:</p><pre><code class=\"language-text-x-trilium-auto\">notes/([0-9]+)</code></pre><p>Additionally, this also defines a matching group with the use of parenthesis which then makes it easier to extract the value. The matched groups are available in <code>api.pathParams</code>:</p><pre><code class=\"language-text-x-trilium-auto\">const noteId = api.pathParams[0];</code></pre><p>Often you also need query params (as in e.g. <code>http://your-trilium-server/custom/notes?noteId=123</code>), you can get those with standard express <code>req.query.noteId</code>.</p>","_help_d3fAXQ2diepH": "<p>A custom resource provider allows any file imported into Trilium (images, fonts, stylesheets) to be publicly accessible via a URL.</p><p>A potential use case for this is to add embed a custom font alongside a theme.</p><h2>Steps for creating a custom resource provider</h2><ol><li>Import a file such as an image or a font into Trilium by drag & drop.</li><li>Set the <a href=\"#root/_help_HI6GBBIduIgv\">label</a> <code>#customResourceProvider</code> to <code>hello</code>.</li><li>To test if it is working, use a browser to navigate to <code><protocol>://<host>/custom/hello</code> (where <code><protocol></code> is either <code>http</code> or <code>https</code> based on your setup, and <code><host></code> is the host or IP to your Trilium server instance). If you are running the TriliumNext application without a server, use <code>http://localhost:37840</code> as the base URL.</li><li>If everything went well, at the previous step the browser should have downloaded the file uploaded in the first step.</li></ol><p>Instead of <code>hello</code>, the name can be:</p><ul><li>A path, such as <code>fonts/Roboto.ttf</code>, which would be accessible via <code><host>/custom/fonts/Roboto.ttf</code>.</li><li>As a more advanced use case, a regular expression to match multiple routes, such as <code>hello/.*</code> which will be accessible via <code>/custom/hello/1</code>, <code>/custom/hello/2</code>, <code>/custom/hello/world</code>, etc.</li></ul><h2>Using it in a theme</h2><p>For example, if you have a custom font to be imported by the theme, first upload a font file into Trilium and assign it the <code>#customResourceProvider=fonts/myfont.ttf</code> attribute.</p><p>Then modify the theme CSS to point to:</p><pre><code class=\"language-text-css\">@font-face {\n\tfont-family: customFont;\n\tsrc: url(\"/custom/fonts/myfont.ttf\");\n}\n\ndiv {\n\tfont-family: customFont;\n}</code></pre>",- "_help_pgxEVkzLl1OP": "<aside class=\"admonition tip\"><p>For a quick start, consult the <a class=\"reference-link\" href=\"#root/_help_9qPsTWBorUhQ\">API Reference</a>.</p></aside><p>ETAPI is Trilium's public/external REST API. It is available since Trilium v0.50.</p><h2>API clients</h2><p>As an alternative to calling the API directly, there are client libraries to simplify this</p><ul><li><a href=\"https://github.com/Nriver/trilium-py\">trilium-py</a>, you can use Python to communicate with Trilium.</li></ul><h2>Obtaining a token</h2><p>All operations with the REST API have to be authenticated using a token. You can get this token either from Options -> ETAPI or programmatically using the <code>/auth/login</code> REST call (see the <a href=\"https://github.com/TriliumNext/Trilium/blob/master/src/etapi/etapi.openapi.yaml\">spec</a>).</p><h2>Authentication</h2><h3>Via the <code>Authorization</code> header</h3><pre><code class=\"language-text-x-trilium-auto\">GET https://myserver.com/etapi/app-info\nAuthorization: ETAPITOKEN</code></pre><p>where <code>ETAPITOKEN</code> is the token obtained in the previous step.</p><p>For compatibility with various tools, it's also possible to specify the value of the <code>Authorization</code> header in the format <code>Bearer ETAPITOKEN</code> (since 0.93.0).</p><h3>Basic authentication</h3><p>Since v0.56 you can also use basic auth format:</p><pre><code class=\"language-text-x-trilium-auto\">GET https://myserver.com/etapi/app-info\nAuthorization: Basic BATOKEN</code></pre><ul><li>Where <code>BATOKEN = BASE64(username + ':' + password)</code> - this is a standard Basic Auth serialization</li><li>Where <code>username</code> is \"etapi\"</li><li>And <code>password</code> is the generated ETAPI token described above.</li></ul><p>Basic Auth is meant to be used with tools which support only basic auth.</p><h2>Interaction using Bash scripts</h2><p>It is possible to write simple Bash scripts to interact with Trilium. As an example, here's how to obtain the HTML content of a note:</p><pre><code class=\"language-text-x-trilium-auto\">#!/usr/bin/env bash\n\n# Configuration\nTOKEN=z1vA4fkGxjOR_ZXLrZeqHEFOv65yV3882iFCRtNIK9k9iWrHliITNSLQ=\nSERVER=http://localhost:8080\n\n# Download a note by ID\nNOTE_ID=\"i6ra4ZshJhgN\"\ncurl \"$SERVER/etapi/notes/$NOTE_ID/content\" -H \"Authorization: $TOKEN\" </code></pre><p>Make sure to replace the values of:</p><ul><li><code>TOKEN</code> with your ETAPI token.</li><li><code>SERVER</code> with the correct protocol, host name and port to your Trilium instance.</li><li><code>NOTE_ID</code> with an existing note ID to download.</li></ul><p>As another example, to obtain a .zip export of a note and place it in a directory called <code>out</code>, simply replace the last statement in the script with:</p><pre><code class=\"language-text-x-trilium-auto\">curl -H \"Authorization: $TOKEN\" \\\n\t-X GET \"$SERVER/etapi/notes/$NOTE_ID/export\" \\\n --output \"out/$NOTE_ID.zip\"</code></pre><h2>Uploading binary content</h2><p>A JSON request body can only carry text, so the <code>content</code> field of <code>POST /etapi/attachments</code> stores exactly the string it receives. To upload an image, a PDF or any other binary file, send the raw bytes to the content endpoint with the <code>application/octet-stream</code> content type. The same applies to the content of a note (<code>PUT /etapi/notes/{noteId}/content</code>).</p><p>To attach a file to a note, create the attachment without content, then upload the file to it:</p><pre><code class=\"language-text-x-trilium-auto\">ATTACHMENT_ID=$(curl -s -X POST \"$SERVER/etapi/attachments\" \\\n -H \"Authorization: $TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d \"{\\\"ownerId\\\": \\\"$NOTE_ID\\\", \\\"role\\\": \\\"file\\\", \\\"mime\\\": \\\"application/pdf\\\", \\\"title\\\": \\\"report.pdf\\\", \\\"position\\\": 10}\" \\\n | jq -r .attachmentId)\n\ncurl -X PUT \"$SERVER/etapi/attachments/$ATTACHMENT_ID/content\" \\\n -H \"Authorization: $TOKEN\" \\\n -H \"Content-Type: application/octet-stream\" \\\n --data-binary @report.pdf</code></pre><p>Use <code>--data-binary</code> rather than <code>-d</code>, which strips line breaks from the file. For an image, set <code>role</code> to <code>image</code> and <code>mime</code> to the image's type, such as <code>image/png</code>.</p>",- "_help_9qPsTWBorUhQ": "<p>External Trilium API</p><h2><span class=\"tn-icon bx bx-lock-alt\"></span> Authentication</h2><h3><code>EtapiTokenAuth</code></h3><p>API key in the <code>Authorization</code> header.</p><h3><code>EtapiBasicAuth</code></h3><p>HTTP <code>basic</code> authentication.</p><p>Basic Auth where username is arbitrary string (e.g. \"trilium\", not checked), username is the ETAPI token. To emphasize, do not use Trilium password here (won't work), only the generated ETAPI token (from Options -> ETAPI)</p><h2><span class=\"tn-icon bx bx-note\"></span> Notes</h2><p>Notes and their content, and the import and export of whole subtrees.</p><h3>Create a note</h3><p><code>POST /create-note</code> · <code>createNote</code></p><p>Create a note and place it into the note tree</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-CreateNoteDef\"><code>CreateNoteDef</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>parentNoteId</code> <br><em>required</em></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>Note ID of the parent note in the tree</td></tr><tr><td><code>title</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>text</code>, <code>code</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>book</code>, <code>relationMap</code>, <code>render</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code> <br>this needs to be specified only for note types 'code', 'file', 'image'.</td></tr><tr><td><code>content</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer</code> <br>Position of the note in the parent. Normal ordering is 10, 20, 30 ... So if you want to create a note on the first position, use e.g. 5, for second position 15, for last e.g. 1000000</td></tr><tr><td><code>prefix</code></td><td><code>string</code> <br>Prefix is branch (placement) specific title prefix for the note. Let's say you have your note placed into two different places in the tree, but you want to change the title a bit in one of the placements. For this you can use prefix.</td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code> <br>true if this note (as a folder) should appear expanded</td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>DON'T specify unless you want to force a specific noteId</td></tr><tr><td><code>branchId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>DON'T specify unless you want to force a specific branchId</td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a> <br>Local timestap of the note creation. Specify only if you want to override the default (current datetime in the current timezone/offset).</td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>UTC timestap of the note creation. Specify only if you want to override the default (current datetime).</td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>UTC timestamp of the note's last modification, e.g. to keep the date of a note being migrated from another application. The local dateModified is derived from it. Specify only if you want to override the default (current datetime).</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"application/json\",\n \"content\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true,\n \"noteId\": \"evnnmvHTCgIn\",\n \"branchId\": \"evnnmvHTCgIn\",\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\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; charset=utf-8</code>: <a href=\"#schema-NoteWithBranch\"><code>NoteWithBranch</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>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> <br>Branch places the note into the tree, it represents the relationship between a parent note and child note</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"note\": {\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n },\n \"branch\": {\n \"branchId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Search notes</h3><p><code>GET /notes</code> · <code>searchNotes</code></p><p>Search notes</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>search</code> <br><em>required</em></td><td><code>string</code> <br>search query string as described in <a href=\"https://triliumnext.github.io/Docs/Wiki/search.html\">https://triliumnext.github.io/Docs/Wiki/search.html</a></td></tr><tr><td><code>fastSearch</code></td><td><code>boolean</code> <br>enable fast search (fulltext doesn't look into content)</td></tr><tr><td><code>includeArchivedNotes</code></td><td><code>boolean</code> <br>search by default ignores archived notes. Set to 'true' to includes archived notes into search results.</td></tr><tr><td><code>ancestorNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>search only in a subtree identified by the subtree noteId. By default whole tree is searched.</td></tr><tr><td><code>ancestorDepth</code></td><td><code>string</code> <br>define how deep in the tree should the notes be searched</td></tr><tr><td><code>orderBy</code></td><td><code>string</code> <br>name of the property/label to order search results by</td></tr><tr><td><code>orderDirection</code></td><td><code>string</code> <br>order direction, ascending or descending. One of <code>asc</code>, <code>desc</code>.</td></tr><tr><td><code>limit</code></td><td><code>integer</code> <br>limit the number of results you want to receive</td></tr><tr><td><code>debug</code></td><td><code>boolean</code> <br>set to true to get debug information in the response (search query parsing)</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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-SearchResponse\"><code>SearchResponse</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>results</code> <br><em>required</em></td><td>array of <a href=\"#schema-Note\"><code>Note</code></a></td></tr><tr><td><code>debugInfo</code></td><td><code>object</code> <br>debugging info on parsing the search query enabled with &debug=true parameter</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"results\": [\n {\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"debugInfo\": {}\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a note</h3><p><code>GET /notes/{noteId}</code> · <code>getNoteById</code></p><p>Returns a note identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Delete a note</h3><p><code>DELETE /notes/{noteId}</code> · <code>deleteNoteById</code></p><p>deletes a single note based on the noteId supplied</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Update a note</h3><p><code>PATCH /notes/{noteId}</code> · <code>patchNoteById</code></p><p>patch a note identified by the noteId with changes in the body</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"blobId\": \"string\",\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: note updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get the content of a note</h3><p><code>GET /notes/{noteId}/content</code> · <code>getNoteContent</code></p><p>Returns note content identified by its ID. The response carries the note's MIME type as its <code>Content-Type</code>.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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\"><ul><li><code>*/*</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Replace the content of a note</h3><p><code>PUT /notes/{noteId}/content</code> · <code>putNoteContentById</code></p><p>Updates note content identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><p>New content of the note. Send text (such as the HTML of a text note) as <code>text/plain</code> and binary data (such as the file of an image or file note) as <code>application/octet-stream</code>; other content types are not accepted.</p><ul><li><code>text/plain</code>: <code>string</code></li><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: note content updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Export a subtree</h3><p><code>GET /notes/{noteId}/export</code> · <code>exportNoteSubtree</code></p><p>Exports ZIP file export of a given note subtree. To export whole document, use \"root\" for noteId</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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>format</code></td><td><code>any</code> <br>One of <code>html</code>, <code>markdown</code>, <code>share</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: export ZIP file</p><div class=\"trilium-tab-panel\"><ul><li><code>application/zip</code>: <code>string (binary)</code></li></ul></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Import a ZIP archive</h3><p><code>POST /notes/{noteId}/import</code> · <code>importZip</code></p><p>Imports ZIP file into a given note.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-NoteWithBranch\"><code>NoteWithBranch</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>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> <br>Branch places the note into the tree, it represents the relationship between a parent note and child note</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"note\": {\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n },\n \"branch\": {\n \"branchId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Restore a deleted note</h3><p><code>POST /notes/{noteId}/undelete</code> · <code>undeleteNote</code></p><p>Restore a deleted note. The note must be deleted and must have at least one undeleted parent.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 restored successfully</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>List recent changes</h3><p><code>GET /notes/history</code> · <code>getNoteHistory</code></p><p>Returns recent changes including note creations, modifications, and deletions</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>ancestorNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>Limit changes to a subtree identified by this note ID. Defaults to \"root\" (all notes).</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: list of recent changes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: array of <a href=\"#schema-RecentChange\"><code>RecentChange</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"current_title\": \"string\",\n \"current_isDeleted\": true,\n \"current_deleteId\": \"string\",\n \"current_isProtected\": true,\n \"utcDate\": \"2021-12-31 19:18:11.930Z\",\n \"date\": \"2021-12-31 20:18:11.930+0100\",\n \"canBeUndeleted\": true\n }\n]</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-git-branch\"></span> Branches</h2><p>Branches place a note in the tree, under a parent note.</p><h3>Create a branch</h3><p><code>POST /branches</code> · <code>postBranch</code></p><p>Create a branch (clone a note to a different location in the tree). In case there is a branch between parent note and child note already, then this will update the existing branch with prefix, notePosition and isExpanded.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</code></p><p><strong>Request body</strong> (required)</p><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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": 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: existing branch updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: branch created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a branch</h3><p><code>GET /branches/{branchId}</code> · <code>getBranchById</code></p><p>Returns a branch identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Delete a branch</h3><p><code>DELETE /branches/{branchId}</code> · <code>deleteBranchById</code></p><p>deletes a branch based on the branchId supplied. If this is the last branch of the (child) note, then the note is deleted as well.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Update a branch</h3><p><code>PATCH /branches/{branchId}</code> · <code>patchBranchById</code></p><p>patch a branch identified by the branchId with changes in the body. Only prefix and notePosition can be updated. If you want to update other properties, you need to delete the old branch and create a new one.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": 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: branch updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Refresh the order of child notes</h3><p><code>POST /refresh-note-ordering/{parentNoteId}</code> · <code>postRefreshNoteOrdering</code></p><p>notePositions in branches are not automatically pushed to connected clients and need a specific instruction. If you want your changes to be in effect immediately, call this service after setting branches' notePosition. Note that you need to supply \"parentNoteId\" of branch(es) with changed positions.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 ordering refreshed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-purchase-tag\"></span> Attributes</h2><p>Labels and relations of a note.</p><h3>Create an attribute</h3><p><code>POST /attributes</code> · <code>postAttribute</code></p><p>create an attribute for a given note</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>type</code></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code></td><td><code>string</code> <br>Matches <code>^[^\\s]+</code>.</td></tr><tr><td><code>value</code></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\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 created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>type</code></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code></td><td><code>string</code> <br>Matches <code>^[^\\s]+</code>.</td></tr><tr><td><code>value</code></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get an attribute</h3><p><code>GET /attributes/{attributeId}</code> · <code>getAttributeById</code></p><p>Returns an attribute identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>attributeId</code> <br><em>required</em></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>type</code></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code></td><td><code>string</code> <br>Matches <code>^[^\\s]+</code>.</td></tr><tr><td><code>value</code></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Delete an attribute</h3><p><code>DELETE /attributes/{attributeId}</code> · <code>deleteAttributeById</code></p><p>deletes an attribute based on the attributeId supplied.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>attributeId</code> <br><em>required</em></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></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><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Update an attribute</h3><p><code>PATCH /attributes/{attributeId}</code> · <code>patchAttributeById</code></p><p>patch an attribute identified by the attributeId with changes in the body. For labels, only value and position can be updated. For relations, only position can be updated. If you want to modify other properties, you need to delete the old attribute and create a new one.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>attributeId</code> <br><em>required</em></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>type</code></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code></td><td><code>string</code> <br>Matches <code>^[^\\s]+</code>.</td></tr><tr><td><code>value</code></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\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: attribute updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>type</code></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code></td><td><code>string</code> <br>Matches <code>^[^\\s]+</code>.</td></tr><tr><td><code>value</code></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-paperclip\"></span> Attachments</h2><p>Files attached to a note.</p><h3>List the attachments of a note</h3><p><code>GET /notes/{noteId}/attachments</code> · <code>getNoteAttachments</code></p><p>Returns all attachments for a note identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: list of attachments</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: array of <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"attachmentId\": \"evnnmvHTCgIn\",\n \"ownerId\": \"evnnmvHTCgIn\",\n \"role\": \"string\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"position\": 0,\n \"blobId\": \"string\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateScheduledForErasureSince\": \"2021-12-31 19:18:11.930Z\",\n \"contentLength\": 0\n }\n]</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Create an attachment</h3><p><code>POST /attachments</code> · <code>postAttachment</code></p><p>create an attachment</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-CreateAttachment\"><code>CreateAttachment</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>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code> <br>Text content of the attachment, stored as-is. To store binary content, create the attachment without it, then upload the data with <code>PUT /attachments/{attachmentId}/content</code>.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"ownerId\": \"evnnmvHTCgIn\",\n \"role\": \"string\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"content\": \"string\",\n \"position\": 0\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 created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the attachment. Returned as \"[protected]\" for protected attachments, since ETAPI cannot open a protected session.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateScheduledForErasureSince</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"evnnmvHTCgIn\",\n \"ownerId\": \"evnnmvHTCgIn\",\n \"role\": \"string\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"position\": 0,\n \"blobId\": \"string\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateScheduledForErasureSince\": \"2021-12-31 19:18:11.930Z\",\n \"contentLength\": 0\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get an attachment</h3><p><code>GET /attachments/{attachmentId}</code> · <code>getAttachmentById</code></p><p>Returns an attachment identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the attachment. Returned as \"[protected]\" for protected attachments, since ETAPI cannot open a protected session.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateScheduledForErasureSince</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"evnnmvHTCgIn\",\n \"ownerId\": \"evnnmvHTCgIn\",\n \"role\": \"string\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"position\": 0,\n \"blobId\": \"string\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateScheduledForErasureSince\": \"2021-12-31 19:18:11.930Z\",\n \"contentLength\": 0\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Delete an attachment</h3><p><code>DELETE /attachments/{attachmentId}</code> · <code>deleteAttachmentById</code></p><p>deletes an attachment based on the attachmentId supplied.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Update an attachment</h3><p><code>PATCH /attachments/{attachmentId}</code> · <code>patchAttachmentById</code></p><p>patch an attachment identified by the attachmentId with changes in the body. Only role, mime, title, and position are patchable.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the attachment. Returned as \"[protected]\" for protected attachments, since ETAPI cannot open a protected session.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateScheduledForErasureSince</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"ownerId\": \"evnnmvHTCgIn\",\n \"role\": \"string\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"position\": 0,\n \"blobId\": \"string\",\n \"contentLength\": 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: attribute updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the attachment. Returned as \"[protected]\" for protected attachments, since ETAPI cannot open a protected session.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateScheduledForErasureSince</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"evnnmvHTCgIn\",\n \"ownerId\": \"evnnmvHTCgIn\",\n \"role\": \"string\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"position\": 0,\n \"blobId\": \"string\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateScheduledForErasureSince\": \"2021-12-31 19:18:11.930Z\",\n \"contentLength\": 0\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get the content of an attachment</h3><p><code>GET /attachments/{attachmentId}/content</code> · <code>getAttachmentContent</code></p><p>Returns attachment content identified by its ID. The response carries the attachment's MIME type as its <code>Content-Type</code>.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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>*/*</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Replace the content of an attachment</h3><p><code>PUT /attachments/{attachmentId}/content</code> · <code>putAttachmentContentById</code></p><p>Updates attachment content identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><p>New content of the attachment. Send text as <code>text/plain</code> and binary data (such as an image or a PDF) as <code>application/octet-stream</code>; other content types are not accepted.</p><ul><li><code>text/plain</code>: <code>string</code></li><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: attachment content updated</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>Snapshots of a note's content.</p><h3>Create a revision</h3><p><code>POST /notes/{noteId}/revision</code> · <code>createRevision</code></p><p>Create a note revision for the given note</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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>format</code></td><td><code>any</code> <br>One of <code>html</code>, <code>markdown</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 has been created</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>List the revisions of a note</h3><p><code>GET /notes/{noteId}/revisions</code> · <code>getNoteRevisions</code></p><p>Returns the revisions of a note identified by its ID. Protected revisions are omitted, since they cannot be read through ETAPI individually either.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: list of revisions</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: array of <a href=\"#schema-Revision\"><code>Revision</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"revisionId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateLastEdited\": \"2021-12-31 20:18:11.930+0100\",\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateLastEdited\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\",\n \"contentLength\": 0\n }\n]</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a revision</h3><p><code>GET /revisions/{revisionId}</code> · <code>getRevisionById</code></p><p>Returns a revision identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>title</code></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateLastEdited</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateLastEdited</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"revisionId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateLastEdited\": \"2021-12-31 20:18:11.930+0100\",\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateLastEdited\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\",\n \"contentLength\": 0\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get the content of a revision</h3><p><code>GET /revisions/{revisionId}/content</code> · <code>getRevisionContent</code></p><p>Returns revision content identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>text/html</code>: <code>string</code></li></ul></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-calendar\"></span> Calendar</h2><p>Day, week, month and year notes of the journal, and the inbox note.</p><h3>Get the inbox note</h3><p><code>GET /inbox/{date}</code> · <code>getInboxNote</code></p><p>returns an \"inbox\" note, into which note can be created. Date will be used depending on whether the inbox is a fixed note (identified with #inbox label) or a day note in a journal. A database with neither returns the root note, and ignores the date, rather than creating a journal to hold a day note.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a day note</h3><p><code>GET /calendar/days/{date}</code> · <code>getDayNote</code></p><p>returns a day note for a given date. Gets created if doesn't exist.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get the day note starting the week</h3><p><code>GET /calendar/week-first-day/{date}</code> · <code>getWeekFirstDayNote</code></p><p>Returns the day note for the first day of the week containing the given date, honouring the configured first day of week. The note is created if it doesn't exist. This returns a day note, not a week note, so unlike /calendar/weeks/{week} it does not require the enableWeekNote label on the calendar root.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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> <br>Any date within the week, in the format YYYY-MM-DD.</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 starting the week</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a week note</h3><p><code>GET /calendar/weeks/{week}</code> · <code>getWeekNote</code></p><p>Returns a week note for a given ISO week (format YYYY-Www, e.g., 2025-W01). The note is created if it doesn't exist.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>The ISO 8601 week identifier (YYYY-Www). Matches <code>[0-9]{4}-W[0-9]{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; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a month note</h3><p><code>GET /calendar/months/{month}</code> · <code>getMonthNote</code></p><p>Returns a month note for a given month (format YYYY-MM, e.g., 2022-02). The note is created if it doesn't exist.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>[0-9]{4}-[0-9]{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; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a year note</h3><p><code>GET /calendar/years/{year}</code> · <code>getYearNote</code></p><p>Returns a year note for a given year (format YYYY, e.g., 2022). The note is created if it doesn't exist.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>^[0-9]{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; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-key\"></span> Tokens</h2><p>Obtaining and revoking ETAPI tokens with the password.</p><h3>Log in</h3><p><code>POST /auth/login</code> · <code>login</code></p><p>get an ETAPI token based on password for further use with ETAPI. Too many requests from one IP address within a short time, such as failed logins, block that address for a while.</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></td><td><code>string</code> <br>user's password used to e.g. login to Trilium server and/or protect notes</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\">201: auth token</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"authToken\": \"Bc4bFn0Ffiok_4NpbVCDnFz7B2WU+pdhW8B5Ne3DiR5wXrEyqdjgRIsk=\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">429: too many requests</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Log out</h3><p><code>POST /auth/logout</code> · <code>logout</code></p><p>logout (delete/deactivate) an ETAPI token</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: logout successful</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-server\"></span> Application</h2><p>Information about the instance, backups and metrics.</p><h3>Get application info</h3><p><code>GET /app-info</code> · <code>getAppInfo</code></p><p>returns information about the running Trilium instance</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: app info</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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> <br>Trilium version</td></tr><tr><td><code>dbVersion</code></td><td><code>integer (int32)</code> <br>DB version</td></tr><tr><td><code>syncVersion</code></td><td><code>integer (int32)</code> <br>Sync protocol version</td></tr><tr><td><code>buildDate</code></td><td><code>string (date-time)</code> <br>build date</td></tr><tr><td><code>buildRevision</code></td><td><code>string</code> <br>git build revision</td></tr><tr><td><code>dataDirectory</code></td><td><code>string</code> <br>data directory where Trilium stores files</td></tr><tr><td><code>clipperProtocolVersion</code></td><td><code>string</code> <br>version of the supported Trilium Web Clipper protocol</td></tr><tr><td><code>utcDateTime</code></td><td><code>string</code> <br>current UTC date time</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"appVersion\": \"0.50.2\",\n \"dbVersion\": 194,\n \"syncVersion\": 25,\n \"buildDate\": \"2022-02-09T22:52:36+01:00\",\n \"buildRevision\": \"23daaa2387a0655685377f0a541d154aeec2aae8\",\n \"dataDirectory\": \"/home/user/data\",\n \"clipperProtocolVersion\": 1.1,\n \"utcDateTime\": \"2022-03-07T21:54:25.277Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Create a backup</h3><p><code>PUT /backup/{backupName}</code> · <code>createBackup</code></p><p>Create a database backup under a given name</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>backupName</code> <br><em>required</em></td><td><a href=\"#schema-StringId\"><code>StringId</code></a> <br>If the backupName is e.g. \"now\", then the backup will be written to \"backup-now.db\" file</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: backup has been created</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get instance metrics</h3><p><code>GET /metrics</code> · <code>getMetrics</code></p><p>Returns instance and database metrics for monitoring: note, attachment, revision, branch, attribute and blob counts, note and attachment type breakdowns, version information and database size. Counts only — no note titles, content or attributes.</p><p>The same data is served by GET /api/metrics to the web session.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>Response format. Defaults to Prometheus text. 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: instance metrics</p><div class=\"trilium-tab-panel\"><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>text/plain</code>: <code>string</code></p><div class=\"trilium-tab-panel\"><pre><code class=\"language-text-plain\"># HELP trilium_info Trilium instance information\n# TYPE trilium_info gauge\ntrilium_info{version=\"0.99.3\",db_version=\"231\"} 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\"><code>application/json</code>: <code>Metrics</code></p><div class=\"trilium-tab-panel\"><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>version</code></td><td><code>object</code></td></tr><tr><td><code>version.app</code></td><td><code>string</code></td></tr><tr><td><code>version.db</code></td><td><code>integer</code></td></tr><tr><td><code>version.node</code></td><td><code>string</code></td></tr><tr><td><code>version.sync</code></td><td><code>integer</code></td></tr><tr><td><code>version.buildDate</code></td><td><code>string</code></td></tr><tr><td><code>version.buildRevision</code></td><td><code>string</code></td></tr><tr><td><code>database</code></td><td><code>object</code></td></tr><tr><td><code>database.totalNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.deletedNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.activeNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.protectedNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalAttachments</code></td><td><code>integer</code></td></tr><tr><td><code>database.deletedAttachments</code></td><td><code>integer</code></td></tr><tr><td><code>database.activeAttachments</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalRevisions</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalBranches</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalAttributes</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalBlobs</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalEtapiTokens</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalRecentNotes</code></td><td><code>integer</code></td></tr><tr><td><code>noteTypes</code></td><td><code>object</code> <br>Number of active notes per note type</td></tr><tr><td><code>attachmentTypes</code></td><td><code>object</code> <br>Number of active attachments per MIME type</td></tr><tr><td><code>statistics</code></td><td><code>object</code></td></tr><tr><td><code>statistics.oldestNote</code></td><td><code>string | null</code></td></tr><tr><td><code>statistics.newestNote</code></td><td><code>string | null</code></td></tr><tr><td><code>statistics.lastModified</code></td><td><code>string | null</code></td></tr><tr><td><code>statistics.databaseSizeBytes</code></td><td><code>integer | null</code></td></tr><tr><td><code>timestamp</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"version\": {\n \"app\": \"0.99.3\",\n \"db\": 231,\n \"node\": \"v22.14.0\",\n \"sync\": 35,\n \"buildDate\": \"2024-09-07T18:36:34Z\",\n \"buildRevision\": \"7c0d6930fa8f20d269dcfbcbc8f636a25f6bb9a7\"\n },\n \"database\": {\n \"totalNotes\": 0,\n \"deletedNotes\": 0,\n \"activeNotes\": 0,\n \"protectedNotes\": 0,\n \"totalAttachments\": 0,\n \"deletedAttachments\": 0,\n \"activeAttachments\": 0,\n \"totalRevisions\": 0,\n \"totalBranches\": 0,\n \"totalAttributes\": 0,\n \"totalBlobs\": 0,\n \"totalEtapiTokens\": 0,\n \"totalRecentNotes\": 0\n },\n \"noteTypes\": {\n \"text\": 800,\n \"code\": 200\n },\n \"attachmentTypes\": {\n \"image/png\": 45,\n \"application/pdf\": 14\n },\n \"statistics\": {\n \"oldestNote\": \"string\",\n \"newestNote\": \"string\",\n \"lastModified\": \"string\",\n \"databaseSizeBytes\": 0\n },\n \"timestamp\": \"2024-12-01T12:00:00.000Z\"\n}</code></pre></div></div></div></section></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-cube\"></span> Schemas</h2><h3><a id=\"schema-CreateNoteDef\"></a><code>CreateNoteDef</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>Note ID of the parent note in the tree</td></tr><tr><td><code>title</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>text</code>, <code>code</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>book</code>, <code>relationMap</code>, <code>render</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code> <br>this needs to be specified only for note types 'code', 'file', 'image'.</td></tr><tr><td><code>content</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer</code> <br>Position of the note in the parent. Normal ordering is 10, 20, 30 ... So if you want to create a note on the first position, use e.g. 5, for second position 15, for last e.g. 1000000</td></tr><tr><td><code>prefix</code></td><td><code>string</code> <br>Prefix is branch (placement) specific title prefix for the note. Let's say you have your note placed into two different places in the tree, but you want to change the title a bit in one of the placements. For this you can use prefix.</td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code> <br>true if this note (as a folder) should appear expanded</td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>DON'T specify unless you want to force a specific noteId</td></tr><tr><td><code>branchId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>DON'T specify unless you want to force a specific branchId</td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a> <br>Local timestap of the note creation. Specify only if you want to override the default (current datetime in the current timezone/offset).</td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>UTC timestap of the note creation. Specify only if you want to override the default (current datetime).</td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>UTC timestamp of the note's last modification, e.g. to keep the date of a note being migrated from another application. The local dateModified is derived from it. Specify only if you want to override the default (current datetime).</td></tr></tbody></table></figure><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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure><h3><a id=\"schema-Branch\"></a><code>Branch</code></h3><p>Branch places the note into the tree, it represents the relationship between a parent note and child note</p><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure><h3><a id=\"schema-NoteWithBranch\"></a><code>NoteWithBranch</code></h3><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> <br>Branch places the note into the tree, it represents the relationship between a parent note and child note</td></tr></tbody></table></figure><h3><a id=\"schema-Attachment\"></a><code>Attachment</code></h3><p>Attachment is owned by a note, has title and content</p><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the attachment. Returned as \"[protected]\" for protected attachments, since ETAPI cannot open a protected session.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateScheduledForErasureSince</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure><h3><a id=\"schema-CreateAttachment\"></a><code>CreateAttachment</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code> <br>Text content of the attachment, stored as-is. To store binary content, create the attachment without it, then upload the data with <code>PUT /attachments/{attachmentId}/content</code>.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure><h3><a id=\"schema-Attribute\"></a><code>Attribute</code></h3><p>Attribute (Label, Relation) is a key-value record attached to a note.</p><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>type</code></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code></td><td><code>string</code> <br>Matches <code>^[^\\s]+</code>.</td></tr><tr><td><code>value</code></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure><h3><a id=\"schema-AttributeList\"></a><code>AttributeList</code></h3><p>Type: array of <a href=\"#schema-Attribute\"><code>Attribute</code></a></p><h3><a id=\"schema-SearchResponse\"></a><code>SearchResponse</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>results</code> <br><em>required</em></td><td>array of <a href=\"#schema-Note\"><code>Note</code></a></td></tr><tr><td><code>debugInfo</code></td><td><code>object</code> <br>debugging info on parsing the search query enabled with &debug=true parameter</td></tr></tbody></table></figure><h3><a id=\"schema-EntityId\"></a><code>EntityId</code></h3><p>Type: <code>string</code></p><p>Matches <code>[a-zA-Z0-9_]{4,32}</code>.</p><p>Example: <code>evnnmvHTCgIn</code></p><h3><a id=\"schema-StringId\"></a><code>StringId</code></h3><p>Type: <code>string</code></p><p>Matches <code>[a-zA-Z0-9_]{1,32}</code>.</p><p>Example: <code>my_ID</code></p><h3><a id=\"schema-EntityIdList\"></a><code>EntityIdList</code></h3><p>Type: array of <a href=\"#schema-EntityId\"><code>EntityId</code></a></p><h3><a id=\"schema-LocalDateTime\"></a><code>LocalDateTime</code></h3><p>Type: <code>string</code></p><p>Matches <code>[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}[\\+\\-][0-9]{4}</code>.</p><p>Example: <code>2021-12-31 20:18:11.930+0100</code></p><h3><a id=\"schema-UtcDateTime\"></a><code>UtcDateTime</code></h3><p>Type: <code>string</code></p><p>Matches <code>[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z</code>.</p><p>Example: <code>2021-12-31 19:18:11.930Z</code></p><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> <br>Trilium version</td></tr><tr><td><code>dbVersion</code></td><td><code>integer (int32)</code> <br>DB version</td></tr><tr><td><code>syncVersion</code></td><td><code>integer (int32)</code> <br>Sync protocol version</td></tr><tr><td><code>buildDate</code></td><td><code>string (date-time)</code> <br>build date</td></tr><tr><td><code>buildRevision</code></td><td><code>string</code> <br>git build revision</td></tr><tr><td><code>dataDirectory</code></td><td><code>string</code> <br>data directory where Trilium stores files</td></tr><tr><td><code>clipperProtocolVersion</code></td><td><code>string</code> <br>version of the supported Trilium Web Clipper protocol</td></tr><tr><td><code>utcDateTime</code></td><td><code>string</code> <br>current UTC date time</td></tr></tbody></table></figure><h3><a id=\"schema-Error\"></a><code>Error</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure><h3><a id=\"schema-Revision\"></a><code>Revision</code></h3><p>Revision represents a snapshot of note's title and content at some point in the past.</p><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>title</code></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateLastEdited</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateLastEdited</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure><h3><a id=\"schema-RecentChange\"></a><code>RecentChange</code></h3><p>Represents a recent change event (creation, modification, or deletion).</p><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title at the time of the change (may be \"[protected]\" for protected notes)</td></tr><tr><td><code>current_title</code></td><td><code>string</code> <br>Current title of the note (may be \"[protected]\" for protected notes)</td></tr><tr><td><code>current_isDeleted</code></td><td><code>boolean</code> <br>Whether the note is currently deleted</td></tr><tr><td><code>current_deleteId</code></td><td><code>string</code> <br>Delete ID if the note is deleted</td></tr><tr><td><code>current_isProtected</code></td><td><code>boolean</code> <br>Whether the note is protected</td></tr><tr><td><code>utcDate</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>UTC timestamp of the change</td></tr><tr><td><code>date</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a> <br>Local timestamp of the change</td></tr><tr><td><code>canBeUndeleted</code></td><td><code>boolean</code> <br>Whether the note can be undeleted (only present for deleted notes)</td></tr></tbody></table></figure><h3><a id=\"schema-Metrics\"></a><code>Metrics</code></h3><p>Instance and database metrics, as served by GET /etapi/metrics?format=json</p><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>version</code></td><td><code>object</code></td></tr><tr><td><code>version.app</code></td><td><code>string</code></td></tr><tr><td><code>version.db</code></td><td><code>integer</code></td></tr><tr><td><code>version.node</code></td><td><code>string</code></td></tr><tr><td><code>version.sync</code></td><td><code>integer</code></td></tr><tr><td><code>version.buildDate</code></td><td><code>string</code></td></tr><tr><td><code>version.buildRevision</code></td><td><code>string</code></td></tr><tr><td><code>database</code></td><td><code>object</code></td></tr><tr><td><code>database.totalNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.deletedNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.activeNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.protectedNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalAttachments</code></td><td><code>integer</code></td></tr><tr><td><code>database.deletedAttachments</code></td><td><code>integer</code></td></tr><tr><td><code>database.activeAttachments</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalRevisions</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalBranches</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalAttributes</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalBlobs</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalEtapiTokens</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalRecentNotes</code></td><td><code>integer</code></td></tr><tr><td><code>noteTypes</code></td><td><code>object</code> <br>Number of active notes per note type</td></tr><tr><td><code>attachmentTypes</code></td><td><code>object</code> <br>Number of active attachments per MIME type</td></tr><tr><td><code>statistics</code></td><td><code>object</code></td></tr><tr><td><code>statistics.oldestNote</code></td><td><code>string | null</code></td></tr><tr><td><code>statistics.newestNote</code></td><td><code>string | null</code></td></tr><tr><td><code>statistics.lastModified</code></td><td><code>string | null</code></td></tr><tr><td><code>statistics.databaseSizeBytes</code></td><td><code>integer | null</code></td></tr><tr><td><code>timestamp</code></td><td><code>string</code></td></tr></tbody></table></figure>",+ "_help_pgxEVkzLl1OP": "<aside class=\"admonition tip\"><p>For a quick start, consult the <a class=\"reference-link\" href=\"#root/_help_9qPsTWBorUhQ\">API Reference</a>.</p></aside><p>ETAPI is Trilium's public/external REST API. It is available since Trilium v0.50.</p><h2>API clients</h2><p>As an alternative to calling the API directly, there are client libraries to simplify this</p><ul><li><a href=\"https://github.com/Nriver/trilium-py\">trilium-py</a>, you can use Python to communicate with Trilium.</li></ul><h2>Obtaining a token</h2><p>All operations with the REST API have to be authenticated using a token. You can get this token either from Options -> ETAPI or programmatically using the <code>/auth/login</code> REST call (see the <a href=\"https://github.com/TriliumNext/Trilium/blob/main/apps/server/src/assets/etapi.openapi.yaml\">spec</a>). With <a href=\"#root/_help_7DAiwaf8Z7Rz\">multi-factor authentication</a> enabled, <code>/auth/login</code> also needs the one-time password or a recovery code in <code>totpToken</code>.</p><h2>Authentication</h2><h3>Via the <code>Authorization</code> header</h3><pre><code class=\"language-text-x-trilium-auto\">GET https://myserver.com/etapi/app-info\nAuthorization: ETAPITOKEN</code></pre><p>where <code>ETAPITOKEN</code> is the token obtained in the previous step.</p><p>For compatibility with various tools, it's also possible to specify the value of the <code>Authorization</code> header in the format <code>Bearer ETAPITOKEN</code> (since 0.93.0).</p><h3>Basic authentication</h3><p>Since v0.56 you can also use basic auth format:</p><pre><code class=\"language-text-x-trilium-auto\">GET https://myserver.com/etapi/app-info\nAuthorization: Basic BATOKEN</code></pre><ul><li>Where <code>BATOKEN = BASE64(username + ':' + password)</code> - this is a standard Basic Auth serialization</li><li>Where <code>username</code> is \"etapi\"</li><li>And <code>password</code> is the generated ETAPI token described above.</li></ul><p>Basic Auth is meant to be used with tools which support only basic auth.</p><h2>Interaction using Bash scripts</h2><p>It is possible to write simple Bash scripts to interact with Trilium. As an example, here's how to obtain the HTML content of a note:</p><pre><code class=\"language-text-x-trilium-auto\">#!/usr/bin/env bash\n\n# Configuration\nTOKEN=z1vA4fkGxjOR_ZXLrZeqHEFOv65yV3882iFCRtNIK9k9iWrHliITNSLQ=\nSERVER=http://localhost:8080\n\n# Download a note by ID\nNOTE_ID=\"i6ra4ZshJhgN\"\ncurl \"$SERVER/etapi/notes/$NOTE_ID/content\" -H \"Authorization: $TOKEN\" </code></pre><p>Make sure to replace the values of:</p><ul><li><code>TOKEN</code> with your ETAPI token.</li><li><code>SERVER</code> with the correct protocol, host name and port to your Trilium instance.</li><li><code>NOTE_ID</code> with an existing note ID to download.</li></ul><p>As another example, to obtain a .zip export of a note and place it in a directory called <code>out</code>, simply replace the last statement in the script with:</p><pre><code class=\"language-text-x-trilium-auto\">curl -H \"Authorization: $TOKEN\" \\\n\t-X GET \"$SERVER/etapi/notes/$NOTE_ID/export\" \\\n --output \"out/$NOTE_ID.zip\"</code></pre><h2>Uploading binary content</h2><p>A JSON request body can only carry text, so the <code>content</code> field of <code>POST /etapi/attachments</code> stores exactly the string it receives. To upload an image, a PDF or any other binary file, send the raw bytes to the content endpoint with the <code>application/octet-stream</code> content type. The same applies to the content of a note (<code>PUT /etapi/notes/{noteId}/content</code>).</p><p>To attach a file to a note, create the attachment without content, then upload the file to it:</p><pre><code class=\"language-text-x-trilium-auto\">ATTACHMENT_ID=$(curl -s -X POST \"$SERVER/etapi/attachments\" \\\n -H \"Authorization: $TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n -d \"{\\\"ownerId\\\": \\\"$NOTE_ID\\\", \\\"role\\\": \\\"file\\\", \\\"mime\\\": \\\"application/pdf\\\", \\\"title\\\": \\\"report.pdf\\\", \\\"position\\\": 10}\" \\\n | jq -r .attachmentId)\n\ncurl -X PUT \"$SERVER/etapi/attachments/$ATTACHMENT_ID/content\" \\\n -H \"Authorization: $TOKEN\" \\\n -H \"Content-Type: application/octet-stream\" \\\n --data-binary @report.pdf</code></pre><p>Use <code>--data-binary</code> rather than <code>-d</code>, which strips line breaks from the file. For an image, set <code>role</code> to <code>image</code> and <code>mime</code> to the image's type, such as <code>image/png</code>.</p>",+ "_help_9qPsTWBorUhQ": "<p>External Trilium API</p><h2><span class=\"tn-icon bx bx-lock-alt\"></span> Authentication</h2><h3><code>EtapiTokenAuth</code></h3><p>API key in the <code>Authorization</code> header.</p><h3><code>EtapiBasicAuth</code></h3><p>HTTP <code>basic</code> authentication.</p><p>Basic Auth where username is arbitrary string (e.g. \"trilium\", not checked), username is the ETAPI token. To emphasize, do not use Trilium password here (won't work), only the generated ETAPI token (from Options -> ETAPI)</p><h2><span class=\"tn-icon bx bx-note\"></span> Notes</h2><p>Notes and their content, and the import and export of whole subtrees.</p><h3>Create a note</h3><p><code>POST /create-note</code> · <code>createNote</code></p><p>Create a note and place it into the note tree</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-CreateNoteDef\"><code>CreateNoteDef</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>parentNoteId</code> <br><em>required</em></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>Note ID of the parent note in the tree</td></tr><tr><td><code>title</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>text</code>, <code>code</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>book</code>, <code>relationMap</code>, <code>render</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code> <br>this needs to be specified only for note types 'code', 'file', 'image'.</td></tr><tr><td><code>content</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer</code> <br>Position of the note in the parent. Normal ordering is 10, 20, 30 ... So if you want to create a note on the first position, use e.g. 5, for second position 15, for last e.g. 1000000</td></tr><tr><td><code>prefix</code></td><td><code>string</code> <br>Prefix is branch (placement) specific title prefix for the note. Let's say you have your note placed into two different places in the tree, but you want to change the title a bit in one of the placements. For this you can use prefix.</td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code> <br>true if this note (as a folder) should appear expanded</td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>DON'T specify unless you want to force a specific noteId</td></tr><tr><td><code>branchId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>DON'T specify unless you want to force a specific branchId</td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a> <br>Local timestap of the note creation. Specify only if you want to override the default (current datetime in the current timezone/offset).</td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>UTC timestap of the note creation. Specify only if you want to override the default (current datetime).</td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>UTC timestamp of the note's last modification, e.g. to keep the date of a note being migrated from another application. The local dateModified is derived from it. Specify only if you want to override the default (current datetime).</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"application/json\",\n \"content\": \"string\",\n \"notePosition\": 0,\n \"prefix\": \"string\",\n \"isExpanded\": true,\n \"noteId\": \"evnnmvHTCgIn\",\n \"branchId\": \"evnnmvHTCgIn\",\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\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; charset=utf-8</code>: <a href=\"#schema-NoteWithBranch\"><code>NoteWithBranch</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>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> <br>Branch places the note into the tree, it represents the relationship between a parent note and child note</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"note\": {\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n },\n \"branch\": {\n \"branchId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Search notes</h3><p><code>GET /notes</code> · <code>searchNotes</code></p><p>Search notes</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>search</code> <br><em>required</em></td><td><code>string</code> <br>search query string as described in <a href=\"https://triliumnext.github.io/Docs/Wiki/search.html\">https://triliumnext.github.io/Docs/Wiki/search.html</a></td></tr><tr><td><code>fastSearch</code></td><td><code>boolean</code> <br>enable fast search (fulltext doesn't look into content)</td></tr><tr><td><code>includeArchivedNotes</code></td><td><code>boolean</code> <br>search by default ignores archived notes. Set to 'true' to includes archived notes into search results.</td></tr><tr><td><code>ancestorNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>search only in a subtree identified by the subtree noteId. By default whole tree is searched.</td></tr><tr><td><code>ancestorDepth</code></td><td><code>string</code> <br>define how deep in the tree should the notes be searched</td></tr><tr><td><code>orderBy</code></td><td><code>string</code> <br>name of the property/label to order search results by</td></tr><tr><td><code>orderDirection</code></td><td><code>string</code> <br>order direction, ascending or descending. One of <code>asc</code>, <code>desc</code>.</td></tr><tr><td><code>limit</code></td><td><code>integer</code> <br>limit the number of results you want to receive</td></tr><tr><td><code>debug</code></td><td><code>boolean</code> <br>set to true to get debug information in the response (search query parsing)</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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-SearchResponse\"><code>SearchResponse</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>results</code> <br><em>required</em></td><td>array of <a href=\"#schema-Note\"><code>Note</code></a></td></tr><tr><td><code>debugInfo</code></td><td><code>object</code> <br>debugging info on parsing the search query enabled with &debug=true parameter</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"results\": [\n {\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"debugInfo\": {}\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a note</h3><p><code>GET /notes/{noteId}</code> · <code>getNoteById</code></p><p>Returns a note identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Delete a note</h3><p><code>DELETE /notes/{noteId}</code> · <code>deleteNoteById</code></p><p>deletes a single note based on the noteId supplied</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Update a note</h3><p><code>PATCH /notes/{noteId}</code> · <code>patchNoteById</code></p><p>patch a note identified by the noteId with changes in the body</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"blobId\": \"string\",\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: note updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get the content of a note</h3><p><code>GET /notes/{noteId}/content</code> · <code>getNoteContent</code></p><p>Returns note content identified by its ID. The response carries the note's MIME type as its <code>Content-Type</code>.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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\"><ul><li><code>*/*</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Replace the content of a note</h3><p><code>PUT /notes/{noteId}/content</code> · <code>putNoteContentById</code></p><p>Updates note content identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><p>New content of the note. Send text (such as the HTML of a text note) as <code>text/plain</code> and binary data (such as the file of an image or file note) as <code>application/octet-stream</code>; other content types are not accepted.</p><ul><li><code>text/plain</code>: <code>string</code></li><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: note content updated</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section></div><h3>Export a subtree</h3><p><code>GET /notes/{noteId}/export</code> · <code>exportNoteSubtree</code></p><p>Exports ZIP file export of a given note subtree. To export whole document, use \"root\" for noteId</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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>format</code></td><td><code>any</code> <br>One of <code>html</code>, <code>markdown</code>, <code>share</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: export ZIP file</p><div class=\"trilium-tab-panel\"><ul><li><code>application/zip</code>: <code>string (binary)</code></li></ul></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Import a ZIP archive</h3><p><code>POST /notes/{noteId}/import</code> · <code>importZip</code></p><p>Imports ZIP file into a given note.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-NoteWithBranch\"><code>NoteWithBranch</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>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> <br>Branch places the note into the tree, it represents the relationship between a parent note and child note</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"note\": {\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n },\n \"branch\": {\n \"branchId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Restore a deleted note</h3><p><code>POST /notes/{noteId}/undelete</code> · <code>undeleteNote</code></p><p>Restore a deleted note. The note must be deleted and must have at least one undeleted parent.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 restored successfully</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>List recent changes</h3><p><code>GET /notes/history</code> · <code>getNoteHistory</code></p><p>Returns recent changes including note creations, modifications, and deletions</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>ancestorNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>Limit changes to a subtree identified by this note ID. Defaults to \"root\" (all notes).</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: list of recent changes</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: array of <a href=\"#schema-RecentChange\"><code>RecentChange</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"current_title\": \"string\",\n \"current_isDeleted\": true,\n \"current_deleteId\": \"string\",\n \"current_isProtected\": true,\n \"utcDate\": \"2021-12-31 19:18:11.930Z\",\n \"date\": \"2021-12-31 20:18:11.930+0100\",\n \"canBeUndeleted\": true\n }\n]</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-git-branch\"></span> Branches</h2><p>Branches place a note in the tree, under a parent note.</p><h3>Create a branch</h3><p><code>POST /branches</code> · <code>postBranch</code></p><p>Create a branch (clone a note to a different location in the tree). In case there is a branch between parent note and child note already, then this will update the existing branch with prefix, notePosition and isExpanded.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</code></p><p><strong>Request body</strong> (required)</p><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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": 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: existing branch updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">201: branch created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a branch</h3><p><code>GET /branches/{branchId}</code> · <code>getBranchById</code></p><p>Returns a branch identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Delete a branch</h3><p><code>DELETE /branches/{branchId}</code> · <code>deleteBranchById</code></p><p>deletes a branch based on the branchId supplied. If this is the last branch of the (child) note, then the note is deleted as well.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 deleted</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Update a branch</h3><p><code>PATCH /branches/{branchId}</code> · <code>patchBranchById</code></p><p>patch a branch identified by the branchId with changes in the body. Only prefix and notePosition can be updated. If you want to update other properties, you need to delete the old branch and create a new one.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": 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: branch updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"branchId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"parentNoteId\": \"evnnmvHTCgIn\",\n \"prefix\": \"string\",\n \"notePosition\": 0,\n \"isExpanded\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Refresh the order of child notes</h3><p><code>POST /refresh-note-ordering/{parentNoteId}</code> · <code>postRefreshNoteOrdering</code></p><p>notePositions in branches are not automatically pushed to connected clients and need a specific instruction. If you want your changes to be in effect immediately, call this service after setting branches' notePosition. Note that you need to supply \"parentNoteId\" of branch(es) with changed positions.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 ordering refreshed</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-purchase-tag\"></span> Attributes</h2><p>Labels and relations of a note.</p><h3>Create an attribute</h3><p><code>POST /attributes</code> · <code>postAttribute</code></p><p>create an attribute for a given note</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>type</code></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code></td><td><code>string</code> <br>Matches <code>^[^\\s]+</code>.</td></tr><tr><td><code>value</code></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\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 created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>type</code></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code></td><td><code>string</code> <br>Matches <code>^[^\\s]+</code>.</td></tr><tr><td><code>value</code></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get an attribute</h3><p><code>GET /attributes/{attributeId}</code> · <code>getAttributeById</code></p><p>Returns an attribute identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>attributeId</code> <br><em>required</em></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>type</code></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code></td><td><code>string</code> <br>Matches <code>^[^\\s]+</code>.</td></tr><tr><td><code>value</code></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Delete an attribute</h3><p><code>DELETE /attributes/{attributeId}</code> · <code>deleteAttributeById</code></p><p>deletes an attribute based on the attributeId supplied.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>attributeId</code> <br><em>required</em></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></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><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Update an attribute</h3><p><code>PATCH /attributes/{attributeId}</code> · <code>patchAttributeById</code></p><p>patch an attribute identified by the attributeId with changes in the body. For labels, only value and position can be updated. For relations, only position can be updated. If you want to modify other properties, you need to delete the old attribute and create a new one.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>attributeId</code> <br><em>required</em></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>type</code></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code></td><td><code>string</code> <br>Matches <code>^[^\\s]+</code>.</td></tr><tr><td><code>value</code></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\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: attribute updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>type</code></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code></td><td><code>string</code> <br>Matches <code>^[^\\s]+</code>.</td></tr><tr><td><code>value</code></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-paperclip\"></span> Attachments</h2><p>Files attached to a note.</p><h3>List the attachments of a note</h3><p><code>GET /notes/{noteId}/attachments</code> · <code>getNoteAttachments</code></p><p>Returns all attachments for a note identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: list of attachments</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: array of <a href=\"#schema-Attachment\"><code>Attachment</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"attachmentId\": \"evnnmvHTCgIn\",\n \"ownerId\": \"evnnmvHTCgIn\",\n \"role\": \"string\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"position\": 0,\n \"blobId\": \"string\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateScheduledForErasureSince\": \"2021-12-31 19:18:11.930Z\",\n \"contentLength\": 0\n }\n]</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Create an attachment</h3><p><code>POST /attachments</code> · <code>postAttachment</code></p><p>create an attachment</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</code></p><p><strong>Request body</strong> (required)</p><ul><li><code>application/json</code>: <a href=\"#schema-CreateAttachment\"><code>CreateAttachment</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>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code> <br>Text content of the attachment, stored as-is. To store binary content, create the attachment without it, then upload the data with <code>PUT /attachments/{attachmentId}/content</code>.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"ownerId\": \"evnnmvHTCgIn\",\n \"role\": \"string\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"content\": \"string\",\n \"position\": 0\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 created</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the attachment. Returned as \"[protected]\" for protected attachments, since ETAPI cannot open a protected session.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateScheduledForErasureSince</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"evnnmvHTCgIn\",\n \"ownerId\": \"evnnmvHTCgIn\",\n \"role\": \"string\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"position\": 0,\n \"blobId\": \"string\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateScheduledForErasureSince\": \"2021-12-31 19:18:11.930Z\",\n \"contentLength\": 0\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get an attachment</h3><p><code>GET /attachments/{attachmentId}</code> · <code>getAttachmentById</code></p><p>Returns an attachment identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the attachment. Returned as \"[protected]\" for protected attachments, since ETAPI cannot open a protected session.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateScheduledForErasureSince</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"evnnmvHTCgIn\",\n \"ownerId\": \"evnnmvHTCgIn\",\n \"role\": \"string\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"position\": 0,\n \"blobId\": \"string\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateScheduledForErasureSince\": \"2021-12-31 19:18:11.930Z\",\n \"contentLength\": 0\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Delete an attachment</h3><p><code>DELETE /attachments/{attachmentId}</code> · <code>deleteAttachmentById</code></p><p>deletes an attachment based on the attachmentId supplied.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Update an attachment</h3><p><code>PATCH /attachments/{attachmentId}</code> · <code>patchAttachmentById</code></p><p>patch an attachment identified by the attachmentId with changes in the body. Only role, mime, title, and position are patchable.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the attachment. Returned as \"[protected]\" for protected attachments, since ETAPI cannot open a protected session.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateScheduledForErasureSince</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"ownerId\": \"evnnmvHTCgIn\",\n \"role\": \"string\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"position\": 0,\n \"blobId\": \"string\",\n \"contentLength\": 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: attribute updated</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the attachment. Returned as \"[protected]\" for protected attachments, since ETAPI cannot open a protected session.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateScheduledForErasureSince</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"attachmentId\": \"evnnmvHTCgIn\",\n \"ownerId\": \"evnnmvHTCgIn\",\n \"role\": \"string\",\n \"mime\": \"string\",\n \"title\": \"string\",\n \"position\": 0,\n \"blobId\": \"string\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateScheduledForErasureSince\": \"2021-12-31 19:18:11.930Z\",\n \"contentLength\": 0\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get the content of an attachment</h3><p><code>GET /attachments/{attachmentId}/content</code> · <code>getAttachmentContent</code></p><p>Returns attachment content identified by its ID. The response carries the attachment's MIME type as its <code>Content-Type</code>.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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>*/*</code>: <code>string (binary)</code></li></ul></div></section></div><h3>Replace the content of an attachment</h3><p><code>PUT /attachments/{attachmentId}/content</code> · <code>putAttachmentContentById</code></p><p>Updates attachment content identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr></tbody></table></figure><p><strong>Request body</strong> (required)</p><p>New content of the attachment. Send text as <code>text/plain</code> and binary data (such as an image or a PDF) as <code>application/octet-stream</code>; other content types are not accepted.</p><ul><li><code>text/plain</code>: <code>string</code></li><li><code>application/octet-stream</code>: <code>string (binary)</code></li></ul><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: attachment content updated</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>Snapshots of a note's content.</p><h3>Create a revision</h3><p><code>POST /notes/{noteId}/revision</code> · <code>createRevision</code></p><p>Create a note revision for the given note</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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>format</code></td><td><code>any</code> <br>One of <code>html</code>, <code>markdown</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 has been created</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>List the revisions of a note</h3><p><code>GET /notes/{noteId}/revisions</code> · <code>getNoteRevisions</code></p><p>Returns the revisions of a note identified by its ID. Protected revisions are omitted, since they cannot be read through ETAPI individually either.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: list of revisions</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: array of <a href=\"#schema-Revision\"><code>Revision</code></a></li></ul><pre><code class=\"language-application-json\">[\n {\n \"revisionId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateLastEdited\": \"2021-12-31 20:18:11.930+0100\",\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateLastEdited\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\",\n \"contentLength\": 0\n }\n]</code></pre></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a revision</h3><p><code>GET /revisions/{revisionId}</code> · <code>getRevisionById</code></p><p>Returns a revision identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>title</code></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateLastEdited</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateLastEdited</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"revisionId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"title\": \"string\",\n \"blobId\": \"string\",\n \"dateLastEdited\": \"2021-12-31 20:18:11.930+0100\",\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateLastEdited\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\",\n \"contentLength\": 0\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get the content of a revision</h3><p><code>GET /revisions/{revisionId}/content</code> · <code>getRevisionContent</code></p><p>Returns revision content identified by its ID</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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><a href=\"#schema-EntityId\"><code>EntityId</code></a></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 response</p><div class=\"trilium-tab-panel\"><ul><li><code>text/html</code>: <code>string</code></li></ul></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-calendar\"></span> Calendar</h2><p>Day, week, month and year notes of the journal, and the inbox note.</p><h3>Get the inbox note</h3><p><code>GET /inbox/{date}</code> · <code>getInboxNote</code></p><p>returns an \"inbox\" note, into which note can be created. Date will be used depending on whether the inbox is a fixed note (identified with #inbox label) or a day note in a journal. A database with neither returns the root note, and ignores the date, rather than creating a journal to hold a day note.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a day note</h3><p><code>GET /calendar/days/{date}</code> · <code>getDayNote</code></p><p>returns a day note for a given date. Gets created if doesn't exist.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get the day note starting the week</h3><p><code>GET /calendar/week-first-day/{date}</code> · <code>getWeekFirstDayNote</code></p><p>Returns the day note for the first day of the week containing the given date, honouring the configured first day of week. The note is created if it doesn't exist. This returns a day note, not a week note, so unlike /calendar/weeks/{week} it does not require the enableWeekNote label on the calendar root.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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> <br>Any date within the week, in the format YYYY-MM-DD.</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 starting the week</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a week note</h3><p><code>GET /calendar/weeks/{week}</code> · <code>getWeekNote</code></p><p>Returns a week note for a given ISO week (format YYYY-Www, e.g., 2025-W01). The note is created if it doesn't exist.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>The ISO 8601 week identifier (YYYY-Www). Matches <code>[0-9]{4}-W[0-9]{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; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a month note</h3><p><code>GET /calendar/months/{month}</code> · <code>getMonthNote</code></p><p>Returns a month note for a given month (format YYYY-MM, e.g., 2022-02). The note is created if it doesn't exist.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>[0-9]{4}-[0-9]{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; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get a year note</h3><p><code>GET /calendar/years/{year}</code> · <code>getYearNote</code></p><p>Returns a year note for a given year (format YYYY, e.g., 2022). The note is created if it doesn't exist.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>^[0-9]{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; charset=utf-8</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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"noteId\": \"evnnmvHTCgIn\",\n \"title\": \"string\",\n \"type\": \"text\",\n \"mime\": \"string\",\n \"isProtected\": true,\n \"blobId\": \"string\",\n \"attributes\": [\n {\n \"attributeId\": \"evnnmvHTCgIn\",\n \"noteId\": \"evnnmvHTCgIn\",\n \"type\": \"label\",\n \"name\": \"shareCss\",\n \"value\": \"string\",\n \"position\": 0,\n \"isInheritable\": true,\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n }\n ],\n \"parentNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childNoteIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"parentBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"childBranchIds\": [\n \"evnnmvHTCgIn\"\n ],\n \"dateCreated\": \"2021-12-31 20:18:11.930+0100\",\n \"dateModified\": \"2021-12-31 20:18:11.930+0100\",\n \"utcDateCreated\": \"2021-12-31 19:18:11.930Z\",\n \"utcDateModified\": \"2021-12-31 19:18:11.930Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-key\"></span> Tokens</h2><p>Obtaining and revoking ETAPI tokens with the password.</p><h3>Log in</h3><p><code>POST /auth/login</code> · <code>login</code></p><p>get an ETAPI token based on password for further use with ETAPI. Too many requests from one IP address within a short time, such as failed logins, block that address for a while.</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></td><td><code>string</code> <br>user's password used to e.g. login to Trilium server and/or protect notes</td></tr><tr><td><code>totpToken</code></td><td><code>string</code> <br>the current TOTP code, or one of the recovery codes; required when multi-factor authentication with TOTP is enabled. Each code is accepted once.</td></tr><tr><td><code>tokenName</code></td><td><code>string</code> <br>name of the created token, shown in the list of ETAPI tokens</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"password\": \"string\",\n \"totpToken\": \"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: auth token</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"authToken\": \"Bc4bFn0Ffiok_4NpbVCDnFz7B2WU+pdhW8B5Ne3DiR5wXrEyqdjgRIsk=\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">401: wrong credentials: <code>WRONG_PASSWORD</code>, <code>TOTP_REQUIRED</code> (TOTP is enabled and no <code>totpToken</code> was sent) or <code>WRONG_TOTP</code></p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">429: too many requests</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Log out</h3><p><code>POST /auth/logout</code> · <code>logout</code></p><p>logout (delete/deactivate) an ETAPI token</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: logout successful</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-server\"></span> Application</h2><p>Information about the instance, backups and metrics.</p><h3>Get application info</h3><p><code>GET /app-info</code> · <code>getAppInfo</code></p><p>returns information about the running Trilium instance</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</code></p><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">200: app info</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</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> <br>Trilium version</td></tr><tr><td><code>dbVersion</code></td><td><code>integer (int32)</code> <br>DB version</td></tr><tr><td><code>syncVersion</code></td><td><code>integer (int32)</code> <br>Sync protocol version</td></tr><tr><td><code>buildDate</code></td><td><code>string (date-time)</code> <br>build date</td></tr><tr><td><code>buildRevision</code></td><td><code>string</code> <br>git build revision</td></tr><tr><td><code>dataDirectory</code></td><td><code>string</code> <br>data directory where Trilium stores files</td></tr><tr><td><code>clipperProtocolVersion</code></td><td><code>string</code> <br>version of the supported Trilium Web Clipper protocol</td></tr><tr><td><code>utcDateTime</code></td><td><code>string</code> <br>current UTC date time</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"appVersion\": \"0.50.2\",\n \"dbVersion\": 194,\n \"syncVersion\": 25,\n \"buildDate\": \"2022-02-09T22:52:36+01:00\",\n \"buildRevision\": \"23daaa2387a0655685377f0a541d154aeec2aae8\",\n \"dataDirectory\": \"/home/user/data\",\n \"clipperProtocolVersion\": 1.1,\n \"utcDateTime\": \"2022-03-07T21:54:25.277Z\"\n}</code></pre></div></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Create a backup</h3><p><code>PUT /backup/{backupName}</code> · <code>createBackup</code></p><p>Create a database backup under a given name</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>backupName</code> <br><em>required</em></td><td><a href=\"#schema-StringId\"><code>StringId</code></a> <br>If the backupName is e.g. \"now\", then the backup will be written to \"backup-now.db\" file</td></tr></tbody></table></figure><p><strong>Responses</strong></p><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">204: backup has been created</p><div class=\"trilium-tab-panel\"><p>No content.</p></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h3>Get instance metrics</h3><p><code>GET /metrics</code> · <code>getMetrics</code></p><p>Returns instance and database metrics for monitoring: note, attachment, revision, branch, attribute and blob counts, note and attachment type breakdowns, version information and database size. Counts only — no note titles, content or attributes.</p><p>The same data is served by GET /api/metrics to the web session.</p><p><strong>Authorization</strong>: <code>EtapiTokenAuth</code> or <code>EtapiBasicAuth</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>Response format. Defaults to Prometheus text. 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: instance metrics</p><div class=\"trilium-tab-panel\"><div class=\"trilium-tabs\"><section class=\"trilium-tab\"><p class=\"trilium-tab-title\"><code>text/plain</code>: <code>string</code></p><div class=\"trilium-tab-panel\"><pre><code class=\"language-text-plain\"># HELP trilium_info Trilium instance information\n# TYPE trilium_info gauge\ntrilium_info{version=\"0.99.3\",db_version=\"231\"} 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\"><code>application/json</code>: <code>Metrics</code></p><div class=\"trilium-tab-panel\"><div class=\"trilium-multicolumn-layout\" data-trilium-column-ratios=\"1-1\"><div class=\"trilium-multicolumn-column\"><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>version</code></td><td><code>object</code></td></tr><tr><td><code>version.app</code></td><td><code>string</code></td></tr><tr><td><code>version.db</code></td><td><code>integer</code></td></tr><tr><td><code>version.node</code></td><td><code>string</code></td></tr><tr><td><code>version.sync</code></td><td><code>integer</code></td></tr><tr><td><code>version.buildDate</code></td><td><code>string</code></td></tr><tr><td><code>version.buildRevision</code></td><td><code>string</code></td></tr><tr><td><code>database</code></td><td><code>object</code></td></tr><tr><td><code>database.totalNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.deletedNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.activeNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.protectedNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalAttachments</code></td><td><code>integer</code></td></tr><tr><td><code>database.deletedAttachments</code></td><td><code>integer</code></td></tr><tr><td><code>database.activeAttachments</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalRevisions</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalBranches</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalAttributes</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalBlobs</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalEtapiTokens</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalRecentNotes</code></td><td><code>integer</code></td></tr><tr><td><code>noteTypes</code></td><td><code>object</code> <br>Number of active notes per note type</td></tr><tr><td><code>attachmentTypes</code></td><td><code>object</code> <br>Number of active attachments per MIME type</td></tr><tr><td><code>statistics</code></td><td><code>object</code></td></tr><tr><td><code>statistics.oldestNote</code></td><td><code>string | null</code></td></tr><tr><td><code>statistics.newestNote</code></td><td><code>string | null</code></td></tr><tr><td><code>statistics.lastModified</code></td><td><code>string | null</code></td></tr><tr><td><code>statistics.databaseSizeBytes</code></td><td><code>integer | null</code></td></tr><tr><td><code>timestamp</code></td><td><code>string</code></td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"version\": {\n \"app\": \"0.99.3\",\n \"db\": 231,\n \"node\": \"v22.14.0\",\n \"sync\": 35,\n \"buildDate\": \"2024-09-07T18:36:34Z\",\n \"buildRevision\": \"7c0d6930fa8f20d269dcfbcbc8f636a25f6bb9a7\"\n },\n \"database\": {\n \"totalNotes\": 0,\n \"deletedNotes\": 0,\n \"activeNotes\": 0,\n \"protectedNotes\": 0,\n \"totalAttachments\": 0,\n \"deletedAttachments\": 0,\n \"activeAttachments\": 0,\n \"totalRevisions\": 0,\n \"totalBranches\": 0,\n \"totalAttributes\": 0,\n \"totalBlobs\": 0,\n \"totalEtapiTokens\": 0,\n \"totalRecentNotes\": 0\n },\n \"noteTypes\": {\n \"text\": 800,\n \"code\": 200\n },\n \"attachmentTypes\": {\n \"image/png\": 45,\n \"application/pdf\": 14\n },\n \"statistics\": {\n \"oldestNote\": \"string\",\n \"newestNote\": \"string\",\n \"lastModified\": \"string\",\n \"databaseSizeBytes\": 0\n },\n \"timestamp\": \"2024-12-01T12:00:00.000Z\"\n}</code></pre></div></div></div></section></div></div></section><section class=\"trilium-tab\"><p class=\"trilium-tab-title\">default: unexpected error</p><div class=\"trilium-tab-panel\"><ul><li><code>application/json; charset=utf-8</code>: <a href=\"#schema-Error\"><code>Error</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>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure></div><div class=\"trilium-multicolumn-column\"><pre><code class=\"language-application-json\">{\n \"status\": 400,\n \"code\": \"NOTE_IS_PROTECTED\",\n \"message\": \"Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI\"\n}</code></pre></div></div></div></section></div><h2><span class=\"tn-icon bx bx-cube\"></span> Schemas</h2><h3><a id=\"schema-CreateNoteDef\"></a><code>CreateNoteDef</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>parentNoteId</code> <br><em>required</em></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>Note ID of the parent note in the tree</td></tr><tr><td><code>title</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>text</code>, <code>code</code>, <code>file</code>, <code>image</code>, <code>search</code>, <code>book</code>, <code>relationMap</code>, <code>render</code>.</td></tr><tr><td><code>mime</code></td><td><code>string</code> <br>this needs to be specified only for note types 'code', 'file', 'image'.</td></tr><tr><td><code>content</code> <br><em>required</em></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer</code> <br>Position of the note in the parent. Normal ordering is 10, 20, 30 ... So if you want to create a note on the first position, use e.g. 5, for second position 15, for last e.g. 1000000</td></tr><tr><td><code>prefix</code></td><td><code>string</code> <br>Prefix is branch (placement) specific title prefix for the note. Let's say you have your note placed into two different places in the tree, but you want to change the title a bit in one of the placements. For this you can use prefix.</td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code> <br>true if this note (as a folder) should appear expanded</td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>DON'T specify unless you want to force a specific noteId</td></tr><tr><td><code>branchId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>DON'T specify unless you want to force a specific branchId</td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a> <br>Local timestap of the note creation. Specify only if you want to override the default (current datetime in the current timezone/offset).</td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>UTC timestap of the note creation. Specify only if you want to override the default (current datetime).</td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>UTC timestamp of the note's last modification, e.g. to keep the date of a note being migrated from another application. The local dateModified is derived from it. Specify only if you want to override the default (current datetime).</td></tr></tbody></table></figure><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></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the note. Returned as \"[protected]\" for protected notes, since ETAPI cannot open a protected session.</td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>attributes</code></td><td><a href=\"#schema-AttributeList\"><code>AttributeList</code></a></td></tr><tr><td><code>parentNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childNoteIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>parentBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>childBranchIds</code></td><td><a href=\"#schema-EntityIdList\"><code>EntityIdList</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>Writable through PATCH, e.g. to restore a migrated note's date after its content was rewritten. The local dateModified is derived from it.</td></tr></tbody></table></figure><h3><a id=\"schema-Branch\"></a><code>Branch</code></h3><p>Branch places the note into the tree, it represents the relationship between a parent note and child note</p><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>branchId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>parentNoteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the parent note</td></tr><tr><td><code>prefix</code></td><td><code>string</code></td></tr><tr><td><code>notePosition</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isExpanded</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure><h3><a id=\"schema-NoteWithBranch\"></a><code>NoteWithBranch</code></h3><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> <br>Branch places the note into the tree, it represents the relationship between a parent note and child note</td></tr></tbody></table></figure><h3><a id=\"schema-Attachment\"></a><code>Attachment</code></h3><p>Attachment is owned by a note, has title and content</p><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attachmentId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title of the attachment. Returned as \"[protected]\" for protected attachments, since ETAPI cannot open a protected session.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateModified</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateScheduledForErasureSince</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure><h3><a id=\"schema-CreateAttachment\"></a><code>CreateAttachment</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>ownerId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the owner of the attachment, is either noteId or revisionId</td></tr><tr><td><code>role</code></td><td><code>string</code></td></tr><tr><td><code>mime</code></td><td><code>string</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td></tr><tr><td><code>content</code></td><td><code>string</code> <br>Text content of the attachment, stored as-is. To store binary content, create the attachment without it, then upload the data with <code>PUT /attachments/{attachmentId}/content</code>.</td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure><h3><a id=\"schema-Attribute\"></a><code>Attribute</code></h3><p>Attribute (Label, Relation) is a key-value record attached to a note.</p><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>attributeId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a> <br>identifies the child note</td></tr><tr><td><code>type</code></td><td><code>string</code> <br>One of <code>label</code>, <code>relation</code>.</td></tr><tr><td><code>name</code></td><td><code>string</code> <br>Matches <code>^[^\\s]+</code>.</td></tr><tr><td><code>value</code></td><td><code>string</code></td></tr><tr><td><code>position</code></td><td><code>integer (int32)</code></td></tr><tr><td><code>isInheritable</code></td><td><code>boolean</code></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr></tbody></table></figure><h3><a id=\"schema-AttributeList\"></a><code>AttributeList</code></h3><p>Type: array of <a href=\"#schema-Attribute\"><code>Attribute</code></a></p><h3><a id=\"schema-SearchResponse\"></a><code>SearchResponse</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>results</code> <br><em>required</em></td><td>array of <a href=\"#schema-Note\"><code>Note</code></a></td></tr><tr><td><code>debugInfo</code></td><td><code>object</code> <br>debugging info on parsing the search query enabled with &debug=true parameter</td></tr></tbody></table></figure><h3><a id=\"schema-EntityId\"></a><code>EntityId</code></h3><p>Type: <code>string</code></p><p>Matches <code>[a-zA-Z0-9_]{4,32}</code>.</p><p>Example: <code>evnnmvHTCgIn</code></p><h3><a id=\"schema-StringId\"></a><code>StringId</code></h3><p>Type: <code>string</code></p><p>Matches <code>[a-zA-Z0-9_]{1,32}</code>.</p><p>Example: <code>my_ID</code></p><h3><a id=\"schema-EntityIdList\"></a><code>EntityIdList</code></h3><p>Type: array of <a href=\"#schema-EntityId\"><code>EntityId</code></a></p><h3><a id=\"schema-LocalDateTime\"></a><code>LocalDateTime</code></h3><p>Type: <code>string</code></p><p>Matches <code>[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}[\\+\\-][0-9]{4}</code>.</p><p>Example: <code>2021-12-31 20:18:11.930+0100</code></p><h3><a id=\"schema-UtcDateTime\"></a><code>UtcDateTime</code></h3><p>Type: <code>string</code></p><p>Matches <code>[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z</code>.</p><p>Example: <code>2021-12-31 19:18:11.930Z</code></p><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> <br>Trilium version</td></tr><tr><td><code>dbVersion</code></td><td><code>integer (int32)</code> <br>DB version</td></tr><tr><td><code>syncVersion</code></td><td><code>integer (int32)</code> <br>Sync protocol version</td></tr><tr><td><code>buildDate</code></td><td><code>string (date-time)</code> <br>build date</td></tr><tr><td><code>buildRevision</code></td><td><code>string</code> <br>git build revision</td></tr><tr><td><code>dataDirectory</code></td><td><code>string</code> <br>data directory where Trilium stores files</td></tr><tr><td><code>clipperProtocolVersion</code></td><td><code>string</code> <br>version of the supported Trilium Web Clipper protocol</td></tr><tr><td><code>utcDateTime</code></td><td><code>string</code> <br>current UTC date time</td></tr></tbody></table></figure><h3><a id=\"schema-Error\"></a><code>Error</code></h3><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>status</code> <br><em>required</em></td><td><code>integer (int32)</code> <br>HTTP status, identical to the one given in HTTP response</td></tr><tr><td><code>code</code> <br><em>required</em></td><td><code>string</code> <br>stable string constant</td></tr><tr><td><code>message</code> <br><em>required</em></td><td><code>string</code> <br>Human readable error, potentially with more details,</td></tr></tbody></table></figure><h3><a id=\"schema-Revision\"></a><code>Revision</code></h3><p>Revision represents a snapshot of note's title and content at some point in the past.</p><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>revisionId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>type</code></td><td><code>string</code> <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>webView</code>, <code>shortcut</code>, <code>doc</code>, <code>contentWidget</code>, <code>launcher</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>title</code></td><td><code>string</code></td></tr><tr><td><code>blobId</code></td><td><code>string</code> <br>ID of the blob object which effectively serves as a content hash</td></tr><tr><td><code>dateLastEdited</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>dateCreated</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a></td></tr><tr><td><code>utcDateLastEdited</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateCreated</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>utcDateModified</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a></td></tr><tr><td><code>contentLength</code></td><td><code>integer (int32)</code></td></tr></tbody></table></figure><h3><a id=\"schema-RecentChange\"></a><code>RecentChange</code></h3><p>Represents a recent change event (creation, modification, or deletion).</p><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>noteId</code></td><td><a href=\"#schema-EntityId\"><code>EntityId</code></a></td></tr><tr><td><code>title</code></td><td><code>string</code> <br>Title at the time of the change (may be \"[protected]\" for protected notes)</td></tr><tr><td><code>current_title</code></td><td><code>string</code> <br>Current title of the note (may be \"[protected]\" for protected notes)</td></tr><tr><td><code>current_isDeleted</code></td><td><code>boolean</code> <br>Whether the note is currently deleted</td></tr><tr><td><code>current_deleteId</code></td><td><code>string</code> <br>Delete ID if the note is deleted</td></tr><tr><td><code>current_isProtected</code></td><td><code>boolean</code> <br>Whether the note is protected</td></tr><tr><td><code>utcDate</code></td><td><a href=\"#schema-UtcDateTime\"><code>UtcDateTime</code></a> <br>UTC timestamp of the change</td></tr><tr><td><code>date</code></td><td><a href=\"#schema-LocalDateTime\"><code>LocalDateTime</code></a> <br>Local timestamp of the change</td></tr><tr><td><code>canBeUndeleted</code></td><td><code>boolean</code> <br>Whether the note can be undeleted (only present for deleted notes)</td></tr></tbody></table></figure><h3><a id=\"schema-Metrics\"></a><code>Metrics</code></h3><p>Instance and database metrics, as served by GET /etapi/metrics?format=json</p><figure class=\"table\"><table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td><code>version</code></td><td><code>object</code></td></tr><tr><td><code>version.app</code></td><td><code>string</code></td></tr><tr><td><code>version.db</code></td><td><code>integer</code></td></tr><tr><td><code>version.node</code></td><td><code>string</code></td></tr><tr><td><code>version.sync</code></td><td><code>integer</code></td></tr><tr><td><code>version.buildDate</code></td><td><code>string</code></td></tr><tr><td><code>version.buildRevision</code></td><td><code>string</code></td></tr><tr><td><code>database</code></td><td><code>object</code></td></tr><tr><td><code>database.totalNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.deletedNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.activeNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.protectedNotes</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalAttachments</code></td><td><code>integer</code></td></tr><tr><td><code>database.deletedAttachments</code></td><td><code>integer</code></td></tr><tr><td><code>database.activeAttachments</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalRevisions</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalBranches</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalAttributes</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalBlobs</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalEtapiTokens</code></td><td><code>integer</code></td></tr><tr><td><code>database.totalRecentNotes</code></td><td><code>integer</code></td></tr><tr><td><code>noteTypes</code></td><td><code>object</code> <br>Number of active notes per note type</td></tr><tr><td><code>attachmentTypes</code></td><td><code>object</code> <br>Number of active attachments per MIME type</td></tr><tr><td><code>statistics</code></td><td><code>object</code></td></tr><tr><td><code>statistics.oldestNote</code></td><td><code>string | null</code></td></tr><tr><td><code>statistics.newestNote</code></td><td><code>string | null</code></td></tr><tr><td><code>statistics.lastModified</code></td><td><code>string | null</code></td></tr><tr><td><code>statistics.databaseSizeBytes</code></td><td><code>integer | null</code></td></tr><tr><td><code>timestamp</code></td><td><code>string</code></td></tr></tbody></table></figure>","_help_47ZrP6FNuoG8": "<p>When a new note is created, its name is by default \"new note\". In some cases, it can be desirable to have a different or even a dynamic default note title.</p><p>For this use case, Trilium (since v0.52) supports <code>#titleTemplate</code> <a href=\"#root/_help_zEY4DaJG4YT5\">label</a>. You can create such a label for a given note, assign it a value, and this value will be used as a default title when creating child notes. As with other labels, you can make it inheritable to apply recursively, and you can even place it on the root note to have it applied globally everywhere.</p><p>As an example use case, imagine you collect books you've read in a given year like this:</p><ul><li>2022 Books<ul><li>Neal Stephenson: Anathem, 2008</li><li>Franz Kafka: Die Verwandlung, 1915</li></ul></li></ul><p>Now, to the parent note \"2022 Books\" you can assign label <code>#titleTemplate=\"[Author name]: [Book title], [Publication year]\"</code>.</p><p>And all children of \"2022 Books\" will be created with initial title \"[Author name]: [Book title], [Publication year]\". There's no artificial intelligence here, the idea is to just prompt you to manually fill in the pieces of information into the note title by yourself.</p><h2>Titles set by a template</h2><p>A template can name the notes created from it, wherever they are created. To do so, add a <code>#template:titleTemplate</code> label to the template note, for example <code>#template:titleTemplate=\"Meeting ${now.format('YYYY-MM-DD')}\"</code> on a <em>Meeting</em> template.</p><ul><li>It applies both when the template is picked explicitly and when it comes from a parent's <code>~child:template</code>. See <a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>.</li><li>It takes precedence over the parent's <code>#titleTemplate</code>. A title typed in by the user always wins.</li><li>It can be inherited from the template's ancestors in the tree (for example, a folder holding several templates), in which case a label owned by the template itself takes precedence. A note created from a template and later marked as a template does not keep that template's title.</li><li>Its value is evaluated the same way as <code>#titleTemplate</code>, with <code>parentNote</code> being the parent of the new note.</li></ul><h2>Dynamic value</h2><p>The value of <code>#titleTemplate</code> is evaluated at the point of note's creation as a JavaScript string, which means it can be enriched with the help of JS string interpolation with dynamic data.</p><p>Second variable injected is <code>parentNote</code> which gives access to the parent <a href=\"#root/_help_Q2z6av6JZVWm\"><code>FNote</code></a>.</p><p>See also <a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a> which provides similar capabilities, including default note's content.</p><h3>Examples</h3><ul><li>Imagine you collect server outage incidents and write some notes. It looks like this:<ul><li>Incidents<ul><li>2022-05-09: System crash</li><li>2022-05-15: Backup delay</li></ul></li><li>You can automatize the date assignment by assigning a label <code>#titleTemplate=\"${now.format('YYYY-MM-DD')}: \"</code> to the parent note \"Incidents\". Whenever a new child note is created, the title template is evaluated with the injected <a href=\"https://day.js.org/docs/en/display/format\">now</a> object.</li></ul></li><li>To use a parent's attribute in the title of new notes: <code>#titleTemplate=\"${parentNote.getLabelValue('authorName')}'s literary works\"</code></li><li>To mirror the parent's note title: <code>${parentNote.title}</code></li></ul>","_help_wX4HbRucYSDD": "<p>Your Trilium data is stored in a <a href=\"https://www.sqlite.org\">SQLite</a> database which contains all notes, tree structure, metadata, and most of the configuration. The database file is named <code>document.db</code> and is stored in the application's default <a href=\"#root/_help_tAassRL4RSQL\">Data directory</a>.</p><h2>Demo Notes</h2><p>When first starting Trilium, it will provide a set of notes to showcase various features of the application.</p><p>For more information see <a class=\"reference-link\" href=\"#root/_help_6tZeKvSHEUiB\">Demo Notes</a>.</p><h2>Manually Modifying the Database</h2><p>Trilium provides a lot of flexibility, and with it, opportunities for advanced users to tweak it. If you need to explore or modify the database directly, you can use a tool such as <a href=\"https://sqlitebrowser.org/\">SQLite Browser</a> to work directly on the database file.</p><p>See <a href=\"#root/_help_oyIAJ9PvvwHX\">Manually altering the database</a> for more information.</p><h2>How to Reset the Database</h2><p>If you want to start again and:</p><ul><li>Create and switch to a new blank knowledge base</li><li>Use a different knowledge base synced from a server or desktop application</li><li>Restore a backup</li></ul><p>You can navigate to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Database</em> and click the <em>Start over</em> button. You'll be prompted to restart the application, with the option to back up your current database before proceeding.</p><aside class=\"admonition important\"><p>For the web client, Trilium cannot restart automatically. You'll need to manually restart the server/container and then reload the web application.</p></aside><p>After restarting, the setup screen will appear. You can choose to back up your existing database, then proceed with the setup menu as if it's a new installation. The existing database will only be overwritten after selecting to create a new database, sync with a server, or restore from a backup.</p><h3>The Legacy Method</h3><p>If you are experimenting with Trilium and want to return it to its original state, you can do that by deleting the current database. When you restart the application, it will generate a new database containing the original demo notes.</p><p>To delete the database, simply go to the <a href=\"#root/_help_tAassRL4RSQL\">data directory</a> and delete the <code>document.db</code> file (and any other files starting with <code>document.db</code>).</p><p>If you do not need to preserve any configurations that might be stored in the <code>config.ini</code> file, you can just delete all of the <a href=\"#root/_help_tAassRL4RSQL\">data directory's</a> contents to fully restore the application to its original state. You can also review the <a href=\"#root/_help_Gzjqa934BdH4\">configuration</a> file to provide all <code>config.ini</code> values as environment variables instead.</p>","_help_oyIAJ9PvvwHX": "<p>There are some situations where modifying the SQLite database that Trilium uses is desirable.</p><p>If you are doing any advanced development or troubleshooting where you manually modify the database, you might want to consider creating backups of your <code>document.db</code> file.</p><h2>Modifying it internally using the SQL Console</h2><p>The SQL Console is Trilium's built-in database editor.</p><p>See <a class=\"reference-link\" href=\"#root/_help_YKWqdJhzi2VY\">SQL Console</a>.</p><h2>Externally modifying the database</h2><p>Sometimes the SQL Console cannot be used (for example if the application cannot start).</p><p>When making external modifications, consider closing the desktop application. If modifying the server database, then stop the service or Docker container.</p><h3>Using DB Browser for SQLite</h3><p>DB Browser for SQLite is a cross-platform editor that can be used to alter the database using a graphical user interface.</p><p>To do so:</p><ol><li>In the main menu, select File → Open database… and navigate to the database in the <a href=\"#root/_help_tAassRL4RSQL\">Data directory</a>.</li><li>Select the <em>Execute SQL</em> tab.</li><li>Type in the desired SQL statement.</li><li>Press the \"Play\" button in the toolbar underneath the \"Execute SQL\" tab (or F5 key).</li><li>Press \"Write Changes\" in the main toolbar.</li><li>Close the application or close the database.</li></ol><p><img src=\"{{helpAssets}}/User%20Guide/Advanced%20Usage/Database/Manually%20altering%20the%20database_image.jpg\"></p><h3>Using the SQLite CLI</h3><p>First, start the SQLite 3 CLI by specifying the path to the database:</p><pre><code class=\"language-text-x-trilium-auto\">sqlite3 ~/.local/share/trilium-data/document.db</code></pre><ul><li>In the prompt simply type the statement and make sure it ends with a <code>;</code> character.</li><li>To exit, simply type <code>.quit</code> and enter.</li></ul>",diff --git a/apps/server/src/etapi/auth.ts b/apps/server/src/etapi/auth.tsindex b39c6b6f67..f62451b7d7 100644--- a/apps/server/src/etapi/auth.ts+++ b/apps/server/src/etapi/auth.ts@@ -1,22 +1,36 @@-import { password_encryption as passwordEncryptionService } from "@triliumnext/core";+import { becca, cls } from "@triliumnext/core";import type { RequestHandler, Router } from "express";-import { becca } from "@triliumnext/core";+import { verifyLoginCredentials } from "../services/auth.js";import etapiTokenService from "../services/etapi_tokens.js";+import totp from "../services/totp.js";import eu from "./etapi_utils.js";function register(router: Router, loginMiddleware: RequestHandler[]) {// Password verification is async (scrypt), so it runs as middleware: the synchronous// transactional route handler below cannot await, and the check must complete before the// token is issued.- const verifyPasswordMiddleware: RequestHandler = async (req, res, next) => {+ const verifyCredentialsMiddleware: RequestHandler = async (req, res, next) => {try {- const { password } = req.body;+ const { password, totpToken } = req.body;- if (!(await passwordEncryptionService.verifyPassword(password))) {+ // Checked before the password so that the answer says nothing about the password.+ if (totp.isTotpEnabled() && (typeof totpToken !== "string" || !totpToken)) {+ eu.sendError(res, 401, "TOTP_REQUIRED", "TOTP token is required.");+ return;+ }++ // `verifyTOTP()` and `verifyRecoveryCode()` write options when they accept a code, and+ // middleware runs before `processRequest()` opens a CLS context.+ const failedFactor = await cls.init(() => verifyLoginCredentials(password, totpToken));+ if (failedFactor === "password") {eu.sendError(res, 401, "WRONG_PASSWORD", "Wrong password.");return;}+ if (failedFactor === "totp") {+ eu.sendError(res, 401, "WRONG_TOTP", "Wrong TOTP token.");+ return;+ }next();} catch (e: any) {@@ -24,7 +38,7 @@ function register(router: Router, loginMiddleware: RequestHandler[]) {}};- eu.NOT_AUTHENTICATED_ROUTE(router, "post", "/etapi/auth/login", [...loginMiddleware, verifyPasswordMiddleware], (req, res) => {+ eu.NOT_AUTHENTICATED_ROUTE(router, "post", "/etapi/auth/login", [...loginMiddleware, verifyCredentialsMiddleware], (req, res) => {const { tokenName } = req.body;const { authToken } = etapiTokenService.createToken(tokenName || "ETAPI login");diff --git a/docs/User Guide/User Guide/Advanced Usage/ETAPI (REST API).md b/docs/User Guide/User Guide/Advanced Usage/ETAPI (REST API).mdindex c3c312bc01..cd803dd0ad 100644--- a/docs/User Guide/User Guide/Advanced Usage/ETAPI (REST API).md+++ b/docs/User Guide/User Guide/Advanced Usage/ETAPI (REST API).md@@ -12,7 +12,7 @@ As an alternative to calling the API directly, there are client libraries to sim## Obtaining a token-All operations with the REST API have to be authenticated using a token. You can get this token either from Options -> ETAPI or programmatically using the `/auth/login` REST call (see the [spec](https://github.com/TriliumNext/Trilium/blob/master/src/etapi/etapi.openapi.yaml)).+All operations with the REST API have to be authenticated using a token. You can get this token either from Options -> ETAPI or programmatically using the `/auth/login` REST call (see the [spec](https://github.com/TriliumNext/Trilium/blob/main/apps/server/src/assets/etapi.openapi.yaml)). With [multi-factor authentication](../Installation%20%26%20Setup/Server%20Installation/Multi-factor%20authentication%20with%20TOTP.md) enabled, `/auth/login` also needs the one-time password or a recovery code in `totpToken`.## Authenticationdiff --git a/docs/User Guide/User Guide/Advanced Usage/ETAPI (REST API)/API Reference.md b/docs/User Guide/User Guide/Advanced Usage/ETAPI (REST API)/API Reference.mdindex c4839d63c3..ddaacf07f7 100644--- a/docs/User Guide/User Guide/Advanced Usage/ETAPI (REST API)/API Reference.md+++ b/docs/User Guide/User Guide/Advanced Usage/ETAPI (REST API)/API Reference.md@@ -3170,13 +3170,17 @@ get an ETAPI token based on password for further use with ETAPI. Too many reques| Property | Description || --- | --- || `password` | `string` <br>user's password used to e.g. login to Trilium server and/or protect notes |+| `totpToken` | `string` <br>the current TOTP code, or one of the recovery codes; required when multi-factor authentication with TOTP is enabled. Each code is accepted once. |+| `tokenName` | `string` <br>name of the created token, shown in the list of ETAPI tokens |</div><div class="trilium-multicolumn-column">```json{- "password": "string"+ "password": "string",+ "totpToken": "string",+ "tokenName": "string"}```@@ -3208,6 +3212,33 @@ get an ETAPI token based on password for further use with ETAPI. Too many reques</div></div>+=== "401: wrong credentials: `WRONG_PASSWORD`, `TOTP_REQUIRED` (TOTP is enabled and no `totpToken` was sent) or `WRONG_TOTP`"++ * `application/json; charset=utf-8`: [`Error`](#schema-Error)++ <div class="trilium-multicolumn-layout" data-trilium-column-ratios="1-1">+ <div class="trilium-multicolumn-column">++ | Property | Description |+ | --- | --- |+ | `status` <br>_required_ | `integer (int32)` <br>HTTP status, identical to the one given in HTTP response |+ | `code` <br>_required_ | `string` <br>stable string constant |+ | `message` <br>_required_ | `string` <br>Human readable error, potentially with more details, |++ </div>+ <div class="trilium-multicolumn-column">++ ```json+ {+ "status": 400,+ "code": "NOTE_IS_PROTECTED",+ "message": "Note 'evnnmvHTCgIn' is protected and cannot be modified through ETAPI"+ }+ ```++ </div>+ </div>+=== "429: too many requests"No content.diff --git a/docs/User Guide/User Guide/Installation & Setup/Server Installation/Multi-factor authentication with TOTP.md b/docs/User Guide/User Guide/Installation & Setup/Server Installation/Multi-factor authentication with TOTP.mdindex 3be5d5074a..de2ba56b50 100644--- a/docs/User Guide/User Guide/Installation & Setup/Server Installation/Multi-factor authentication with TOTP.md+++ b/docs/User Guide/User Guide/Installation & Setup/Server Installation/Multi-factor authentication with TOTP.md@@ -36,6 +36,15 @@ The second factor is only asked for when a device is first connected. A device t> [!NOTE]> Versions prior to v0.107.0 do not ask for the second factor when setting up the sync. Update the desktop and mobile apps along with the server, since older apps have no field to send it.+## Obtaining an ETAPI token with a password++Once TOTP is enabled, obtaining a token for the <a class="reference-link" href="../../Advanced%20Usage/ETAPI%20(REST%20API).md">ETAPI (REST API)</a> through the `/auth/login` call also requires the second factor: send the one-time password or a recovery code as `totpToken`, next to `password`. Each code is accepted only once.++For scripts and tools that run unattended, create a token in <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Options.md">Options</a> → _ETAPI_ instead. Such a token works regardless of TOTP.++> [!WARNING]+> Versions prior to v0.107.0 issue an ETAPI token for the password alone, even with TOTP enabled.+## Recovery codesRecovery codes can be used in place of the TOTP if you lose access to your authenticator. Trilium provides 8 different recovery codes, each recovery code can be used once.