Skip to content
Svanja

Docs API reference

Files and notes

Read, search, save and download the notes and files in a Space.

Every Space in Spaces holds your notes and files, and these endpoints let you work with them. A note is a Markdown text file. You can read what you keep about a client, search through it, or save a note from your own tool.

To read files, your key needs the Spaces and files area, which Full access and Read-only both include. To save changes, it needs Full access or Spaces and files set to Read and write. If a key is limited to certain Spaces, it can only reach the files inside them. For more on how Spaces work, see Spaces, notes and files.

Everything inside a Space lives under /spaces/{space}/files. From there, you can list and search files, read a file along with its revision, view its history, or download it.

Use PUT /spaces/{space}/files/content to save a note or any other text file. Send path, content, and expected_revision (the revision you got when you read the file). If someone else changed the file in the meantime, the save fails with conflict so you don’t overwrite their work. When creating a new file, set expected_revision to null.

{
  "path": "notes/status.md",
  "content": "Export fixed, waiting for the client's OK.",
  "expected_revision": "REVISION_FROM_THE_READ"
}

Saved changes show up in the Space’s history like any other edit, with the key’s owner listed as the author. If you prefer working from a terminal, see svanja notes and svanja files.

Operations

An operation is one thing you can do, like reading a task or starting one. Its effect says what it changes. Some operations that act outside Svanja or change access wait for a person's approval; the approval flow is on the API overview.

file.download Reads only

Download a Space file.

GET /spaces/{space}/files/download

file.read Reads only

Read Space files and history.

GET /spaces/{space}/files GET /spaces/{space}/files/content GET /spaces/{space}/files/history GET /spaces/{space}/files/search

file.save Changes data in Svanja

Save a Space file revision.

PUT /spaces/{space}/files/content

Endpoints

Paths start at https://app.svanja.com/api/v1. Every endpoint needs an API key unless it says otherwise. A required Idempotency-Key header is listed with the parameters.

GET /spaces/{space}/files List Space files

Lists current source entries and knowledge pins inside an accessible Space.

Parameter In Type Required Notes
space path string yes Space public ULID or slug.

Status codes: 200, 401, 403, 404, 429

GET /spaces/{space}/files/content Read a Space file

Reads the current content of one source file after current access checks.

Parameter In Type Required Notes
space path string yes Space public ULID or slug.
path query string yes

Status codes: 200, 401, 403, 404, 422, 429

PUT /spaces/{space}/files/content Save a Space file

Saves source content with optional revision conflict detection.

Parameter In Type Required Notes
space path string yes Space public ULID or slug.
Idempotency-Key header string no Optional key for unsafe bearer writes. Reusing the same key and same canonical body replays the original response for 24 hours; reusing it with a different body returns idempotency_conflict.
Body field Type Required Notes
path string yes
content string yes
expected_revision string or null no

Status codes: 200, 400, 401, 403, 404, 409, 422, 429

GET /spaces/{space}/files/history Read Space file history
Parameter In Type Required Notes
space path string yes Space public ULID or slug.
path query string no
commit query string no
limit query integer no

Status codes: 200, 401, 403, 404, 422, 429

GET /spaces/{space}/files/download Download a Space file

Streams a bearer-authorized source or binary object after current access checks.

Parameter In Type Required Notes
space path string yes Space public ULID or slug.
path query string yes
commit query string no
object_id query string no

Status codes: 200, 401, 403, 404, 429

This page as plain Markdown, for AI tools: files.md

Try Svanja with your own mailbox

Sign up now, and you get an email when your account is ready.