Overview
The vylk server has an HTTP API. The vylk web app uses it, and you can use it to build your own client. Send requests to your own server, for example http://localhost:8080. The API has no version prefix. Test your client against each vylk release that you support.
Authentication
The session cookie from POST /api/login. Store cookies in a cookie jar and send them with each request. The API does not accept bearer tokens or API keys.
Encrypted vaults
Routes that read or write notes take the X-Vylk-Vault-Protocol header. Set it to 1 when the vault is encrypted. Without it, the request fails with 426. A plaintext vault ignores the header.
Errors
Error responses carry this object. Branch on code. The error text can change between releases.
| Key | Value | Description |
|---|
error | string | Message in English. |
code | string | Stable error code. |
note_id | string | Note that the error concerns. |
current_revision | integer | Current revision on the server. |
epoch | integer | Current vault epoch. |
retry_after | integer | Seconds to wait before the next attempt. |
permanent | boolean | True when a retry cannot succeed. |
operation_index | integer | Index of the invalid operation in operations. At least 0. |
client_sequence | integer | client_sequence of the invalid operation. |
op_id | string | op_id of the invalid operation. |
Authentication
Sign in, sign out, and check a session.
Sign in
POST /api/login
Creates a session for this device. Call GET /api/vault/bootstrap first to learn the vault mode. When mode is legacy or preparing, send password. When mode is encrypted or cleaning, omit password and send proof or recovery_proof. If you send both proofs, the server checks only recovery_proof. The body limit is 16 KiB.
Request headers
| Key | Value | Description |
|---|
Content-Type | application/json, required | Media type of the body. |
Request body
| Key | Value | Description |
|---|
password | string | Server password, VYLK_PASSWORD. Plaintext vault and encryption setup only. |
proof | string | Proof derived from the encryption password. Encrypted vault only. |
recovery_proof | string | Proof derived from the recovery key. Encrypted vault only. |
Responses
| Status | Code | Description |
|---|
200 | | Signed in. The response sets the session and vylk-device cookies. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
401 | invalid_credentials | The password or proof is wrong. |
429 | login_rate_limited | Too many failed attempts from this client address. Wait for the number of seconds in retry_after. |
500 | create_session_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | Two cookies: session and vylk-device. Store both. |
Retry-After | string | Sent with status 429. Seconds to wait before the next attempt. |
Response body
| Key | Value | Description |
|---|
ok | true | |
version | string | vylk version of the server. |
revision | string | Build of the web app. Not a note revision. |
instance_id | string | Identity of the server database. It changes only when the database is replaced. |
Example request
curl -X POST 'http://localhost:8080/api/login' \
-c cookies.txt \
-H 'Content-Type: application/json' \
-d '{
"password": "your-server-password"
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Set-Cookie: vylk-device=96bfb40c6de6030d4179116bd0231d99; Path=/; Max-Age=31536000; HttpOnly; SameSite=Lax
Set-Cookie: session=3fae6c640760d12fcd77c5f3d25f02fb; Path=/; Max-Age=15552000; HttpOnly; SameSite=Lax
{
"instance_id": "95e9c24f3f492f0b776fa9f58b5837f0",
"ok": true,
"revision": "3a7403423c47610d",
"version": "3.1.2"
}
Sign out
POST /api/logout
Signs out this device. The server revokes every session that shares this device's vylk-device cookie, so other tabs of the same browser profile sign out too. The response clears the session cookie even when the session is missing or expired. Sign-out does not upload pending edits. Keep them on the client.
Responses
| Status | Code | Description |
|---|
204 | | Signed out. The response has no body. |
500 | logout_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Set-Cookie | string | Expires the session cookie. |
Example request
curl -X POST 'http://localhost:8080/api/logout'
Example response
HTTP/1.1 204 No Content
Set-Cookie: session=; Path=/; Max-Age=0; HttpOnly; SameSite=Lax
Get the session status
GET /api/check
Returns the server identity and vault state for a valid session. Before you resume sync, compare instance_id, vault_mode, and vault_epoch with the values that you stored. revision identifies the build of the web app, not a note revision.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Responses
| Status | Code | Description |
|---|
200 | | The session is valid. |
401 | authentication_required | The request has no valid session cookie. |
500 | vault_status_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
ok | true | |
version | string | vylk version of the server. |
revision | string | Build of the web app. Not a note revision. |
instance_id | string | Identity of the server database. It changes only when the database is replaced. |
vault_mode | string | legacy: plaintext vault. preparing: encryption setup is converting notes. cleaning: the server is removing plaintext data. encrypted: encrypted vault. One of legacy, preparing, cleaning, encrypted. |
vault_epoch | integer | Current vault epoch. 0 in a plaintext vault. |
Example request
curl 'http://localhost:8080/api/check' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"instance_id": "95e9c24f3f492f0b776fa9f58b5837f0",
"ok": true,
"revision": "3a7403423c47610d",
"vault_epoch": 0,
"vault_mode": "legacy",
"version": "3.1.2"
}
Devices
List signed-in devices and sign them out.
List devices
GET /api/devices
Lists the devices that have an active session, most recently active first. All tabs of one browser profile share a vylk-device cookie and appear as one device. The server updates last_seen_at at most every few minutes, so the value is approximate.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Responses
| Status | Code | Description |
|---|
200 | | The active devices. |
401 | authentication_required | The request has no valid session cookie. |
500 | devices_unavailable | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
devices | array of Device | Active devices. |
Example request
curl 'http://localhost:8080/api/devices' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"devices": [
{
"id": "96bfb40c6de6030d4179116bd0231d99",
"name": "Chrome on Linux",
"last_seen_at": "2026-11-22T02:41:08Z",
"current": true
},
{
"id": "bab973f17508af32c70e314d45d17307",
"name": "Chrome on Android",
"last_seen_at": "2026-11-22T02:41:08Z",
"current": false
}
]
}
Sign out a device
DELETE /api/devices/{id}
Revokes every session of a device. The request succeeds for a well-formed ID that matches no device. Revocation cannot delete notes or keys that the device already stores. An offline device learns about the revocation when it reconnects.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Path parameters
| Key | Value | Description |
|---|
id | string, required | Device ID from GET /api/devices. This is not the sync queue device_id. Pattern: ^[a-f0-9]{32}$. |
Responses
| Status | Code | Description |
|---|
204 | | The device is signed out. The response has no body. |
400 | invalid_device | id is not 32 lowercase hexadecimal characters. |
401 | authentication_required | The request has no valid session cookie. |
403 | vault_changes_disabled | The server runs with VYLK_DISABLE_VAULT_CHANGES set to true. |
500 | device_signout_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Example request
curl -X DELETE 'http://localhost:8080/api/devices/bab973f17508af32c70e314d45d17307' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 204 No Content
Notes
Read, save, and delete single notes, and search a plaintext vault.
List notes
GET /api/notes
Lists note summaries without note content, most recently updated first. Without limit, the response is an array of every note. With limit, the response is one page, and nextCursor points to the next page. In a plaintext vault, nextCursor is absent on the last page. In an encrypted vault, it is an empty string. In an encrypted vault, each summary holds an encrypted summary envelope in place of title, tags, and filename.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
X-Vylk-Vault-Protocol | 1 | Set it to 1 when the vault is encrypted. Without it, the request fails with 426. A plaintext vault ignores the header. |
Query parameters
| Key | Value | Description |
|---|
limit | integer | Page size. In a plaintext vault, the range is 1 to 100 and an empty value means no limit. In an encrypted vault, the range is 1 to 500 and an empty value is an error. From 1 to 500. |
cursor | string | nextCursor from the previous page. Treat the value as opaque. |
tag | string | Returns only notes with this exact tag. Plaintext vault only. |
Responses
| Status | Code | Description |
|---|
200 | | The note summaries. |
400 | invalid_page_limit | limit is not an integer in the allowed range. |
400 | invalid_cursor | cursor is not a value from a previous page. |
401 | authentication_required | The request has no valid session cookie. |
409 | client_search_required | The vault is encrypted. Decrypt the note summaries and search or filter them on the client. |
423 | vault_maintenance_in_progress | The server is removing plaintext data after encryption setup. |
426 | encrypted_client_required | The vault is encrypted and the request has no X-Vylk-Vault-Protocol: 1 header. |
500 | list_notes_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
Without limit. Every note.
An array of Note summary.
With limit.
| Key | Value | Description |
|---|
notes | array of Note summary | Note summaries. |
nextCursor | string | Cursor for the next page. Absent or empty on the last page. |
Example request
curl 'http://localhost:8080/api/notes?limit=1' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"notes": [
{
"id": "trip-notes",
"title": "Trip notes",
"filename": "trip-notes.md",
"tags": "travel",
"pinned": false,
"created_at": "2026-11-22T02:41:07Z",
"updated_at": "2026-11-22T02:41:07Z",
"revision": 2
}
],
"nextCursor": "MjAyNi0xMS0yMlQwMjo0MTowN1oAdHJpcC1ub3Rlcw"
}
Save a note
POST /api/notes
Creates a note or replaces a note completely. Send the whole note each time, not a change. To update a note, send its id and the base_revision that you last read. To create a note with an ID that you chose, send base_revision 0. In a plaintext vault, you can omit id, and the server generates one. In an encrypted vault, you must send id, base_revision, epoch, summary, and body. The response returns the note summary without its content. A new note also returns status 200. The body limit is 4 MiB in a plaintext vault and 8 MiB in an encrypted vault. Clients that queue offline edits use POST /api/sync/push instead.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Content-Type | application/json, required | Media type of the body. |
X-Vylk-Vault-Protocol | 1 | Set it to 1 when the vault is encrypted. Without it, the request fails with 426. A plaintext vault ignores the header. |
Request body
Plaintext vault.
| Key | Value | Description |
|---|
id | string | Note ID. Omit it to let the server generate an ID. Pattern: ^[A-Za-z0-9_-]{1,64}$. |
title | string | Title. At most 512 bytes. |
content | string | Note text in Markdown. |
tags | string | Comma-separated tags. At most 4096 bytes. |
base_revision | integer | Revision that you last read. Required with id. Use 0 for a new note. |
Encrypted vault.
| Key | Value | Description |
|---|
id | string, required | Note ID that the client generated. Pattern: ^[A-Za-z0-9_-]{1,64}$. |
summary | Envelope, required | Encrypted title and tags. |
body | Envelope, required | Encrypted note text. |
epoch | integer, required | Current vault epoch. At least 1. |
base_revision | integer, required | Revision that you last read. Use 0 for a new note. |
Responses
| Status | Code | Description |
|---|
200 | | The note is saved. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
400 | base_revision_required | id is present and base_revision is missing. Plaintext vault only. |
400 | invalid_note_id | id does not match ^[A-Za-z0-9_-]{1,64}$. Plaintext vault only. |
400 | note_metadata_too_long | title exceeds 512 bytes or tags exceeds 4096 bytes. Plaintext vault only. |
400 | invalid_encrypted_note | A required field is missing or an envelope is malformed. Encrypted vault only. |
401 | authentication_required | The request has no valid session cookie. |
409 | note_revision_conflict | base_revision is not the current revision. In a plaintext vault, current_revision holds the current revision. |
409 | stale_vault_epoch | epoch is not the current vault epoch. Read GET /api/vault/keys again. Encrypted vault only. |
423 | vault_migration_in_progress | Encryption setup is converting notes. Note writes are paused until it finishes. |
423 | vault_maintenance_in_progress | The server is removing plaintext data after encryption setup. |
426 | encrypted_client_required | The vault is encrypted and the request has no X-Vylk-Vault-Protocol: 1 header. |
500 | save_note_failed | The server could not complete the request. |
503 | note_file_recovery_blocked | An interrupted file operation needs recovery before this note can change. Keep the change and retry later. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
Note. Note metadata in a plaintext vault.
| Key | Value | Description |
|---|
id | string | Note ID. 1 to 64 letters, digits, hyphens, or underscores. |
title | string | Title. At most 512 bytes. |
filename | string | File name in the notes folder. Not an API path. |
tags | string | Comma-separated tags. The server trims them and removes duplicates. Tags are case-sensitive. At most 4096 bytes. |
pinned | boolean | True when the note is pinned. |
pin_order | integer | Position among pinned notes. Absent when 0. |
created_at | string (date-time) | Creation time. |
updated_at | string (date-time) | Time of the last change. |
revision | integer | Revision. Each change increases it by 1. |
Encrypted note. Note metadata in an encrypted vault.
| Key | Value | Description |
|---|
id | string | Note ID. 1 to 64 letters, digits, hyphens, or underscores. |
summary | Envelope | Encrypted title and tags. |
pinned | boolean | True when the note is pinned. |
pin_order | integer | Position among pinned notes. 0 when not pinned. |
created_at | string (date-time) | Creation time. |
updated_at | string (date-time) | Time of the last change. |
revision | integer | Revision. Each change increases it by 1. |
epoch | integer | Vault epoch that encrypted the note. |
Example request
curl -X POST 'http://localhost:8080/api/notes' \
-b cookies.txt -c cookies.txt \
-H 'Content-Type: application/json' \
-d '{
"id": "trip-notes",
"base_revision": 1,
"title": "Trip notes",
"tags": "travel",
"content": "# Trip notes\n\nBook the train. Pack light.\n"
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"id": "trip-notes",
"title": "Trip notes",
"filename": "trip-notes.md",
"tags": "travel",
"pinned": false,
"created_at": "2026-11-22T02:41:07Z",
"updated_at": "2026-11-22T02:41:07Z",
"revision": 2
}
Get a note
GET /api/notes/{id}
Returns one note with its content. In an encrypted vault, the note holds summary and body envelopes in place of title, tags, filename, and content.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
X-Vylk-Vault-Protocol | 1 | Set it to 1 when the vault is encrypted. Without it, the request fails with 426. A plaintext vault ignores the header. |
Path parameters
| Key | Value | Description |
|---|
id | string, required | Note identifier. Pattern: ^[A-Za-z0-9_-]{1,64}$. |
Responses
| Status | Code | Description |
|---|
200 | | The note. |
401 | authentication_required | The request has no valid session cookie. |
404 | note_not_found | No note has this ID. |
423 | vault_maintenance_in_progress | The server is removing plaintext data after encryption setup. |
426 | encrypted_client_required | The vault is encrypted and the request has no X-Vylk-Vault-Protocol: 1 header. |
500 | load_note_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
Plaintext vault.
| Key | Value | Description |
|---|
id | string | Note ID. 1 to 64 letters, digits, hyphens, or underscores. |
title | string | Title. At most 512 bytes. |
filename | string | File name in the notes folder. Not an API path. |
tags | string | Comma-separated tags. The server trims them and removes duplicates. Tags are case-sensitive. At most 4096 bytes. |
pinned | boolean | True when the note is pinned. |
pin_order | integer | Position among pinned notes. Absent when 0. |
created_at | string (date-time) | Creation time. |
updated_at | string (date-time) | Time of the last change. |
revision | integer | Revision. Each change increases it by 1. |
content | string | Note text in Markdown. |
Encrypted vault.
| Key | Value | Description |
|---|
id | string | Note ID. 1 to 64 letters, digits, hyphens, or underscores. |
summary | Envelope | Encrypted title and tags. |
pinned | boolean | True when the note is pinned. |
pin_order | integer | Position among pinned notes. 0 when not pinned. |
created_at | string (date-time) | Creation time. |
updated_at | string (date-time) | Time of the last change. |
revision | integer | Revision. Each change increases it by 1. |
epoch | integer | Vault epoch that encrypted the note. |
body | Envelope | Encrypted note text. |
Example request
curl 'http://localhost:8080/api/notes/trip-notes' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"id": "trip-notes",
"title": "Trip notes",
"filename": "trip-notes.md",
"tags": "travel",
"pinned": false,
"created_at": "2026-11-22T02:41:07Z",
"updated_at": "2026-11-22T02:41:07Z",
"revision": 2,
"content": "# Trip notes\n\nBook the train. Pack light.\n"
}
Delete a note
DELETE /api/notes/{id}
Deletes a note at a known revision. A second identical request returns 404 or 409. It does not succeed again. Clients that queue offline edits use a note.delete operation in POST /api/sync/push instead.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
X-Vylk-Vault-Protocol | 1 | Set it to 1 when the vault is encrypted. Without it, the request fails with 426. A plaintext vault ignores the header. |
Path parameters
| Key | Value | Description |
|---|
id | string, required | Note identifier. Pattern: ^[A-Za-z0-9_-]{1,64}$. |
Query parameters
| Key | Value | Description |
|---|
base_revision | integer, required | The revision that you last read. At least 1. |
Responses
| Status | Code | Description |
|---|
204 | | The note is deleted. The response has no body. |
400 | base_revision_required | base_revision is missing. |
400 | invalid_note_revision | base_revision is not a positive integer. |
401 | authentication_required | The request has no valid session cookie. |
404 | note_not_found | No note has this ID. |
409 | note_revision_conflict | base_revision is not the current revision. In a plaintext vault, current_revision holds the current revision. |
423 | vault_migration_in_progress | Encryption setup is converting notes. Note writes are paused until it finishes. |
423 | vault_maintenance_in_progress | The server is removing plaintext data after encryption setup. |
423 | vault_unavailable | The encrypted vault is not ready. Encrypted vault only. |
426 | encrypted_client_required | The vault is encrypted and the request has no X-Vylk-Vault-Protocol: 1 header. |
500 | delete_note_failed | The server could not complete the request. |
503 | note_file_recovery_blocked | An interrupted file operation needs recovery before this note can change. Keep the change and retry later. |
Response headers
| Key | Value | Description |
|---|
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Example request
curl -X DELETE 'http://localhost:8080/api/notes/trip-notes?base_revision=1' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 204 No Content
Search notes
GET /api/search
Searches note titles and tags, not note content. Plaintext vault only. The server splits q at white space, uses the first eight words, and matches notes that contain every word as a prefix. The response holds at most 50 summaries, best match first. An empty q returns an empty array. A query without matches returns null.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
X-Vylk-Vault-Protocol | 1 | Set it to 1 when the vault is encrypted. Without it, the request fails with 426. A plaintext vault ignores the header. |
Query parameters
| Key | Value | Description |
|---|
q | string | Search text, at most 256 bytes. |
Responses
| Status | Code | Description |
|---|
200 | | The matching note summaries, or null. |
400 | search_query_too_long | q exceeds 256 bytes after the server trims white space. |
401 | authentication_required | The request has no valid session cookie. |
409 | client_search_required | The vault is encrypted. Decrypt the note summaries and search or filter them on the client. |
423 | vault_maintenance_in_progress | The server is removing plaintext data after encryption setup. |
426 | encrypted_client_required | The vault is encrypted and the request has no X-Vylk-Vault-Protocol: 1 header. |
500 | search_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
array or null.
Example request
curl 'http://localhost:8080/api/search?q=trip' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
[
{
"id": "trip-notes",
"title": "Trip notes",
"filename": "trip-notes.md",
"tags": "travel",
"pinned": false,
"created_at": "2026-11-22T02:41:07Z",
"updated_at": "2026-11-22T02:41:07Z",
"revision": 2
}
]
Sync
Pull changes, fetch notes in batches, push queued edits, and receive change events.
List changes
GET /api/sync
Returns the note changes after sequence since, oldest first. Each change names a note and its new revision. A change with deleted true is a deletion. Save nextSequence only after you apply the changes locally, and pass it as since in the next request. While hasMore is true, request the next page. When resetRequired is true, the server no longer has the changes after since. Rebuild your copy from GET /api/notes, and keep your pending edits. The client protocol describes the full sync procedure.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
X-Vylk-Vault-Protocol | 1 | Set it to 1 when the vault is encrypted. Without it, the request fails with 426. A plaintext vault ignores the header. |
Query parameters
| Key | Value | Description |
|---|
since | integer | Sequence of the last change that you applied. The response starts after it. Default: 0. At least 0. |
limit | integer | Maximum number of changes. Default: 100. From 1 to 500. |
Responses
| Status | Code | Description |
|---|
200 | | A page of changes. |
400 | invalid_sync_sequence | since is not a non-negative integer. |
400 | invalid_page_limit | limit is not an integer from 1 to 500. |
401 | authentication_required | The request has no valid session cookie. |
423 | vault_maintenance_in_progress | The server is removing plaintext data after encryption setup. |
426 | encrypted_client_required | The vault is encrypted and the request has no X-Vylk-Vault-Protocol: 1 header. |
500 | list_sync_changes_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
changes | array of Change | Changes, oldest first. |
nextSequence | integer | Sequence to send as since in the next request. |
hasMore | boolean | True when more changes follow. |
resetRequired | boolean | True when the server no longer has the changes after since. Present only when true. |
instance_id | string | Identity of the server database. |
Example request
curl 'http://localhost:8080/api/sync?since=0&limit=100' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"changes": [
{
"sequence": 1,
"note_id": "32366a862b3447c4551e8bc031bcdbad",
"revision": 1,
"deleted": false,
"changed_at": "2026-11-22T02:41:07Z"
},
{
"sequence": 2,
"note_id": "trip-notes",
"revision": 1,
"deleted": false,
"changed_at": "2026-11-22T02:41:07Z"
},
{
"sequence": 3,
"note_id": "trip-notes",
"revision": 2,
"deleted": false,
"changed_at": "2026-11-22T02:41:07Z"
}
],
"nextSequence": 3,
"hasMore": false,
"instance_id": "95e9c24f3f492f0b776fa9f58b5837f0"
}
Get notes by ID
GET /api/sync/notes
Returns up to 25 complete notes. The server counts IDs before it removes duplicates. IDs that match no note appear in missing. A returned note can have a newer revision than the change that you are applying. Do not let it replace a pending local edit.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
X-Vylk-Vault-Protocol | 1 | Set it to 1 when the vault is encrypted. Without it, the request fails with 426. A plaintext vault ignores the header. |
Query parameters
| Key | Value | Description |
|---|
ids | string | Comma-separated note IDs, without spaces. An empty value returns empty arrays. |
Responses
| Status | Code | Description |
|---|
200 | | The notes that exist and the IDs that do not. |
400 | too_many_note_ids | ids holds more than 25 IDs. |
400 | invalid_note_id | An ID does not match ^[A-Za-z0-9_-]{1,64}$. |
401 | authentication_required | The request has no valid session cookie. |
423 | vault_maintenance_in_progress | The server is removing plaintext data after encryption setup. |
426 | encrypted_client_required | The vault is encrypted and the request has no X-Vylk-Vault-Protocol: 1 header. |
500 | load_notes_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
notes | array of Note with content | Complete notes. |
missing | array of string | Requested IDs that match no note. |
Example request
curl 'http://localhost:8080/api/sync/notes?ids=trip-notes,deleted-note' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"missing": [
"deleted-note"
],
"notes": [
{
"id": "trip-notes",
"title": "Trip notes",
"filename": "trip-notes.md",
"tags": "travel",
"pinned": false,
"created_at": "2026-11-22T02:41:07Z",
"updated_at": "2026-11-22T02:41:07Z",
"revision": 2,
"content": "# Trip notes\n\nBook the train. Pack light.\n"
},
{
"id": "32366a862b3447c4551e8bc031bcdbad",
"title": "Groceries",
"filename": "32366a862b3447c4551e8bc031bcdbad.md",
"tags": "home,errands",
"pinned": false,
"created_at": "2026-11-22T02:41:07Z",
"updated_at": "2026-11-22T02:41:07Z",
"revision": 1,
"content": "- Milk\n- Eggs\n"
}
]
}
Push operations
POST /api/sync/push
Applies queued offline edits in order. Each client queue has its own device_id. Its client_sequence numbers start at 1 and have no gaps. Retry a failed request with the same operations, sequence numbers, and op_id values. The server acknowledges operations that it already applied without applying them again. A status of 200 does not mean that every operation applied. Read the status of each acknowledgement. A conflict also uses its sequence number. Send an empty operations array to read expected_sequence. The request holds at most 100 operations. The body limit is 4 MiB in a plaintext vault and 8 MiB in an encrypted vault. Saves carry the complete note. The server does not merge text. The client protocol describes queue handling.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Content-Type | application/json, required | Media type of the body. |
X-Vylk-Vault-Protocol | 1 | Set it to 1 when the vault is encrypted. Without it, the request fails with 426. A plaintext vault ignores the header. |
X-Vylk-Instance-ID | string | The instance_id that you stored. When it does not match the server, the request fails with 409 before any write. Send this header from every client that queues edits. |
Request body
Plaintext vault.
| Key | Value | Description |
|---|
device_id | string, required | Identifier of the client queue. Keep it for the lifetime of the queue. Pattern: ^[A-Za-z0-9_-]{1,128}$. |
operations | array of Operation, required | Operations in queue order. At most 100. |
Encrypted vault.
| Key | Value | Description |
|---|
device_id | string, required | Identifier of the client queue. Keep it for the lifetime of the queue. Pattern: ^[A-Za-z0-9_-]{1,128}$. |
operations | array of Encrypted operation, required | Operations in queue order. At most 100. |
Responses
| Status | Code | Description |
|---|
200 | | The server processed the operations. Read each acknowledgement. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
400 | invalid_sync_request | device_id is invalid or operations holds more than 100 items. |
400 | invalid_sync_operation | An operation is invalid. Do not retry it. Plaintext vault only. |
400 | invalid_encrypted_operation | An operation is invalid or holds a plaintext field. Encrypted vault only. |
401 | authentication_required | The request has no valid session cookie. |
409 | | The first client_sequence is not expected_sequence. The body is a push result. acknowledged can hold operations that the server applied earlier. |
409 | server_instance_changed | X-Vylk-Instance-ID does not match the server. The database changed. Do not resend the queue without a decision from the user. |
409 | invalid_replayed_operation | A retried client_sequence arrived with a different op_id or type. |
409 | stale_vault_epoch | An operation has an old epoch. epoch holds the current one. Encrypted vault only. |
423 | vault_migration_in_progress | Encryption setup is converting notes. Note writes are paused until it finishes. |
423 | vault_maintenance_in_progress | The server is removing plaintext data after encryption setup. |
423 | vault_unavailable | The encrypted vault is not ready. Encrypted vault only. |
426 | encrypted_client_required | The vault is encrypted and the request has no X-Vylk-Vault-Protocol: 1 header. |
500 | apply_sync_operation_failed | The server could not complete the request. |
503 | note_file_recovery_blocked | An interrupted file operation needs recovery before this note can change. Keep the change and retry later. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
acknowledged | array of Acknowledgement | One result for each operation that the server processed. |
expected_sequence | integer | client_sequence that the server expects next. At least 1. |
Example request
curl -X POST 'http://localhost:8080/api/sync/push' \
-b cookies.txt -c cookies.txt \
-H 'X-Vylk-Instance-ID: 95e9c24f3f492f0b776fa9f58b5837f0' \
-H 'Content-Type: application/json' \
-d '{
"device_id": "laptop-queue-1",
"operations": [
{
"client_sequence": 1,
"op_id": "op-1",
"type": "note.save",
"note_id": "reading-list",
"base_revision": 0,
"title": "Reading list",
"tags": "books",
"content": "- Dune\n"
},
{
"client_sequence": 2,
"op_id": "op-2",
"type": "note.pin",
"note_id": "reading-list",
"base_revision": 1,
"pinned": true
},
{
"client_sequence": 3,
"op_id": "op-3",
"type": "note.save",
"note_id": "trip-notes",
"base_revision": 1,
"title": "Trip notes",
"tags": "travel",
"content": "stale\n"
}
]
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"acknowledged": [
{
"client_sequence": 1,
"op_id": "op-1",
"status": "applied",
"revision": 1
},
{
"client_sequence": 2,
"op_id": "op-2",
"status": "applied",
"revision": 2,
"pin_order": 1
},
{
"client_sequence": 3,
"op_id": "op-3",
"status": "conflict",
"current_revision": 2
}
],
"expected_sequence": 4
}
Stream events
GET /api/events
Opens a Server-Sent Events stream. The stream starts with retry: 3000, a server event, and a heartbeat event. It sends a heartbeat every 25 seconds. A change event has a type. notes or preferences: pull the changes. ai: list the AI configurations again. Pull the changes after each reconnect too. When the session ends, the server sends session-expired and closes the stream. The events have no IDs, and the server ignores Last-Event-ID. The stream does not carry note data and is not a durable feed.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Responses
| Status | Code | Description |
|---|
200 | | The event stream stays open. |
401 | authentication_required | The request has no valid session cookie. |
500 | | The server could not start the stream. The body is plain text. |
Response headers
| Key | Value | Description |
|---|
Content-Type | text/event-stream | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Cache-Control | no-cache | Responses are not cached. |
X-Accel-Buffering | no | Tells nginx not to buffer the stream. |
Example request
curl 'http://localhost:8080/api/events' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: text/event-stream
Cache-Control: no-cache
X-Accel-Buffering: no
retry: 3000
event: server
data: {"revision":"3a7403423c47610d","version":"3.1.2"}
event: heartbeat
data: {}
event: change
data: {"type":"notes","sequence":7}
Preferences
Read and replace the preferences that every device shares.
Get preferences
GET /api/prefs
Returns the preferences shared by every device. Preferences are not encrypted. The server fills in defaults for unset fields. The response has no ETag header. Read revision from the body.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Responses
| Status | Code | Description |
|---|
200 | | The preferences. |
401 | authentication_required | The request has no valid session cookie. |
500 | load_preferences_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
aiEnabled | boolean | Turn on AI. When false, every /api/ai/ route returns 403, and the server ends every AI session. Default: false. |
revision | integer | Revision. Each save increases it by 1. |
autoSave | boolean | Sync changes automatically. Changes are always saved on the device. Default: true. |
reduceMotion | string | system follows the operating system. always turns off animations. never keeps them on. One of system, always, never. Default: system. |
startView | string | View of a newly opened note. One of editor, preview, split, zen. Default: editor. |
hideToolbar | boolean | Hide the formatting toolbar above the editor. Default: false. |
hideSaveButton | boolean | Hide the manual Save button. Default: true. |
saveButtonLocation | string | panel puts the Save button in the editor toolbar. header puts it in the app header. One of "", panel, header. Default: panel. |
collapseDetails | boolean | Collapse the title and tags fields when a note opens. |
hideCursorHighlight | boolean | Turn off the preview highlight of the block at the cursor. |
interactivePreview | boolean | Allow toggling tasks and moving blocks in Split and Preview views. Default: true. |
statusDisplay | string | Sync status display. The web app uses normal, compact, or off. |
contentWidth | string | Width of the text column. One of "", compact, standard, wide, full. |
zenPageWidth | string | Width of the page in Zen mode. One of "", compact, standard, wide, full. |
theme | string | Built-in theme name, or a palette string that the client defines. The server does not interpret it. |
accentColor | string | Custom accent color. Empty means the theme color. |
fontFamily | string | Interface font. |
fontFamilyGoogle | boolean | Load fontFamily from Google Fonts. |
fontSize | string | Interface font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. |
editorFontFamily | string | Editor font. |
editorFontFamilyGoogle | boolean | Load editorFontFamily from Google Fonts. |
editorFontSize | string | Editor font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. |
previewFontFamily | string | Preview font. |
previewFontFamilyGoogle | boolean | Load previewFontFamily from Google Fonts. |
previewFontSize | string | Preview font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. |
zenFontFamily | string | Zen mode font. Default: Inter. |
zenFontFamilyGoogle | boolean | Load zenFontFamily from Google Fonts. Default: true. |
zenFontSize | string | Zen mode font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. Default: 1.25rem. |
zenWordCount | boolean | Show the word count in Zen mode. Default: true. |
zenShowTitle | boolean | Show the title in Zen mode. Default: true. |
zenShowControls | boolean | Show the controls in Zen mode. Default: true. |
zenInteractivePreview | boolean | Stored for clients. The vylk web app does not use it. |
shortcutPrefix | Shortcut | Key press that starts a shortcut. Exactly one step. The default is Mod+E. |
keyboardShortcuts | object | Custom shortcuts by action name, at most 64. null turns off the default shortcut for that action. Each value is Shortcut or null. |
shortcutConfirmationSkips | object | Actions that run without a confirmation, at most 64. Each value is true. |
_sync_patch | object | Changed fields. prefs.save operations only. |
_sync_base | object | Previous values of the changed fields. prefs.save operations only. |
Example request
curl 'http://localhost:8080/api/prefs' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"aiEnabled": false,
"reduceMotion": "system",
"revision": 2,
"autoSave": true,
"startView": "split",
"hideToolbar": false,
"hideSaveButton": true,
"saveButtonLocation": "panel",
"collapseDetails": false,
"hideCursorHighlight": false,
"interactivePreview": true,
"contentWidth": "standard",
"zenPageWidth": "standard",
"fontFamilyGoogle": false,
"fontSize": "1rem",
"editorFontFamilyGoogle": false,
"editorFontSize": "1rem",
"previewFontFamilyGoogle": false,
"previewFontSize": "1rem",
"zenFontFamily": "Inter",
"zenFontFamilyGoogle": true,
"zenFontSize": "1.25rem",
"zenWordCount": true,
"zenShowTitle": true,
"zenShowControls": true,
"zenInteractivePreview": false,
"shortcutPrefix": {
"steps": [
{
"key": "e",
"modifiers": [
"Mod"
]
}
]
},
"keyboardShortcuts": {},
"shortcutConfirmationSkips": {},
"theme": "dark"
}
Replace preferences
PATCH /api/prefs
Replaces all preferences. The method is PATCH, but the server does not merge fields. A field that you omit returns to its default. Read the current preferences, change the fields, and send the whole object with its revision in If-Match. The server ignores _sync_patch and _sync_base on this route. The body limit is 16 KiB.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Content-Type | application/json, required | Media type of the body. |
If-Match | string | The revision that you last read, with or without quotes. Without this header or with *, the server replaces the preferences without a revision check. |
Request body
| Key | Value | Description |
|---|
aiEnabled | boolean | Turn on AI. When false, every /api/ai/ route returns 403, and the server ends every AI session. Default: false. |
revision | integer | Revision. Each save increases it by 1. |
autoSave | boolean | Sync changes automatically. Changes are always saved on the device. Default: true. |
reduceMotion | string | system follows the operating system. always turns off animations. never keeps them on. One of system, always, never. Default: system. |
startView | string | View of a newly opened note. One of editor, preview, split, zen. Default: editor. |
hideToolbar | boolean | Hide the formatting toolbar above the editor. Default: false. |
hideSaveButton | boolean | Hide the manual Save button. Default: true. |
saveButtonLocation | string | panel puts the Save button in the editor toolbar. header puts it in the app header. One of "", panel, header. Default: panel. |
collapseDetails | boolean | Collapse the title and tags fields when a note opens. |
hideCursorHighlight | boolean | Turn off the preview highlight of the block at the cursor. |
interactivePreview | boolean | Allow toggling tasks and moving blocks in Split and Preview views. Default: true. |
statusDisplay | string | Sync status display. The web app uses normal, compact, or off. |
contentWidth | string | Width of the text column. One of "", compact, standard, wide, full. |
zenPageWidth | string | Width of the page in Zen mode. One of "", compact, standard, wide, full. |
theme | string | Built-in theme name, or a palette string that the client defines. The server does not interpret it. |
accentColor | string | Custom accent color. Empty means the theme color. |
fontFamily | string | Interface font. |
fontFamilyGoogle | boolean | Load fontFamily from Google Fonts. |
fontSize | string | Interface font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. |
editorFontFamily | string | Editor font. |
editorFontFamilyGoogle | boolean | Load editorFontFamily from Google Fonts. |
editorFontSize | string | Editor font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. |
previewFontFamily | string | Preview font. |
previewFontFamilyGoogle | boolean | Load previewFontFamily from Google Fonts. |
previewFontSize | string | Preview font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. |
zenFontFamily | string | Zen mode font. Default: Inter. |
zenFontFamilyGoogle | boolean | Load zenFontFamily from Google Fonts. Default: true. |
zenFontSize | string | Zen mode font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. Default: 1.25rem. |
zenWordCount | boolean | Show the word count in Zen mode. Default: true. |
zenShowTitle | boolean | Show the title in Zen mode. Default: true. |
zenShowControls | boolean | Show the controls in Zen mode. Default: true. |
zenInteractivePreview | boolean | Stored for clients. The vylk web app does not use it. |
shortcutPrefix | Shortcut | Key press that starts a shortcut. Exactly one step. The default is Mod+E. |
keyboardShortcuts | object | Custom shortcuts by action name, at most 64. null turns off the default shortcut for that action. Each value is Shortcut or null. |
shortcutConfirmationSkips | object | Actions that run without a confirmation, at most 64. Each value is true. |
_sync_patch | object | Changed fields. prefs.save operations only. |
_sync_base | object | Previous values of the changed fields. prefs.save operations only. |
Responses
| Status | Code | Description |
|---|
200 | | The saved preferences, with a new revision. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
400 | invalid_preferences_revision | If-Match is not a positive integer. |
400 | invalid_preferences | A field has a value outside its allowed set. error names the field. |
401 | authentication_required | The request has no valid session cookie. |
409 | preferences_revision_conflict | If-Match is not the current revision. current_revision holds the current revision. |
500 | save_preferences_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
aiEnabled | boolean | Turn on AI. When false, every /api/ai/ route returns 403, and the server ends every AI session. Default: false. |
revision | integer | Revision. Each save increases it by 1. |
autoSave | boolean | Sync changes automatically. Changes are always saved on the device. Default: true. |
reduceMotion | string | system follows the operating system. always turns off animations. never keeps them on. One of system, always, never. Default: system. |
startView | string | View of a newly opened note. One of editor, preview, split, zen. Default: editor. |
hideToolbar | boolean | Hide the formatting toolbar above the editor. Default: false. |
hideSaveButton | boolean | Hide the manual Save button. Default: true. |
saveButtonLocation | string | panel puts the Save button in the editor toolbar. header puts it in the app header. One of "", panel, header. Default: panel. |
collapseDetails | boolean | Collapse the title and tags fields when a note opens. |
hideCursorHighlight | boolean | Turn off the preview highlight of the block at the cursor. |
interactivePreview | boolean | Allow toggling tasks and moving blocks in Split and Preview views. Default: true. |
statusDisplay | string | Sync status display. The web app uses normal, compact, or off. |
contentWidth | string | Width of the text column. One of "", compact, standard, wide, full. |
zenPageWidth | string | Width of the page in Zen mode. One of "", compact, standard, wide, full. |
theme | string | Built-in theme name, or a palette string that the client defines. The server does not interpret it. |
accentColor | string | Custom accent color. Empty means the theme color. |
fontFamily | string | Interface font. |
fontFamilyGoogle | boolean | Load fontFamily from Google Fonts. |
fontSize | string | Interface font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. |
editorFontFamily | string | Editor font. |
editorFontFamilyGoogle | boolean | Load editorFontFamily from Google Fonts. |
editorFontSize | string | Editor font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. |
previewFontFamily | string | Preview font. |
previewFontFamilyGoogle | boolean | Load previewFontFamily from Google Fonts. |
previewFontSize | string | Preview font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. |
zenFontFamily | string | Zen mode font. Default: Inter. |
zenFontFamilyGoogle | boolean | Load zenFontFamily from Google Fonts. Default: true. |
zenFontSize | string | Zen mode font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. Default: 1.25rem. |
zenWordCount | boolean | Show the word count in Zen mode. Default: true. |
zenShowTitle | boolean | Show the title in Zen mode. Default: true. |
zenShowControls | boolean | Show the controls in Zen mode. Default: true. |
zenInteractivePreview | boolean | Stored for clients. The vylk web app does not use it. |
shortcutPrefix | Shortcut | Key press that starts a shortcut. Exactly one step. The default is Mod+E. |
keyboardShortcuts | object | Custom shortcuts by action name, at most 64. null turns off the default shortcut for that action. Each value is Shortcut or null. |
shortcutConfirmationSkips | object | Actions that run without a confirmation, at most 64. Each value is true. |
_sync_patch | object | Changed fields. prefs.save operations only. |
_sync_base | object | Previous values of the changed fields. prefs.save operations only. |
Example request
curl -X PATCH 'http://localhost:8080/api/prefs' \
-b cookies.txt -c cookies.txt \
-H 'If-Match: 2' \
-H 'Content-Type: application/json' \
-d '{
"aiEnabled": false,
"reduceMotion": "system",
"revision": 2,
"autoSave": true,
"startView": "split",
"hideToolbar": false,
"hideSaveButton": true,
"saveButtonLocation": "panel",
"collapseDetails": false,
"hideCursorHighlight": false,
"interactivePreview": true,
"contentWidth": "standard",
"zenPageWidth": "standard",
"fontFamilyGoogle": false,
"fontSize": "1rem",
"editorFontFamilyGoogle": false,
"editorFontSize": "1rem",
"previewFontFamilyGoogle": false,
"previewFontSize": "1rem",
"zenFontFamily": "Inter",
"zenFontFamilyGoogle": true,
"zenFontSize": "1.25rem",
"zenWordCount": true,
"zenShowTitle": true,
"zenShowControls": true,
"zenInteractivePreview": false,
"shortcutPrefix": {
"steps": [
{
"key": "e",
"modifiers": [
"Mod"
]
}
]
},
"keyboardShortcuts": {},
"shortcutConfirmationSkips": {},
"theme": "dark"
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"aiEnabled": false,
"reduceMotion": "system",
"revision": 3,
"autoSave": true,
"startView": "split",
"hideToolbar": false,
"hideSaveButton": true,
"saveButtonLocation": "panel",
"collapseDetails": false,
"hideCursorHighlight": false,
"interactivePreview": true,
"contentWidth": "standard",
"zenPageWidth": "standard",
"fontFamilyGoogle": false,
"fontSize": "1rem",
"editorFontFamilyGoogle": false,
"editorFontSize": "1rem",
"previewFontFamilyGoogle": false,
"previewFontSize": "1rem",
"zenFontFamily": "Inter",
"zenFontFamilyGoogle": true,
"zenFontSize": "1.25rem",
"zenWordCount": true,
"zenShowTitle": true,
"zenShowControls": true,
"zenInteractivePreview": false,
"shortcutPrefix": {
"steps": [
{
"key": "e",
"modifiers": [
"Mod"
]
}
]
},
"keyboardShortcuts": {},
"shortcutConfirmationSkips": {},
"theme": "dark"
}
Encryption
Read the vault status and keys, change credentials, and reset an encrypted vault.
Get the vault status
GET /api/vault/bootstrap
Returns the vault mode and the public key derivation settings. This route needs no session. Before you read cached notes or a remembered key, compare instance_id with the value that you stored. In a plaintext vault, vault_id, epoch, and kdf are absent. reset_available is true when the vault is encrypted and the server has a password. It does not account for VYLK_DISABLE_VAULT_CHANGES.
Responses
| Status | Code | Description |
|---|
200 | | The vault status. |
500 | vault_status_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Cache-Control | no-store | Responses are not cached. |
Response body
| Key | Value | Description |
|---|
mode | string | legacy: plaintext vault. preparing: encryption setup is converting notes. cleaning: the server is removing plaintext data. encrypted: encrypted vault. One of legacy, preparing, cleaning, encrypted. |
reset_available | boolean | True when POST /api/vault/reset can run. |
instance_id | string | Identity of the server database. Compare it with the value that you stored. |
require_strong_passwords | boolean | True when the client must reject weak encryption passwords. |
version | string | vylk version of the server. |
revision | string | Build of the web app. |
vault_id | string | Vault ID. Absent in a plaintext vault. |
epoch | integer | Current vault epoch. Absent in a plaintext vault. |
kdf | object | Argon2id settings for the password key. Absent in a plaintext vault. |
kdf.algorithm | argon2id13 | Key derivation function. |
kdf.salt | string | Salt. 16 bytes in unpadded base64url. |
kdf.memoryKiB | integer | Memory cost in KiB. From 19456 to 262144. |
kdf.iterations | integer | Time cost. From 2 to 10. |
Example request
curl 'http://localhost:8080/api/vault/bootstrap'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
{
"epoch": 1,
"instance_id": "95e9c24f3f492f0b776fa9f58b5837f0",
"kdf": {
"algorithm": "argon2id13",
"iterations": 3,
"memoryKiB": 65536,
"salt": "V2OdE0GPomvMRSmaTi4urQ"
},
"mode": "encrypted",
"require_strong_passwords": false,
"reset_available": true,
"revision": "3a7403423c47610d",
"vault_id": "_czcXBKjH4EmmKKl2q1TDQ",
"version": "3.1.2"
}
Get the wrapped keys
GET /api/vault/keys
Returns the two encrypted copies of the vault key. Decrypt wrapped_key with the key derived from the encryption password, or wrapped_recovery_key with the key derived from the recovery key.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Responses
| Status | Code | Description |
|---|
200 | | The wrapped keys. |
401 | authentication_required | The request has no valid session cookie. |
409 | vault_not_encrypted | The vault is not encrypted. |
500 | vault_status_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
vault_id | string | 16 random bytes in unpadded base64url. 22 characters. |
epoch | integer | Current vault epoch. |
wrapped_key | Envelope | Vault key, encrypted with the password key. |
wrapped_recovery_key | Envelope | Vault key, encrypted with the recovery key. |
Example request
curl 'http://localhost:8080/api/vault/keys' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"epoch": 1,
"vault_id": "_czcXBKjH4EmmKKl2q1TDQ",
"wrapped_key": {
"v": 1,
"nonce": "ax2sfi8tjylLhNvD",
"ciphertext": "JFBvmyEO5qHYDZqu2zydVahTTMN6qBJcOF-SEOFKsbkwxEL1l99HqeU-fy0pejEe"
},
"wrapped_recovery_key": {
"v": 1,
"nonce": "LkRY8fymwwTd72ro",
"ciphertext": "co7KXuXDSyRdINUo2PSFYQVcOCtteJC-eUjR0U7qJrqTUhm8Smln9c_vov2ZbTiJ"
}
}
Change a credential
POST /api/vault/credentials
Replaces the encryption password or the recovery key. Encrypt the existing vault key again with the new credential. Do not generate a new vault key. With kind set to master, the request replaces the password, and you must send new key derivation settings. With kind set to recovery, the request replaces the recovery key. current_recovery selects which current credential proves access. It is independent of kind. On success, the server revokes the current session. Unless sign_out_other_devices is false, it also revokes every other session. Sign in again with the new credential. The body limit is 32 KiB.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Content-Type | application/json, required | Media type of the body. |
Request body
| Key | Value | Description |
|---|
kind | string, required | master replaces the encryption password. recovery replaces the recovery key. One of master, recovery. |
current_proof | string, required | Proof derived from a current credential. |
current_recovery | boolean | True when current_proof comes from the recovery key. Default: false. |
new_proof | string, required | Proof derived from the new credential. |
wrapped_key | Envelope, required | Existing vault key, encrypted with the key derived from the new credential. |
kdf_salt | string | New Argon2id salt. Required when kind is master. |
kdf_memory_kib | integer | Argon2id memory cost in KiB. Required when kind is master. From 19456 to 262144. |
kdf_iterations | integer | Argon2id time cost. Required when kind is master. From 2 to 10. |
sign_out_other_devices | boolean | Revoke the sessions of every other device. Default: true. |
Responses
| Status | Code | Description |
|---|
200 | | The credential is changed. The response clears the session cookie. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
400 | invalid_vault_credentials | A proof or wrapped_key is malformed, or kind is not master or recovery. |
400 | invalid_vault_kdf | The key derivation settings are missing or out of range. kind is master only. |
401 | authentication_required | The request has no valid session cookie. |
401 | invalid_credentials | current_proof is wrong. |
403 | vault_changes_disabled | The server runs with VYLK_DISABLE_VAULT_CHANGES set to true. |
409 | vault_unavailable | The vault is not encrypted or is not ready. |
500 | credential_change_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Set-Cookie | string | Expires the session cookie. |
Response body
| Key | Value | Description |
|---|
ok | true | |
Example request
curl -X POST 'http://localhost:8080/api/vault/credentials' \
-b cookies.txt -c cookies.txt \
-H 'Content-Type: application/json' \
-d '{
"kind": "master",
"current_proof": "p2_0cRkBqKE3CtQ6YlGru2jL-Bgg3UctyEN9ulTmE9g",
"new_proof": "VXvVEOMZ9j8w1I2m0bWU0NFWGsZbunO00xlX-y3vkIY",
"wrapped_key": {
"v": 1,
"nonce": "NbbNB6-2nRQ5JPqE",
"ciphertext": "-5rrCT_2eq8jTGEXvIFKvXkuU2VIKIBKB38Dq1-4A7GGSoDy-HnFqU4G9dXH5vtY"
},
"kdf_salt": "V6xB-1M1KSMQgzBjJ6J4EQ",
"kdf_memory_kib": 65536,
"kdf_iterations": 3,
"sign_out_other_devices": true
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Set-Cookie: session=; Path=/; Max-Age=0; HttpOnly; SameSite=Lax
{
"ok": true
}
Reset the vault
POST /api/vault/reset
Replaces an encrypted vault with a new, empty vault. Use this route only when the encryption password and the recovery key are both lost. It does not decrypt anything. The request needs no session. It needs the server password, VYLK_PASSWORD, in password. Generate new vault credentials on the client, as for POST /api/vault/migration/start. The server moves the old database and encrypted notes to an archive and deletes the archive after 30 days. It deletes all notes and the change feed, revokes every session, and returns a new session. instance_id stays the same. vault_id changes, and epoch increases. The body limit is 32 KiB. If the response is lost, read GET /api/vault/bootstrap before you retry.
Request headers
| Key | Value | Description |
|---|
Content-Type | application/json, required | Media type of the body. |
Request body
| Key | Value | Description |
|---|
vault_id | string, required | New random vault ID. |
kdf_salt | string, required | New random Argon2id salt. 16 bytes in unpadded base64url. |
kdf_memory_kib | integer, required | Argon2id memory cost in KiB. From 19456 to 262144. |
kdf_iterations | integer, required | Argon2id time cost. From 2 to 10. |
auth_proof | string, required | Proof derived from the encryption password. |
recovery_proof | string, required | Proof derived from the recovery key. |
wrapped_key | Envelope, required | Vault key, encrypted with the password key. |
wrapped_recovery_key | Envelope, required | Vault key, encrypted with the recovery key. |
password | string, required | The server password, VYLK_PASSWORD. Not the encryption password. |
Responses
| Status | Code | Description |
|---|
200 | | The new vault is active. The response sets new session and vylk-device cookies. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
400 | invalid_vault_reset | A vault ID, salt, proof, envelope, or key derivation setting is invalid. |
401 | invalid_credentials | password is not VYLK_PASSWORD. |
403 | vault_changes_disabled | The server runs with VYLK_DISABLE_VAULT_CHANGES set to true. |
403 | vault_reset_unavailable | The server has no VYLK_PASSWORD. |
409 | vault_reset_unavailable | The vault is not encrypted, or encryption setup is not finished. |
429 | login_rate_limited | Too many failed attempts from this client address. Wait for the number of seconds in retry_after. |
500 | vault_reset_failed | The server could not complete the request. |
503 | note_file_recovery_blocked | An interrupted file operation needs recovery first. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | Two cookies: session and vylk-device. Store both. |
Retry-After | string | Sent with status 429. Seconds to wait before the next attempt. |
Response body
| Key | Value | Description |
|---|
ok | true | |
vault_id | string | 16 random bytes in unpadded base64url. 22 characters. |
epoch | integer | Epoch of the new vault. |
archive_expires_at | string (date-time) | Time when the server deletes the archive. |
Example request
curl -X POST 'http://localhost:8080/api/vault/reset' \
-H 'Content-Type: application/json' \
-d '{
"password": "your-server-password",
"vault_id": "ZDjs0jd0FK2cJRMlqSpVKw",
"kdf_salt": "kDc-l8DIgsH8T6R2uAtb3w",
"kdf_memory_kib": 65536,
"kdf_iterations": 3,
"auth_proof": "KCEzRWwevRRVjHmKfFnHw0GvKOQWsLKY-2WDCV2twaw",
"recovery_proof": "Ov1bHpA5nWSGG9S1pg8So2sZmkNHGVwcB1OGgTuckDw",
"wrapped_key": {
"v": 1,
"nonce": "oLWV8NohFSiPWRKY",
"ciphertext": "U5zN9F7iZcRfSBJxn9vPH1lDvR0VGTiy58cZ1X7MnMxEcn05llAjA57CWHNAB-PT"
},
"wrapped_recovery_key": {
"v": 1,
"nonce": "n1PUQNhS8_geJn5l",
"ciphertext": "ZUvRpupL9JqEyK4qeZEptky5UfjmQoccKSa7EfDbZ0PfdTJcyzVxlxJOs4IAjSc_"
}
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Set-Cookie: vylk-device=fdd91647e9dd809fdaf557291a2acd92; Path=/; Max-Age=31536000; HttpOnly; SameSite=Lax
Set-Cookie: session=81abd2fc412f40d7039912b972a6bb15; Path=/; Max-Age=15552000; HttpOnly; SameSite=Lax
{
"archive_expires_at": "2026-12-22T02:41:08Z",
"epoch": 2,
"ok": true,
"vault_id": "ZDjs0jd0FK2cJRMlqSpVKw"
}
Migration
Convert a plaintext vault to an encrypted vault. The routes run in the order listed.
Verify the password
POST /api/vault/setup/verify-password
Checks that password is the server password before encryption setup. Failed attempts count toward the sign-in rate limit. This route changes nothing on the server. It works before setup and while a started setup waits to resume.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Content-Type | application/json, required | Media type of the body. |
Request body
| Key | Value | Description |
|---|
password | string, required | The server password, VYLK_PASSWORD. |
Responses
| Status | Code | Description |
|---|
200 | | The password is correct. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
401 | authentication_required | The request has no valid session cookie. |
403 | invalid_credentials | The password is wrong. |
403 | vault_changes_disabled | The server runs with VYLK_DISABLE_VAULT_CHANGES set to true. |
409 | vault_setup_unavailable | The vault is already encrypted. |
429 | login_rate_limited | Too many failed attempts from this client address. |
500 | login_rate_limit_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Cache-Control | no-store | Responses are not cached. |
Retry-After | string | Sent with status 429. Seconds to wait before the next attempt. |
Response body
| Key | Value | Description |
|---|
ok | true | |
Example request
curl -X POST 'http://localhost:8080/api/vault/setup/verify-password' \
-b cookies.txt -c cookies.txt \
-H 'Content-Type: application/json' \
-d '{
"password": "your-server-password"
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
{
"ok": true
}
Start encryption
POST /api/vault/migration/start
Starts converting a plaintext vault to an encrypted vault. Generate the vault ID, the salt, the vault key, the recovery key, both proofs, and both wrapped keys on the client. The server checks old_password, saves a backup of the notes, and pauses note writes. A repeated request with the same vault_id resumes the setup and keeps the credentials stored by the first request. Keep the setup secrets until POST /api/vault/migration/commit succeeds. No route cancels a started setup. The body limit is 32 KiB.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Content-Type | application/json, required | Media type of the body. |
Request body
| Key | Value | Description |
|---|
vault_id | string, required | New random vault ID. |
kdf_salt | string, required | New random Argon2id salt. 16 bytes in unpadded base64url. |
kdf_memory_kib | integer, required | Argon2id memory cost in KiB. From 19456 to 262144. |
kdf_iterations | integer, required | Argon2id time cost. From 2 to 10. |
auth_proof | string, required | Proof derived from the encryption password. |
recovery_proof | string, required | Proof derived from the recovery key. |
wrapped_key | Envelope, required | Vault key, encrypted with the password key. |
wrapped_recovery_key | Envelope, required | Vault key, encrypted with the recovery key. |
old_password | string, required | The server password, VYLK_PASSWORD. |
Responses
| Status | Code | Description |
|---|
200 | | The setup is started. Upload the encrypted notes next. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
400 | invalid_vault_setup | old_password is wrong, or a vault ID, salt, proof, envelope, or key derivation setting is invalid. |
401 | authentication_required | The request has no valid session cookie. |
403 | vault_changes_disabled | The server runs with VYLK_DISABLE_VAULT_CHANGES set to true. |
409 | vault_setup_already_started | The vault is encrypted, or a setup with another vault_id is in progress. |
409 | unexpected_note_files | The notes folder holds files that the database does not list. error names the problem. |
500 | vault_setup_failed | The server could not complete the request. |
503 | note_recovery_pending | An interrupted file operation needs recovery first. |
503 | note_recovery_failed | File recovery failed. The server operator must fix it. |
507 | migration_backup_failed | The server could not write the backup. Free disk space and retry with the same body. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
ok | true | |
epoch | 1 | Epoch of the new vault. |
Example request
curl -X POST 'http://localhost:8080/api/vault/migration/start' \
-b cookies.txt -c cookies.txt \
-H 'Content-Type: application/json' \
-d '{
"vault_id": "_czcXBKjH4EmmKKl2q1TDQ",
"kdf_salt": "V2OdE0GPomvMRSmaTi4urQ",
"kdf_memory_kib": 65536,
"kdf_iterations": 3,
"auth_proof": "p2_0cRkBqKE3CtQ6YlGru2jL-Bgg3UctyEN9ulTmE9g",
"recovery_proof": "l6nRkO9YgnXzpnilSnYfjT7ldRbz2ye-cc7Gulrv3Zc",
"wrapped_key": {
"v": 1,
"nonce": "ax2sfi8tjylLhNvD",
"ciphertext": "JFBvmyEO5qHYDZqu2zydVahTTMN6qBJcOF-SEOFKsbkwxEL1l99HqeU-fy0pejEe"
},
"wrapped_recovery_key": {
"v": 1,
"nonce": "LkRY8fymwwTd72ro",
"ciphertext": "co7KXuXDSyRdINUo2PSFYQVcOCtteJC-eUjR0U7qJrqTUhm8Smln9c_vov2ZbTiJ"
},
"old_password": "your-server-password"
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"epoch": 1,
"ok": true
}
Get the encryption progress
GET /api/vault/migration/status
Returns the vault mode and the number of notes that are uploaded and verified. Encryption can finish when verified_notes equals source_notes.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Responses
| Status | Code | Description |
|---|
200 | | The progress. |
401 | authentication_required | The request has no valid session cookie. |
409 | vault_migration_not_started | Encryption setup has not started. |
500 | vault_status_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
mode | string | legacy: plaintext vault. preparing: encryption setup is converting notes. cleaning: the server is removing plaintext data. encrypted: encrypted vault. One of legacy, preparing, cleaning, encrypted. |
backup_ready | boolean | True when the server has saved the backup. |
source_notes | integer | Plaintext notes to convert. |
staged_notes | integer | Notes with an uploaded encrypted copy. |
verified_notes | integer | Uploaded copies that the client has verified. |
Example request
curl 'http://localhost:8080/api/vault/migration/status' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"backup_ready": true,
"mode": "preparing",
"source_notes": 2,
"staged_notes": 0,
"verified_notes": 0
}
List notes to convert
GET /api/vault/migration/next
Lists up to 100 notes that have no verified encrypted copy, in ascending ID order. To read the next page, pass the last ID as after. An empty array means that every note is verified. When a note changes, its earlier verification no longer counts.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Query parameters
| Key | Value | Description |
|---|
after | string | The last ID of the previous page. The response starts after it. |
Responses
| Status | Code | Description |
|---|
200 | | The notes to convert. |
401 | authentication_required | The request has no valid session cookie. |
409 | vault_migration_not_ready | Setup has not started or the backup is not saved. |
500 | vault_migration_list_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
An array of objects.
| Key | Value | Description |
|---|
[].id | string | Note ID. 1 to 64 letters, digits, hyphens, or underscores. |
[].revision | integer | Current revision of the plaintext note. |
Example request
curl 'http://localhost:8080/api/vault/migration/next' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
[
{
"id": "reading-list",
"revision": 2
},
{
"id": "trip-notes",
"revision": 2
}
]
Upload an encrypted copy
POST /api/vault/migration/stage
Uploads the encrypted copy of one note. revision must match the plaintext note. A new upload for the same note replaces the copy and clears its verification. After the upload, read the copy back with GET /api/vault/migration/staged/{id} and verify it. The body limit is 8 MiB.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Content-Type | application/json, required | Media type of the body. |
Request body
| Key | Value | Description |
|---|
id | string, required | Note ID. 1 to 64 letters, digits, hyphens, or underscores. |
revision | integer, required | Revision of the plaintext note. At least 1. |
summary | Envelope, required | Encrypted title and tags. |
body | Envelope, required | Encrypted note text. |
Responses
| Status | Code | Description |
|---|
200 | | The copy is stored. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
400 | invalid_encrypted_note | id, revision, or an envelope is invalid. |
401 | authentication_required | The request has no valid session cookie. |
403 | vault_changes_disabled | The server runs with VYLK_DISABLE_VAULT_CHANGES set to true. |
409 | vault_migration_not_ready | Setup has not started or the backup is not saved. |
409 | vault_note_changed | The note does not exist or has another revision. |
500 | vault_stage_failed | The server could not complete the request. |
507 | vault_stage_failed | The server could not write the file. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
ok | true | |
Example request
curl -X POST 'http://localhost:8080/api/vault/migration/stage' \
-b cookies.txt -c cookies.txt \
-H 'Content-Type: application/json' \
-d '{
"id": "reading-list",
"revision": 2,
"summary": {
"v": 1,
"nonce": "WEX-YDY8-R2R8E51",
"ciphertext": "5IGkqpAUUPCkD_LS96p4Bk10I1sloJgvBoDNiv5YOJp0BY_2_F0YFUtHJSjTy_q8soQoHV9_C4O2Oc9BxYnC6A"
},
"body": {
"v": 1,
"nonce": "p5ErQVu1FwrjfG5y",
"ciphertext": "j2AABCqv8cUGf_xvNOCFt_RSv8hlXuGc37TQtrNP1pm3sv9OjF07Fmx_crOun2_xWQN1fixs4tXckyzXa4snZcM8DU3LL72zJVCrqkq661H1XZcxmkAbcRZWH5twN8hG"
}
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"ok": true
}
Get an encrypted copy
GET /api/vault/migration/staged/{id}
Returns the uploaded encrypted copy of a note as the server stored it. Decrypt it and compare it with the plaintext note before you verify it.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Path parameters
| Key | Value | Description |
|---|
id | string, required | Note identifier. Pattern: ^[A-Za-z0-9_-]{1,64}$. |
Responses
| Status | Code | Description |
|---|
200 | | The encrypted copy. |
401 | authentication_required | The request has no valid session cookie. |
404 | staged_note_not_found | No copy is uploaded for this ID. |
500 | staged_note_unavailable | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
id | string | Note ID. 1 to 64 letters, digits, hyphens, or underscores. |
revision | integer | Revision of the plaintext note. |
summary | Envelope | Encrypted title and tags. |
body | Envelope | Encrypted note text. |
epoch | integer | Vault epoch. |
body_hash | string | SHA-256 of the stored body bytes, in lowercase hexadecimal. Not a hash of the Markdown. |
Example request
curl 'http://localhost:8080/api/vault/migration/staged/trip-notes' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"body": {
"v": 1,
"nonce": "p5ErQVu1FwrjfG5y",
"ciphertext": "j2AABCqv8cUGf_xvNOCFt_RSv8hlXuGc37TQtrNP1pm3sv9OjF07Fmx_crOun2_xWQN1fixs4tXckyzXa4snZcM8DU3LL72zJVCrqkq661H1XZcxmkAbcRZWH5twN8hG"
},
"body_hash": "21f8ba681e86f93e0af89edb6ea0ba755b6799460d35fe0d3b13a4dd4bba646c",
"epoch": 1,
"id": "reading-list",
"revision": 2,
"summary": {
"v": 1,
"nonce": "WEX-YDY8-R2R8E51",
"ciphertext": "5IGkqpAUUPCkD_LS96p4Bk10I1sloJgvBoDNiv5YOJp0BY_2_F0YFUtHJSjTy_q8soQoHV9_C4O2Oc9BxYnC6A"
}
}
Confirm an encrypted copy
POST /api/vault/migration/verify
Records that the client decrypted the uploaded copy and that it matches the plaintext note. Send the body_hash from GET /api/vault/migration/staged/{id}. The server checks only the hash and the revision. It cannot check the decryption. The body limit is 4 KiB.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Content-Type | application/json, required | Media type of the body. |
Request body
| Key | Value | Description |
|---|
id | string, required | Note ID. 1 to 64 letters, digits, hyphens, or underscores. |
body_hash | string, required | body_hash from the uploaded copy. 64 lowercase hexadecimal characters. |
Responses
| Status | Code | Description |
|---|
200 | | The copy is verified. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
400 | invalid_verification | id is invalid or body_hash is not 64 characters. |
401 | authentication_required | The request has no valid session cookie. |
403 | vault_changes_disabled | The server runs with VYLK_DISABLE_VAULT_CHANGES set to true. |
409 | vault_migration_not_ready | Setup has not started. |
409 | vault_verify_mismatch | The hash does not match the stored copy, or the note changed. |
500 | vault_verify_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
ok | true | |
Example request
curl -X POST 'http://localhost:8080/api/vault/migration/verify' \
-b cookies.txt -c cookies.txt \
-H 'Content-Type: application/json' \
-d '{
"id": "reading-list",
"body_hash": "21f8ba681e86f93e0af89edb6ea0ba755b6799460d35fe0d3b13a4dd4bba646c"
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"ok": true
}
Finish encryption
POST /api/vault/migration/commit
Switches the vault to encrypted storage. Every note must have a verified copy. The request has no body. The server deletes the plaintext notes, the plaintext indexes, and the stored sync operations, and it revokes every session. Sign in again with the derived proof. Sync queue sequence numbers continue. Do not restart them at 1. If the response is 500 with vault_cleanup_pending, the switch succeeded. The server finishes the cleanup at its next start. Do not start a new setup.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Responses
| Status | Code | Description |
|---|
200 | | The vault is encrypted. |
401 | authentication_required | The request has no valid session cookie. |
403 | vault_changes_disabled | The server runs with VYLK_DISABLE_VAULT_CHANGES set to true. |
409 | vault_migration_not_ready | Setup has not started or the backup is not saved. |
409 | vault_migration_incomplete | Some notes have no verified copy. |
409 | unexpected_note_files | The notes folder holds files that the database does not list. |
409 | vault_verify_failed | An encrypted file is missing or changed. |
500 | vault_commit_failed | The switch failed. The vault is still in setup. |
500 | vault_cleanup_pending | The switch succeeded. Cleanup resumes when the server restarts. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Response body
| Key | Value | Description |
|---|
ok | true | |
mode | encrypted | |
Example request
curl -X POST 'http://localhost:8080/api/vault/migration/commit' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"mode": "encrypted",
"ok": true
}
AI
Configure AI providers and edit notes with AI. Every route needs the aiEnabled preference. The client protocol describes the request flow and its limits.
Get AI capabilities
GET /api/ai/capabilities
Returns whether the client can turn model thinking on and off, and a display name for the provider. Both values describe the default configuration, and only when it is checked. Without a checked default, thinking_controllable is false and provider_name is a generic phrase. The server can read model metadata from the provider, but it does not generate a response.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Responses
| Status | Code | Description |
|---|
200 | | The capabilities. |
400 | ai_request_failed | AI was turned off during the request, or the server could not read the configurations. |
401 | authentication_required | The request has no valid session cookie. |
403 | ai_disabled | The aiEnabled preference is false. |
500 | ai_unavailable | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Cache-Control | no-store | Responses are not cached. |
Response body
| Key | Value | Description |
|---|
thinking_controllable | boolean | True when requests can set thinking. |
provider_name | string | Name and model of the default configuration, for display. |
Example request
curl 'http://localhost:8080/api/ai/capabilities' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
{
"provider_name": "OpenRouter (openai/gpt-4.1-mini)",
"thinking_controllable": false
}
List AI configurations
GET /api/ai/configurations
Returns every AI configuration, in order of creation. Responses never contain API keys. has_key tells whether a key is saved.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Responses
| Status | Code | Description |
|---|
200 | | The configurations. |
401 | authentication_required | The request has no valid session cookie. |
403 | ai_disabled | The aiEnabled preference is false. |
500 | ai_unavailable | The server could not complete the request. |
500 | ai_storage_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Cache-Control | no-store | Responses are not cached. |
Response body
An array of AI configuration.
Example request
curl 'http://localhost:8080/api/ai/configurations' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
[
{
"output_profile": "",
"id": "93e426f2feca1406629434a9891ce6d7",
"name": "OpenRouter",
"url": "https://openrouter.ai/api/v1",
"model": "openai/gpt-4.1-mini",
"has_key": true,
"checked": true,
"is_default": true,
"revision": 1,
"context_tokens": 0,
"concurrency": 0
},
{
"output_profile": "",
"id": "5ac56143516b29c821e302682e246296",
"name": "Ollama on desktop",
"url": "http://192.168.1.20:11434/v1",
"model": "qwen3:8b",
"has_key": false,
"checked": true,
"is_default": false,
"revision": 2,
"context_tokens": 32768,
"concurrency": 2
}
]
Create an AI configuration
POST /api/ai/configurations
Saves a new configuration. With a test_token, the configuration is saved as checked. Without one, it is saved unchecked, and sessions cannot use it until POST /api/ai/configurations/{id}/check succeeds. The first successful check on a server makes that configuration the default when no default exists. A server holds at most 32 configurations. The body limit is 24 KiB.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Content-Type | application/json, required | Media type of the body. |
Request body
| Key | Value | Description |
|---|
name | string, required | Display name. 1 to 120 characters, with no control characters. |
url | string, required | API base URL, such as https://openrouter.ai/api/v1. Not the completions URL. HTTP or HTTPS, with no user name, password, query, or fragment. At most 2048 bytes. |
key | string | API key. At most 16 KiB. Omit it to keep the saved key. Send an empty string to remove the key. |
model | string, required | Model ID. The server sends it to the provider unchanged. At most 256 bytes. |
output_profile | string | Empty: the server detects whether the provider supports JSON Schema output. json_schema: always request JSON Schema output. One of "", json_schema. |
context_tokens | integer | Context window in tokens. 0, or 2048 to 16777216. 0 uses the window that the provider reports, or 32768. |
concurrency | integer | Parallel requests for one AI job. 0 uses VYLK_AI_CONCURRENCY. The server never exceeds VYLK_AI_CONCURRENCY. From 0 to 8. |
test_token | string | test_token from POST /api/ai/configurations/test. With a valid token, the configuration is saved as checked. |
Responses
| Status | Code | Description |
|---|
200 | | The saved configuration. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
400 | ai_request_failed | A field is invalid, the server already holds 32 configurations, or test_token is expired, already used, or for different settings. error names the problem. |
401 | authentication_required | The request has no valid session cookie. |
403 | ai_disabled | The aiEnabled preference is false. |
500 | ai_unavailable | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Cache-Control | no-store | Responses are not cached. |
Response body
| Key | Value | Description |
|---|
id | string | Configuration ID. |
name | string | Display name. |
url | string | API base URL. |
model | string | Model ID. |
has_key | boolean | True when an API key is saved. The API never returns the key. |
checked | boolean | True when a test or check succeeded with the current url, model, output_profile, and key. Sessions use only checked configurations. |
is_default | boolean | True for the configuration that new sessions use. At most one configuration is the default. |
revision | integer | Revision. Each update increases it by 1. |
output_profile | string | Empty: detect JSON Schema support. json_schema: always request JSON Schema output. One of "", json_schema. |
context_tokens | integer | Context window in tokens. 0 uses the provider value or 32768. |
concurrency | integer | Parallel requests for one job. 0 uses VYLK_AI_CONCURRENCY. |
Example request
curl -X POST 'http://localhost:8080/api/ai/configurations' \
-b cookies.txt -c cookies.txt \
-H 'Content-Type: application/json' \
-d '{
"name": "OpenRouter",
"url": "https://openrouter.ai/api/v1",
"key": "sk-or-v1-example",
"model": "openai/gpt-4.1-mini",
"context_tokens": 0,
"concurrency": 0,
"test_token": "a2c4bb6b931a8b86bcdc1aed395736bf.1795349269.9e66c902fe9c4dbe7f91364d579838b2b8338d789d2285cd97070ae633f34c51"
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
{
"output_profile": "",
"id": "93e426f2feca1406629434a9891ce6d7",
"name": "OpenRouter",
"url": "https://openrouter.ai/api/v1",
"model": "openai/gpt-4.1-mini",
"has_key": true,
"checked": true,
"is_default": true,
"revision": 1,
"context_tokens": 0,
"concurrency": 0
}
Test an AI configuration
POST /api/ai/configurations/test
Sends one short request to the provider and reports whether it returned a valid reply. Nothing is saved, but the server records the usage. The request has a limit of 2048 output tokens. If the model supports thinking control, the test turns thinking off. To test a saved configuration with its saved key, send its id and revision and omit key. A successful test returns a test_token. Send it to POST /api/ai/configurations or PUT /api/ai/configurations/{id} to save the configuration as checked. The token is valid for 10 minutes and for one save. The server forgets it on restart and when AI is turned off. It is bound to this session and to url, key, model, output_profile, id, and revision. A change to name, context_tokens, or concurrency does not invalidate it. The provider can take up to 10 minutes to reply. The body limit is 24 KiB.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Content-Type | application/json, required | Media type of the body. |
Request body
| Key | Value | Description |
|---|
name | string | Display name. 1 to 120 characters, with no control characters. |
url | string, required | API base URL, such as https://openrouter.ai/api/v1. Not the completions URL. HTTP or HTTPS, with no user name, password, query, or fragment. At most 2048 bytes. |
key | string | API key. At most 16 KiB. Omit it to keep the saved key. Send an empty string to remove the key. |
model | string, required | Model ID. The server sends it to the provider unchanged. At most 256 bytes. |
output_profile | string | Empty: the server detects whether the provider supports JSON Schema output. json_schema: always request JSON Schema output. One of "", json_schema. |
context_tokens | integer | Context window in tokens. 0, or 2048 to 16777216. 0 uses the window that the provider reports, or 32768. |
concurrency | integer | Parallel requests for one AI job. 0 uses VYLK_AI_CONCURRENCY. The server never exceeds VYLK_AI_CONCURRENCY. From 0 to 8. |
id | string | ID of a saved configuration. Required to test with its saved key. |
revision | integer | Current revision of the saved configuration. Required with id. |
Responses
| Status | Code | Description |
|---|
200 | | The provider returned a valid reply. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
400 | ai_request_failed | A field is invalid, the saved configuration changed, the provider failed or timed out, or the reply was not valid. error names the problem. |
401 | authentication_required | The request has no valid session cookie. |
403 | ai_disabled | The aiEnabled preference is false. |
500 | ai_unavailable | The server could not complete the request. |
500 | ai_deadline_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Cache-Control | no-store | Responses are not cached. |
Response body
| Key | Value | Description |
|---|
ok | true | |
thinking_controllable | boolean | True when requests can set thinking. |
test_token | string | Proof of this test. Send it when you save the configuration. |
reported_context_tokens | integer | Context window that the provider reports. 0 when the provider reports none. |
default_context_tokens | integer | Context window that the server uses when neither context_tokens nor the provider sets one. |
Example request
curl -X POST 'http://localhost:8080/api/ai/configurations/test' \
-b cookies.txt -c cookies.txt \
-H 'Content-Type: application/json' \
-d '{
"name": "OpenRouter",
"url": "https://openrouter.ai/api/v1",
"key": "sk-or-v1-example",
"model": "openai/gpt-4.1-mini",
"context_tokens": 0,
"concurrency": 0
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
{
"default_context_tokens": 32768,
"ok": true,
"reported_context_tokens": 0,
"test_token": "a2c4bb6b931a8b86bcdc1aed395736bf.1795349269.9e66c902fe9c4dbe7f91364d579838b2b8338d789d2285cd97070ae633f34c51",
"thinking_controllable": false
}
Update an AI configuration
PUT /api/ai/configurations/{id}
Replaces a configuration. Send every field. A field that you omit takes its zero value, except key, which keeps the saved key. revision must equal the current revision. The saved configuration has a new revision. The configuration stays checked only when url, model, output_profile, and key do not change, or when the request has a valid test_token. The update closes every AI session that uses this configuration. The body limit is 24 KiB.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Content-Type | application/json, required | Media type of the body. |
Path parameters
| Key | Value | Description |
|---|
id | string, required | Configuration ID. |
Request body
| Key | Value | Description |
|---|
name | string, required | Display name. 1 to 120 characters, with no control characters. |
url | string, required | API base URL, such as https://openrouter.ai/api/v1. Not the completions URL. HTTP or HTTPS, with no user name, password, query, or fragment. At most 2048 bytes. |
key | string | API key. At most 16 KiB. Omit it to keep the saved key. Send an empty string to remove the key. |
model | string, required | Model ID. The server sends it to the provider unchanged. At most 256 bytes. |
output_profile | string | Empty: the server detects whether the provider supports JSON Schema output. json_schema: always request JSON Schema output. One of "", json_schema. |
context_tokens | integer | Context window in tokens. 0, or 2048 to 16777216. 0 uses the window that the provider reports, or 32768. |
concurrency | integer | Parallel requests for one AI job. 0 uses VYLK_AI_CONCURRENCY. The server never exceeds VYLK_AI_CONCURRENCY. From 0 to 8. |
revision | integer, required | Current revision. |
test_token | string | test_token from POST /api/ai/configurations/test. With a valid token, the configuration is saved as checked. |
Responses
| Status | Code | Description |
|---|
200 | | The saved configuration. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
400 | ai_request_failed | The ID is invalid or unknown, a field is invalid, revision is not current, or test_token is not valid for these settings. error names the problem. |
401 | authentication_required | The request has no valid session cookie. |
403 | ai_disabled | The aiEnabled preference is false. |
500 | ai_unavailable | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Cache-Control | no-store | Responses are not cached. |
Response body
| Key | Value | Description |
|---|
id | string | Configuration ID. |
name | string | Display name. |
url | string | API base URL. |
model | string | Model ID. |
has_key | boolean | True when an API key is saved. The API never returns the key. |
checked | boolean | True when a test or check succeeded with the current url, model, output_profile, and key. Sessions use only checked configurations. |
is_default | boolean | True for the configuration that new sessions use. At most one configuration is the default. |
revision | integer | Revision. Each update increases it by 1. |
output_profile | string | Empty: detect JSON Schema support. json_schema: always request JSON Schema output. One of "", json_schema. |
context_tokens | integer | Context window in tokens. 0 uses the provider value or 32768. |
concurrency | integer | Parallel requests for one job. 0 uses VYLK_AI_CONCURRENCY. |
Example request
curl -X PUT 'http://localhost:8080/api/ai/configurations/5ac56143516b29c821e302682e246296' \
-b cookies.txt -c cookies.txt \
-H 'Content-Type: application/json' \
-d '{
"name": "Ollama on desktop",
"url": "http://192.168.1.20:11434/v1",
"model": "qwen3:8b",
"revision": 1,
"context_tokens": 32768,
"concurrency": 2
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
{
"output_profile": "",
"id": "5ac56143516b29c821e302682e246296",
"name": "Ollama on desktop",
"url": "http://192.168.1.20:11434/v1",
"model": "qwen3:8b",
"has_key": false,
"checked": true,
"is_default": true,
"revision": 2,
"context_tokens": 32768,
"concurrency": 2
}
Delete an AI configuration
DELETE /api/ai/configurations/{id}
Deletes a configuration and closes every AI session that uses it. When you delete the default configuration, the server does not choose another default. Usage records stay.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Path parameters
| Key | Value | Description |
|---|
id | string, required | Configuration ID. |
Responses
| Status | Code | Description |
|---|
204 | | Deleted. The response has no body. |
400 | ai_request_failed | The ID is invalid, or the server could not delete the configuration. |
401 | authentication_required | The request has no valid session cookie. |
403 | ai_disabled | The aiEnabled preference is false. |
500 | ai_unavailable | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Cache-Control | no-store | Responses are not cached. |
Example request
curl -X DELETE 'http://localhost:8080/api/ai/configurations/5ac56143516b29c821e302682e246296' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 204 No Content
Cache-Control: no-store
Check or select an AI configuration
POST /api/ai/configurations/{id}/{action}
check sends one short request to the provider, the same as POST /api/ai/configurations/test, and marks the saved configuration as checked when the reply is valid. A failed check marks it unchecked and closes the sessions that use it. The server records the usage. The provider can take up to 10 minutes to reply. default makes a checked configuration the default. New sessions use the default configuration. Neither action has a request body.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Path parameters
| Key | Value | Description |
|---|
id | string, required | Configuration ID. |
action | string, required | Action to run. One of check, default. |
Responses
| Status | Code | Description |
|---|
200 | | check only. The check succeeded. |
204 | | default only. The configuration is the default. The response has no body. |
400 | ai_request_failed | The ID is invalid or unknown, the configuration is not checked (default), or the provider failed or timed out (check). error names the problem. |
401 | authentication_required | The request has no valid session cookie. |
403 | ai_disabled | The aiEnabled preference is false. |
404 | | Not found. The action is not one of the listed values. The body is plain text. |
500 | ai_unavailable | The server could not complete the request. |
500 | ai_deadline_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Cache-Control | no-store | Responses are not cached. |
Cache-Control | no-store | Sent with status 204. Responses are not cached. |
Response body
| Key | Value | Description |
|---|
ok | true | |
Example request
curl -X POST 'http://localhost:8080/api/ai/configurations/5ac56143516b29c821e302682e246296/check' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
{
"ok": true
}
Start an AI session
POST /api/ai/sessions
Starts a session with the default configuration. The configuration must be checked. A session holds a draft of the shared text, the conversation, and the suggested changes. The server sends only text to the provider, never the title, the tags, or the rest of the note. In an encrypted vault, the client sends decrypted text, and the server forwards it to the provider. A session belongs to the session cookie that created it. It ends after 30 minutes without requests, when you sign out, when AI is turned off, and when the server restarts. The server holds at most four sessions at a time. The body limit is about 6 MiB.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Content-Type | application/json, required | Media type of the body. |
Request body
| Key | Value | Description |
|---|
note_id | string, required | Note that the session edits. Pattern: ^[A-Za-z0-9_-]{1,64}$. |
scope | string, required | What text contains. none: nothing; the provider receives only the prompts. selection: selected Markdown, or an empty string for an insertion point. note: the whole note text. One of none, selection, note. |
text | string, required | Shared Markdown. At most 1 MiB. Must be empty when scope is none. |
Responses
| Status | Code | Description |
|---|
200 | | The new session. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
400 | ai_request_failed | note_id or scope is invalid, text is larger than 1 MiB, there is no checked default configuration, or four sessions are open. error names the problem. |
401 | authentication_required | The request has no valid session cookie. |
403 | ai_disabled | The aiEnabled preference is false. |
500 | ai_unavailable | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Cache-Control | no-store | Responses are not cached. |
Response body
| Key | Value | Description |
|---|
id | string | Session ID. |
note_id | string | Note that the session edits. Pattern: ^[A-Za-z0-9_-]{1,64}$. |
configuration_id | string | Configuration that the session uses. |
scope | string | What the shared text contains. One of none, selection, note. |
draft | string | Shared text with the accepted changes. |
hunks | array of AI hunk | Suggested changes from the last request that suggested any. |
answer | string | Reply from the model to the last request. |
version | integer | Version. Each change to the session increases it. Send it with each action. |
can_undo | boolean | True when undo can revert an acceptance. |
changed | boolean | True when draft differs from the shared text. |
thinking_controllable | boolean | True when requests can set thinking. Fixed for the session. |
job | AI job | Latest job. Absent before the first job. |
Example request
curl -X POST 'http://localhost:8080/api/ai/sessions' \
-b cookies.txt -c cookies.txt \
-H 'Content-Type: application/json' \
-d '{
"note_id": "trip-notes",
"scope": "note",
"text": "# Trip notes\n\nPack teh charger.\n\nBook the train.\n"
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
{
"configuration_id": "93e426f2feca1406629434a9891ce6d7",
"thinking_controllable": false,
"id": "0acde88882e62aaf5229b714b9054f8d",
"note_id": "trip-notes",
"scope": "note",
"draft": "# Trip notes\n\nPack teh charger.\n\nBook the train.\n",
"hunks": [],
"answer": "",
"version": 0,
"can_undo": false,
"changed": false
}
Get an AI session
GET /api/ai/sessions/{id}
Returns the session. With job, returns the status of the current job instead. With job and wait=1, the server waits up to 25 seconds for the job to finish, and returns as soon as it does. Repeat the request while status is running. At most two requests can wait on one job.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Path parameters
| Key | Value | Description |
|---|
id | string, required | Session ID from POST /api/ai/sessions. |
Query parameters
| Key | Value | Description |
|---|
job | string | Any value returns the job status instead of the session. |
wait | string | 1 waits for the job to finish. Requires job. One of 1. |
Responses
| Status | Code | Description |
|---|
200 | | The session, or the job status when the request has job. |
400 | ai_request_failed | The session ID is invalid, or the session ended. With job, the session has no job. |
401 | authentication_required | The request has no valid session cookie. |
403 | ai_disabled | The aiEnabled preference is false. |
500 | ai_unavailable | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Cache-Control | no-store | Responses are not cached. |
Response body
AI session. A temporary AI session. The server keeps it in memory only.
| Key | Value | Description |
|---|
id | string | Session ID. |
note_id | string | Note that the session edits. Pattern: ^[A-Za-z0-9_-]{1,64}$. |
configuration_id | string | Configuration that the session uses. |
scope | string | What the shared text contains. One of none, selection, note. |
draft | string | Shared text with the accepted changes. |
hunks | array of AI hunk | Suggested changes from the last request that suggested any. |
answer | string | Reply from the model to the last request. |
version | integer | Version. Each change to the session increases it. Send it with each action. |
can_undo | boolean | True when undo can revert an acceptance. |
changed | boolean | True when draft differs from the shared text. |
thinking_controllable | boolean | True when requests can set thinking. Fixed for the session. |
job | AI job | Latest job. Absent before the first job. |
AI job. Status of a background job.
| Key | Value | Description |
|---|
id | string | Job ID. |
snapshot_id | string | ID of the plan that the job runs. |
version | integer | Session version when the job finished, or when it started while it runs. |
status | string | Job state. Get the session when it is completed. One of running, completed, failed, cancelled. |
completed | integer | Provider requests that finished. |
total | integer | Provider requests planned so far. It can grow while the job runs. |
error | string | Reason for a failed job. |
Example request
curl 'http://localhost:8080/api/ai/sessions/0acde88882e62aaf5229b714b9054f8d' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
{
"configuration_id": "93e426f2feca1406629434a9891ce6d7",
"job": {
"id": "337342d5d47c347e02000d0d88483fc8",
"snapshot_id": "2cb14c0b6097a1389cd319e5ef17fe5c",
"version": 1,
"status": "completed",
"completed": 1,
"total": 1
},
"thinking_controllable": false,
"id": "0acde88882e62aaf5229b714b9054f8d",
"note_id": "trip-notes",
"scope": "note",
"draft": "# Trip notes\n\nPack teh charger.\n\nBook the train.\n",
"hunks": [
{
"id": "ba968b79a37b2d3a741cdc7ba71a3314",
"ref": "@1",
"start": 14,
"end": 31,
"before": "Pack teh charger.",
"after": "Pack the charger.",
"decision": ""
}
],
"answer": "Suggested changes are ready to review.",
"version": 1,
"can_undo": false,
"changed": false
}
Close an AI session
DELETE /api/ai/sessions/{id}
Cancels the running job and deletes the session. The server returns 204 when the session is already closed.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Path parameters
| Key | Value | Description |
|---|
id | string, required | Session ID from POST /api/ai/sessions. |
Responses
| Status | Code | Description |
|---|
204 | | Closed. The response has no body. |
400 | ai_request_failed | The session ID is invalid. |
401 | authentication_required | The request has no valid session cookie. |
403 | ai_disabled | The aiEnabled preference is false. |
500 | ai_unavailable | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Cache-Control | no-store | Responses are not cached. |
Example request
curl -X DELETE 'http://localhost:8080/api/ai/sessions/0acde88882e62aaf5229b714b9054f8d' \
-b cookies.txt -c cookies.txt
Example response
HTTP/1.1 204 No Content
Cache-Control: no-store
Run an AI session action
POST /api/ai/sessions/{id}/{action}
Runs one step of a session. Every action except cancel needs the current version, and each change to the session increases version. plan prepares a request and returns a plan. It does not generate a response. start runs a plan as a background job and returns 202. Starting the same plan again returns the same job. Poll GET /api/ai/sessions/{id}?job=1&wait=1 until the job finishes, then get the session. cancel stops the job and the pending plans, and keeps the session. review accepts or rejects suggested changes in the draft. It does not save the note. accept_all accepts every pending hunk. undo reverts the last acceptance and discards the pending hunks. finalize returns the draft when every hunk has a decision and the draft differs from the original. context replaces the shared text and scope. Resolve every pending hunk first. rebase replaces the shared text after another device edits the note. Hunks that the edit touches become outdated. configuration switches the session to another checked configuration. It does not change the default. turn runs a request synchronously and returns the session. It can take up to 10 minutes. Use plan and start instead. A session allows 20 requests. The body limit is 100 KiB, or about 6 MiB for context and rebase.
Request headers
| Key | Value | Description |
|---|
Cookie | string, required | The session cookie from POST /api/login. |
Content-Type | application/json, required | Media type of the body. |
Path parameters
| Key | Value | Description |
|---|
id | string, required | Session ID from POST /api/ai/sessions. |
action | string, required | Action to run. One of plan, start, cancel, review, context, rebase, configuration, turn. |
Request body
| Key | Value | Description |
|---|
version | integer | Current version of the session. Used by every action except cancel. |
prompt | string | Request to the model. At most 16 KiB. Used by plan and turn. |
thinking | boolean | Turn model thinking on. True fails when thinking_controllable is false. Used by plan and turn. Default: false. |
whole_context | boolean | Send the whole shared text in one request when it fits. Used by plan and turn. Default: false. |
plan_id | string | id from the plan response. Used by start. |
action | string | Review step. Used by review. One of accept, reject, accept_all, undo, finalize. |
hunk_id | string | id of the hunk. Used by review with accept or reject. |
scope | string | New sharing scope. Used by context. One of none, selection, note. |
text | string | New shared text. At most 1 MiB. Used by context and rebase. |
configuration_id | string | Checked configuration to use. Used by configuration. |
Responses
| Status | Code | Description |
|---|
200 | | plan: the plan. Other actions: the session. |
202 | | start only. The job is running. |
204 | | cancel only. The response has no body. |
400 | invalid_request | The body is not one JSON object, has an unknown field, or exceeds the size limit. |
400 | ai_request_failed | The session ended, version is not current, a request is already running, a field is invalid, or the provider failed. error names the problem. |
401 | authentication_required | The request has no valid session cookie. |
403 | ai_disabled | The aiEnabled preference is false. |
404 | | Not found. The action is not one of the listed values. The body is plain text. |
500 | ai_unavailable | The server could not complete the request. |
500 | ai_deadline_failed | The server could not complete the request. |
Response headers
| Key | Value | Description |
|---|
Content-Type | application/json | Media type of the body. |
Set-Cookie | string | The server renews the session cookie while you use it. Store the new value. |
Cache-Control | no-store | Responses are not cached. |
Cache-Control | no-store | Sent with status 202. Responses are not cached. |
Cache-Control | no-store | Sent with status 204. Responses are not cached. |
Response body
AI plan. A prepared request. A plan does not call the model.
| Key | Value | Description |
|---|
id | string | Plan ID. Send it as plan_id to start. |
version | integer | Session version that the plan is for. |
sections | integer | Parts of the shared text that the job handles separately. |
estimated_input_tokens | integer | Estimate of the input tokens. Not a tokenizer count. |
whole_context | boolean | True when the request asked for the whole shared text at once. |
AI session. A temporary AI session. The server keeps it in memory only.
| Key | Value | Description |
|---|
id | string | Session ID. |
note_id | string | Note that the session edits. Pattern: ^[A-Za-z0-9_-]{1,64}$. |
configuration_id | string | Configuration that the session uses. |
scope | string | What the shared text contains. One of none, selection, note. |
draft | string | Shared text with the accepted changes. |
hunks | array of AI hunk | Suggested changes from the last request that suggested any. |
answer | string | Reply from the model to the last request. |
version | integer | Version. Each change to the session increases it. Send it with each action. |
can_undo | boolean | True when undo can revert an acceptance. |
changed | boolean | True when draft differs from the shared text. |
thinking_controllable | boolean | True when requests can set thinking. Fixed for the session. |
job | AI job | Latest job. Absent before the first job. |
Example request
curl -X POST 'http://localhost:8080/api/ai/sessions/0acde88882e62aaf5229b714b9054f8d/plan' \
-b cookies.txt -c cookies.txt \
-H 'Content-Type: application/json' \
-d '{
"prompt": "Fix typos",
"version": 0
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-store
{
"whole_context": false,
"id": "2cb14c0b6097a1389cd319e5ef17fe5c",
"version": 0,
"sections": 1,
"estimated_input_tokens": 1544
}
Objects
Objects that appear in the request and response tables above.
AI configuration
A saved AI provider configuration.
| Key | Value | Description |
|---|
id | string | Configuration ID. |
name | string | Display name. |
url | string | API base URL. |
model | string | Model ID. |
has_key | boolean | True when an API key is saved. The API never returns the key. |
checked | boolean | True when a test or check succeeded with the current url, model, output_profile, and key. Sessions use only checked configurations. |
is_default | boolean | True for the configuration that new sessions use. At most one configuration is the default. |
revision | integer | Revision. Each update increases it by 1. |
output_profile | string | Empty: detect JSON Schema support. json_schema: always request JSON Schema output. One of "", json_schema. |
context_tokens | integer | Context window in tokens. 0 uses the provider value or 32768. |
concurrency | integer | Parallel requests for one job. 0 uses VYLK_AI_CONCURRENCY. |
AI hunk
One suggested change.
| Key | Value | Description |
|---|
id | string | Hunk ID. Send it as hunk_id. |
ref | string | Label for people, such as @1 or @2.1. A prompt can name it. The server never reuses a label in a session. |
start | integer | Start of before in the draft, in UTF-16 code units. 0 when decision is outdated. |
end | integer | End of before in the draft, in UTF-16 code units. 0 when decision is outdated. |
before | string | Current text. |
after | string | Suggested text. |
decision | string | Empty while pending. outdated: another edit changed the text, and the hunk cannot be accepted. Reject it to dismiss it. One of "", accepted, rejected, outdated. |
AI job
Status of a background job.
| Key | Value | Description |
|---|
id | string | Job ID. |
snapshot_id | string | ID of the plan that the job runs. |
version | integer | Session version when the job finished, or when it started while it runs. |
status | string | Job state. Get the session when it is completed. One of running, completed, failed, cancelled. |
completed | integer | Provider requests that finished. |
total | integer | Provider requests planned so far. It can grow while the job runs. |
error | string | Reason for a failed job. |
Acknowledgement
| Key | Value | Description |
|---|
client_sequence | integer | client_sequence of the operation. |
op_id | string | op_id of the operation. |
status | string | applied: the server applied the operation. conflict: the base revision is old, and nothing changed. compacted: the server applied the operation earlier and no longer keeps its result. One of applied, conflict, compacted. |
revision | integer | New revision. Present when the operation applied. |
current_revision | integer | Current revision. Present on a conflict. |
pin_order | integer | New pin position. note.pin only. |
Change
| Key | Value | Description |
|---|
sequence | integer | Position in the change feed. |
note_id | string | Changed note. Pattern: ^[A-Za-z0-9_-]{1,64}$. |
revision | integer | Revision after the change. |
deleted | boolean | True when the change deleted the note. |
changed_at | string (date-time) | Time of the change. |
Note with content
A note with its content.
Plaintext vault.
| Key | Value | Description |
|---|
id | string | Note ID. 1 to 64 letters, digits, hyphens, or underscores. |
title | string | Title. At most 512 bytes. |
filename | string | File name in the notes folder. Not an API path. |
tags | string | Comma-separated tags. The server trims them and removes duplicates. Tags are case-sensitive. At most 4096 bytes. |
pinned | boolean | True when the note is pinned. |
pin_order | integer | Position among pinned notes. Absent when 0. |
created_at | string (date-time) | Creation time. |
updated_at | string (date-time) | Time of the last change. |
revision | integer | Revision. Each change increases it by 1. |
content | string | Note text in Markdown. |
Encrypted vault.
| Key | Value | Description |
|---|
id | string | Note ID. 1 to 64 letters, digits, hyphens, or underscores. |
summary | Envelope | Encrypted title and tags. |
pinned | boolean | True when the note is pinned. |
pin_order | integer | Position among pinned notes. 0 when not pinned. |
created_at | string (date-time) | Creation time. |
updated_at | string (date-time) | Time of the last change. |
revision | integer | Revision. Each change increases it by 1. |
epoch | integer | Vault epoch that encrypted the note. |
body | Envelope | Encrypted note text. |
Device
| Key | Value | Description |
|---|
id | string | Device ID. 32 hexadecimal characters. |
name | string | Browser and platform, from the User-Agent at sign-in. |
last_seen_at | string (date-time) | Approximate time of the last request. |
current | boolean | True for the device that sent this request. |
Encrypted operation
A queued edit in an encrypted vault. The server rejects title, tags, content, and base_content.
| Key | Value | Description |
|---|
client_sequence | integer | Position in the queue. Starts at 1 and has no gaps. At least 1. |
op_id | string | Stable identifier of the operation. Reuse it on retry. Pattern: ^[A-Za-z0-9_-]{1,128}$. |
type | string | Operation type. note.save, note.delete, and note.pin change a note. prefs.save changes preferences. noop only uses a sequence number. One of note.save, note.delete, note.pin, prefs.save, noop. |
note_id | string | Target note. Required for note operations. Pattern: ^[A-Za-z0-9_-]{1,64}$. |
base_revision | integer | Revision that the edit is based on. Required for note operations. At least 1 for note.delete. |
summary | Envelope | Encrypted title and tags. note.save only. |
body | Envelope | Encrypted note text. note.save only. |
epoch | integer | Vault epoch that encrypted the envelopes. Required for note operations. At least 1. |
pinned | boolean | New pin state. note.pin only. |
prefs | Preferences | Preferences. Required for prefs.save. |
Envelope
AES-256-GCM ciphertext as a JSON object, not as a string. The client protocol defines the encryption.
| Key | Value | Description |
|---|
v | 1 | Format version. |
nonce | string | 12-byte nonce in unpadded base64url. |
ciphertext | string | Ciphertext followed by the 16-byte authentication tag, in unpadded base64url. |
Note summary
A note without its content.
Note. Note metadata in a plaintext vault.
| Key | Value | Description |
|---|
id | string | Note ID. 1 to 64 letters, digits, hyphens, or underscores. |
title | string | Title. At most 512 bytes. |
filename | string | File name in the notes folder. Not an API path. |
tags | string | Comma-separated tags. The server trims them and removes duplicates. Tags are case-sensitive. At most 4096 bytes. |
pinned | boolean | True when the note is pinned. |
pin_order | integer | Position among pinned notes. Absent when 0. |
created_at | string (date-time) | Creation time. |
updated_at | string (date-time) | Time of the last change. |
revision | integer | Revision. Each change increases it by 1. |
Encrypted note. Note metadata in an encrypted vault.
| Key | Value | Description |
|---|
id | string | Note ID. 1 to 64 letters, digits, hyphens, or underscores. |
summary | Envelope | Encrypted title and tags. |
pinned | boolean | True when the note is pinned. |
pin_order | integer | Position among pinned notes. 0 when not pinned. |
created_at | string (date-time) | Creation time. |
updated_at | string (date-time) | Time of the last change. |
revision | integer | Revision. Each change increases it by 1. |
epoch | integer | Vault epoch that encrypted the note. |
Operation
A queued edit in a plaintext vault. note.save needs the complete title, tags, and content. The server accepts base_content but does not use it to merge text.
| Key | Value | Description |
|---|
client_sequence | integer | Position in the queue. Starts at 1 and has no gaps. At least 1. |
op_id | string | Stable identifier of the operation. Reuse it on retry. Pattern: ^[A-Za-z0-9_-]{1,128}$. |
type | string | Operation type. note.save, note.delete, and note.pin change a note. prefs.save changes preferences. noop only uses a sequence number. One of note.save, note.delete, note.pin, prefs.save, noop. |
note_id | string | Target note. Required for note operations. Pattern: ^[A-Za-z0-9_-]{1,64}$. |
base_revision | integer | Revision that the edit is based on. Required for note operations. At least 1 for note.delete. |
title | string | Complete title. note.save only. |
tags | string | Complete tags. note.save only. |
content | string | Complete Markdown text. note.save only. |
base_content | string | Text that the edit is based on. Accepted and not used. |
pinned | boolean | New pin state. note.pin only. |
prefs | Preferences | Preferences. Required for prefs.save. |
Shortcut
| Key | Value | Description |
|---|
steps | array of Shortcut step | One or two key presses. |
Preferences
Preferences that every device shares. They are not encrypted. Defaults apply to a new account. In a prefs.save operation, send the changed fields in _sync_patch and their previous values in _sync_base. A field conflicts when another device changed it to a third value.
| Key | Value | Description |
|---|
aiEnabled | boolean | Turn on AI. When false, every /api/ai/ route returns 403, and the server ends every AI session. Default: false. |
revision | integer | Revision. Each save increases it by 1. |
autoSave | boolean | Sync changes automatically. Changes are always saved on the device. Default: true. |
reduceMotion | string | system follows the operating system. always turns off animations. never keeps them on. One of system, always, never. Default: system. |
startView | string | View of a newly opened note. One of editor, preview, split, zen. Default: editor. |
hideToolbar | boolean | Hide the formatting toolbar above the editor. Default: false. |
hideSaveButton | boolean | Hide the manual Save button. Default: true. |
saveButtonLocation | string | panel puts the Save button in the editor toolbar. header puts it in the app header. One of "", panel, header. Default: panel. |
collapseDetails | boolean | Collapse the title and tags fields when a note opens. |
hideCursorHighlight | boolean | Turn off the preview highlight of the block at the cursor. |
interactivePreview | boolean | Allow toggling tasks and moving blocks in Split and Preview views. Default: true. |
statusDisplay | string | Sync status display. The web app uses normal, compact, or off. |
contentWidth | string | Width of the text column. One of "", compact, standard, wide, full. |
zenPageWidth | string | Width of the page in Zen mode. One of "", compact, standard, wide, full. |
theme | string | Built-in theme name, or a palette string that the client defines. The server does not interpret it. |
accentColor | string | Custom accent color. Empty means the theme color. |
fontFamily | string | Interface font. |
fontFamilyGoogle | boolean | Load fontFamily from Google Fonts. |
fontSize | string | Interface font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. |
editorFontFamily | string | Editor font. |
editorFontFamilyGoogle | boolean | Load editorFontFamily from Google Fonts. |
editorFontSize | string | Editor font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. |
previewFontFamily | string | Preview font. |
previewFontFamilyGoogle | boolean | Load previewFontFamily from Google Fonts. |
previewFontSize | string | Preview font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. |
zenFontFamily | string | Zen mode font. Default: Inter. |
zenFontFamilyGoogle | boolean | Load zenFontFamily from Google Fonts. Default: true. |
zenFontSize | string | Zen mode font size. One of "", 0.8rem, 0.9rem, 1rem, 1.1rem, 1.25rem, 1.5rem. Default: 1.25rem. |
zenWordCount | boolean | Show the word count in Zen mode. Default: true. |
zenShowTitle | boolean | Show the title in Zen mode. Default: true. |
zenShowControls | boolean | Show the controls in Zen mode. Default: true. |
zenInteractivePreview | boolean | Stored for clients. The vylk web app does not use it. |
shortcutPrefix | Shortcut | Key press that starts a shortcut. Exactly one step. The default is Mod+E. |
keyboardShortcuts | object | Custom shortcuts by action name, at most 64. null turns off the default shortcut for that action. Each value is Shortcut or null. |
shortcutConfirmationSkips | object | Actions that run without a confirmation, at most 64. Each value is true. |
_sync_patch | object | Changed fields. prefs.save operations only. |
_sync_base | object | Previous values of the changed fields. prefs.save operations only. |
Shortcut step
One key press. The first step uses ["Mod"] or ["Mod", "Shift"]. A second step uses no modifiers.
| Key | Value | Description |
|---|
key | string | One letter, digit, /, or ;. Pattern: ^[A-Za-z0-9/;]$. |
modifiers | array of string | Mod is Ctrl on Windows and Linux and Command on macOS. |