> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anonalabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# documents

> Upload files into a space and manage them from the anona CLI.

pip 0.25.0; npm 0.19.0

Upload files to be read into memories, then list, show or delete them. Every
command addresses one space: `--space`, or `ANONA_SPACE_ID`.

## documents upload

```bash theme={null}
anona documents upload report.pdf notes.md --space notes
anona documents upload handbook.pdf --tags hr,policy --user-id alice --space support --wait
anona documents upload docs/*.md --space notes --json
```

| Flag | |
| - | - |
| `PATH...` | The files to upload, at most 20 per call |
| `--tags a,b` | Tags applied to every uploaded file |
| `--strategy NAME` | A named ingestion strategy (default: the space's) |
| `--user-id`, `--agent-id`, `--session-id` | The scope to upload under |
| `--wait` | Poll the jobs until they finish; the exit code reports the outcome |
| `--wait-timeout SECONDS` | With `--wait`: give up after this long and exit `8` (default 300) |

Ingestion is always asynchronous. Without `--wait` the command prints the job
ids and exits `0` as soon as the server has accepted the files; check them with
[`anona jobs get`](https://docs.anonalabs.com/cli/jobs). With `--wait` it polls until every job finishes:
`0` all completed, `1` one failed or was cancelled, `8` still running when the
wait ran out. An upload does not report "nothing stored" (exit `3`): its job
carries no item count to judge that by.

A path that is not a readable file exits `2` before anything is sent. The
server's limits are 20 files, 25 MB per file (64 MB for video), and 50 MB per
request (100 MB with video); past them, or for a type it cannot read, the
command exits `1` with the server's code (`unsupported_file_type`,
`file_too_large`, `upload_too_large`, `file_type_mismatch`,
`file_expands_too_much`) and a message naming the limit. Uploading to a space
that does not exist creates it.

> [!WARNING]
>
> If the space uses scoping, upload with the same `--user-id` you retrieve with.
> Scoped search is strict, so a file uploaded without a scope is invisible to
> every scoped `retrieve`, silently: the job still completes.

**`--json`:** `{"job_ids": [...]}`. With `--wait`:
`{"submitted": {"job_ids": [...]}, "jobs": [<one jobs get document per job>]}`.

## documents list

```bash theme={null}
anona documents list --space notes --source file
```

A space's documents, newest first.

| Flag | |
| - | - |
| `--limit N` | At most this many, 1-500 (default 100) |
| `--offset N` | Skip this many first |
| `--source KIND` | `file` (uploaded), `custom` (a `document_id` you set on a write) or `memory` (implicit) |

**`--json`:** `{"documents": [{"document_id", "source", "created_at", "memory_count", "tags"}], "total", "limit", "offset"}`.

## documents get

```bash theme={null}
anona documents get DOCUMENT_ID --space notes
```

**`--json`:** the document's metadata object, as the API returns it.

## documents delete

```bash theme={null}
anona documents delete DOCUMENT_ID --yes --space notes
```

Deletes a document **and the memories extracted from it**. Without `--yes` it
exits `2` and sends nothing.

**`--json`:** `{"deleted": true, "document_id", "space_id"}`, written by the
CLI (the API answers with no body).

## Related

* API: [Documents](https://docs.anonalabs.com/api-reference/documents.md).
* [Chat with your documents](https://docs.anonalabs.com/use-cases/chat-with-your-documents.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.