# list

Canonical URL: https://developers.iagenify.com/sdk/ref/connected-storage/run/list/
Language: en

`storage.run({ action: "list", prefix, limit })`

The keys in an object storage, optionally under a prefix. Keys and sizes — not the bytes.

Status: object storage · free · prefix, not folders

```javascript
await storage.run({ action: "list" });
await storage.run({ action: "list", prefix: "invoices/2026/", limit: 200 });
// { objects: [{ key, size, … }], folders: ["invoices/2026/01/", …] }
```

## There are no folders, only prefixes {#prefix}

An object storage holds keys. `invoices/2026/01/a.pdf` is one key, not three levels — the slashes are characters. What comes back as `folders` is the common prefixes, computed for you, which is what makes a tree view possible.

> **A prefix is a string match, so make it end the way you mean**
>
> invoices matches invoices-old/ too. Ending it with a slash is what limits it to what you think of as that folder.

## Walking a tree {#walk}

```javascript
async function walk(storage, prefix = "") {
  const page = await storage.run({ action: "list", prefix });
  for (const object of page.objects || []) yield* [object];
  for (const folder of page.folders || []) yield* walk(storage, folder);
}
```

## What you can answer without downloading anything {#sizes}

```javascript
const page = await storage.run({ action: "list", prefix: "invoices/" });

const bytes = (page.objects || []).reduce((sum, o) => sum + (o.size || 0), 0);
const biggest = [...(page.objects || [])].sort((a, b) => b.size - a.size)[0];
```

For the whole storage rather than a prefix, [usage](/sdk/ref/connected-storage/run/usage) answers in one call.

- [object](/sdk/ref/connected-storage/run/object): Lire un objet.
- [upload](/sdk/ref/connected-storage/run-write/upload): En déposer un.
- [run()](/sdk/ref/connected-storage/run): Toutes les actions, les garde-fous et ce que chacune coûte.

```python
storage.run(action="list")
storage.run(action="list", prefix="invoices/2026/", limit=200)
# {"objects": [{"key", "size", …}], "folders": ["invoices/2026/01/", …]}
```

```python
def walk(storage, prefix=""):
    page = storage.run(action="list", prefix=prefix)
    yield from page.get("objects") or []
    for folder in page.get("folders") or []:
        yield from walk(storage, folder)
```

```python
page = storage.run(action="list", prefix="invoices/")

objects = page.get("objects") or []
total_bytes = sum(o.get("size") or 0 for o in objects)
biggest = max(objects, key=lambda o: o.get("size") or 0, default=None)
```
