# listDocuments()

Canonical URL: https://developers.iagenify.com/sdk/ref/tools/list-documents/
Language: en

`api.tools.listDocuments() → Promise<Source[]>`

Every file kept on the account. No arguments, no credit — and the shortcut for api.files.list().

Status: GET /api/files · free · no arguments

It is the same call as [api.files.list()](/sdk/ref/files/list), present on `api.tools` so that « list what I have » can be handed to a model as a tool.

## Returns {#returns}

```javascript
[
  {
    id: "…",                       // the sourceId, to pass to readDocument()
    name: "report.md",
    category: "document",          // document | image | audio | video
    mimeType: "text/markdown",
    size: 9118,
    storageId: "…",                // where it lives, or null
    status: "ready",
    createdAt: "2026-10-05T18:02:11.000Z"
  }
]
```

> **Nothing of the server's layout is in there**
>
> A file is identified by its id, never by a path on a disk. That is what keeps an id usable from anywhere — your script, a page, a run — without anything knowing where the bytes sit.

## What it lists, and what it does not {#scope}

| Lists | Does not list |
| --- | --- |
| Files saved through `api.files` | Files on a computer — those are [files.list()](/sdk/ref/local-files/list) |
| Attachments stored for the account | Objects in a bucket — those are `run({ action: "list" })` |
| Media generated and saved | Anything in a phone's browser |

## As a tool {#as-a-tool}

It is one of the few declarations that take no argument, and the run makes more of it than a bare list: it answers with the account's files **and** the files of the caller's computer, each group named, so the model knows which identifier to use next — an id for one, a path for the other.

```javascript
tools: {
  list_documents: api.tools.listDocuments,
  read_document: api.tools.readDocument,
}

// What the model is told, in a run:
// { computer: { storage: "MacBook", files: [{ path, mimeType, size }] },
//   server:   [{ sourceId, name, mimeType }] }
```

## Errors {#errors}

A failure raises the message the server gave. There is no empty-result error: an account with no file answers with an empty array.

- [readDocument()](/sdk/ref/tools/read-document): Read one of them back.
- [api.files](/sdk/ref/files): The full file resource.
- [api.tools](/sdk/ref/tools): The fifteen, and the two ways to use them.

```python
documents = api.tools.list_documents()
# {
#   "computer": [{"name", "path", "type", "size"}],          # ~/.iagenify/files
#   "account":  [{"id": "…",                                  # the sourceId, for read_document()
#                 "name": "report.md", "category": "document",
#                 "mimeType": "text/markdown", "size": 9118,
#                 "storageId": "…", "status": "ready",
#                 "createdAt": "2026-10-05T18:02:11.000Z"}]
# }
```

```python
tools = {
    "list_documents": api.tools.list_documents,
    "read_document": api.tools.read_document,
}

# What the model is told, in a run:
# {"computer": {"storage": "MacBook", "files": [{"path", "mimeType", "size"}]},
#  "server":   [{"sourceId", "name", "mimeType"}]}
```
