# Notes and files commands

Read, search, save and download notes and files in your Spaces.

Web version: https://www.svanja.com/docs/cli/notes-and-files/

`svanja notes` and `svanja files` let you work with what's inside a Space in [Spaces](https://app.svanja.com/spaces). `svanja notes` handles your Markdown notes, and `svanja files` handles every other file. Both commands can read files, search them, and show a file's history. You can use them to look up what you keep about a client or to save a note from a script.

To read, your key needs the Spaces and files area, which Full access and Read-only keys include. To save, you need Full access or Spaces and files set to **Read and write**. See [Spaces, notes and files](https://www.svanja.com/docs/spaces/) for more.

Saving is guarded so you don't overwrite a change someone made in the meantime. When you update a file, pass the revision you read with `--expected-revision`. To create a new file, pass `--create` instead:

```bash
svanja notes read SPACE_ID notes/status.md --json
svanja notes save SPACE_ID notes/status.md --expected-revision REVISION --field content="Export fixed, waiting for the client's OK."
svanja notes save SPACE_ID notes/call-2026-11-25.md --create --field content="# Call notes"
```

## Commands

### svanja files download

Download source content.

This command calls GET /spaces/{space}/files/download on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

--output is required and must name a new file. Existing files and symlinks are never replaced. Binary bytes never go to the terminal. --sha256 is required and is verified before publishing the file. JSON output is a stable receipt with path, byte count, sha256 and verification status.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja files download <space-id> <path> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--max-bytes` | maximum download size in bytes (up to 1 GiB) |
| `--output` | new destination file (required; never overwritten) |
| `--query` | query parameter as key=value (repeatable) |
| `--sha256` | required expected SHA-256 hash; verified before the file is published |

```bash
svanja files download <space-id> <path> --output ./download.bin --sha256 <sha256> --json
svanja files download <space-id> <path> --output ./download.bin --sha256 <sha256>
svanja files download <space-id> <path> --output ./download.bin --sha256 <sha256> --jq .sha256
svanja files download <space-id> <path> --output ./download.bin --sha256 <sha256> --template '{{.path}}'
svanja files download <space-id> <path> --output ./download.bin --sha256 <sha256> --json --include-meta
```

### svanja files history

Show source history.

This command calls GET /spaces/{space}/files/history on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja files history <space-id> <path> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja files history <space-id> <path> --json
svanja files history <space-id> <path> --plain
svanja files history <space-id> <path> --jq .
svanja files history <space-id> <path> --template '{{.}}'
svanja files history <space-id> <path> --json --include-meta
```

### svanja files list

List source entries.

This command calls GET /spaces/{space}/files on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja files list <space-id> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja files list <space-id> --json
svanja files list <space-id> --plain
svanja files list <space-id> --jq .
svanja files list <space-id> --template '{{.}}'
svanja files list <space-id> --json --include-meta
```

### svanja files read

Read source content.

This command calls GET /spaces/{space}/files/content on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja files read <space-id> <path> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja files read <space-id> <path> --json
svanja files read <space-id> <path> --plain
svanja files read <space-id> <path> --jq .
svanja files read <space-id> <path> --template '{{.}}'
svanja files read <space-id> <path> --json --include-meta
```

### svanja files save

Save source content with a revision guard.

This command calls PUT /spaces/{space}/files/content on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Build the request body with --field key=value, --body '<json>' or --body-file <path>; field flags cannot be combined with body input. Every real mutation sends an idempotency key so a retried request is not applied twice. Pass --idempotency-key <key> to supply your own. Use --dry-run to preview the method, path, query, body fields and idempotency behavior without resolving credentials or contacting the API.

--expected-revision is required for source writes so noninteractive saves never silently overwrite a newer revision.

Use --create instead of --expected-revision to assert that the source must not already exist.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja files save <space-id> <path> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--body` | JSON request body (mutually exclusive with --field and --body-file) |
| `--body-file` | read the JSON request body from a file, or - for stdin |
| `--create` | assert the source does not exist and send expected_revision:null |
| `--dry-run` | preview the request without resolving credentials or contacting the API |
| `--expected-revision` | required source revision guard for conflict-safe writes |
| `--field` | body field as key=value (repeatable; mutually exclusive with --body and --body-file) |
| `--idempotency-key` | explicit idempotency key (1-255 visible ASCII bytes); generated when omitted |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja files save <space-id> notes/status.md --expected-revision <revision> --field content="Export fixed, waiting for Anna's OK."
svanja files save <space-id> notes/call-2026-11-25.md --create --field content="# Call with Anna"
```

### svanja files search

Search source entries.

This command calls GET /spaces/{space}/files/search on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja files search <space-id> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja files search <space-id> --json
svanja files search <space-id> --plain
svanja files search <space-id> --jq .
svanja files search <space-id> --template '{{.}}'
svanja files search <space-id> --json --include-meta
```

### svanja files

Manage files in Spaces.

Use this family to call native Svanja public API operations with the active team API key. The server owns validation, access checks, authorization, receipts and domain-specific behavior; the CLI supplies product identity, explicit arguments, stable output modes and safe local request handling.

```text
svanja files [flags]
```

Works without a key.

```bash
svanja files --help
```

### svanja notes download

Download source content.

This command calls GET /spaces/{space}/files/download on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

--output is required and must name a new file. Existing files and symlinks are never replaced. Binary bytes never go to the terminal. --sha256 is required and is verified before publishing the file. JSON output is a stable receipt with path, byte count, sha256 and verification status.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja notes download <space-id> <path> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--max-bytes` | maximum download size in bytes (up to 1 GiB) |
| `--output` | new destination file (required; never overwritten) |
| `--query` | query parameter as key=value (repeatable) |
| `--sha256` | required expected SHA-256 hash; verified before the file is published |

```bash
svanja notes download <space-id> <path> --output ./download.bin --sha256 <sha256> --json
svanja notes download <space-id> <path> --output ./download.bin --sha256 <sha256>
svanja notes download <space-id> <path> --output ./download.bin --sha256 <sha256> --jq .sha256
svanja notes download <space-id> <path> --output ./download.bin --sha256 <sha256> --template '{{.path}}'
svanja notes download <space-id> <path> --output ./download.bin --sha256 <sha256> --json --include-meta
```

### svanja notes history

Show source history.

This command calls GET /spaces/{space}/files/history on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja notes history <space-id> <path> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja notes history <space-id> <path> --json
svanja notes history <space-id> <path> --plain
svanja notes history <space-id> <path> --jq .
svanja notes history <space-id> <path> --template '{{.}}'
svanja notes history <space-id> <path> --json --include-meta
```

### svanja notes list

List source entries.

This command calls GET /spaces/{space}/files on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja notes list <space-id> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja notes list <space-id> --json
svanja notes list <space-id> --plain
svanja notes list <space-id> --jq .
svanja notes list <space-id> --template '{{.}}'
svanja notes list <space-id> --json --include-meta
```

### svanja notes read

Read source content.

This command calls GET /spaces/{space}/files/content on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja notes read <space-id> <path> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja notes read <space-id> <path> --json
svanja notes read <space-id> <path> --plain
svanja notes read <space-id> <path> --jq .
svanja notes read <space-id> <path> --template '{{.}}'
svanja notes read <space-id> <path> --json --include-meta
```

### svanja notes save

Save source content with a revision guard.

This command calls PUT /spaces/{space}/files/content on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Build the request body with --field key=value, --body '<json>' or --body-file <path>; field flags cannot be combined with body input. Every real mutation sends an idempotency key so a retried request is not applied twice. Pass --idempotency-key <key> to supply your own. Use --dry-run to preview the method, path, query, body fields and idempotency behavior without resolving credentials or contacting the API.

--expected-revision is required for source writes so noninteractive saves never silently overwrite a newer revision.

Use --create instead of --expected-revision to assert that the source must not already exist.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja notes save <space-id> <path> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--body` | JSON request body (mutually exclusive with --field and --body-file) |
| `--body-file` | read the JSON request body from a file, or - for stdin |
| `--create` | assert the source does not exist and send expected_revision:null |
| `--dry-run` | preview the request without resolving credentials or contacting the API |
| `--expected-revision` | required source revision guard for conflict-safe writes |
| `--field` | body field as key=value (repeatable; mutually exclusive with --body and --body-file) |
| `--idempotency-key` | explicit idempotency key (1-255 visible ASCII bytes); generated when omitted |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja notes save <space-id> notes/status.md --expected-revision <revision> --field content="Export fixed, waiting for Anna's OK."
svanja notes save <space-id> notes/call-2026-11-25.md --create --field content="# Call with Anna"
```

### svanja notes search

Search source entries.

This command calls GET /spaces/{space}/files/search on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja notes search <space-id> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja notes search <space-id> --json
svanja notes search <space-id> --plain
svanja notes search <space-id> --jq .
svanja notes search <space-id> --template '{{.}}'
svanja notes search <space-id> --json --include-meta
```

### svanja notes

Manage note source in Spaces.

Use this family to call native Svanja public API operations with the active team API key. The server owns validation, access checks, authorization, receipts and domain-specific behavior; the CLI supplies product identity, explicit arguments, stable output modes and safe local request handling.

```text
svanja notes [flags]
```

Works without a key.

```bash
svanja notes --help
```
