run · read

list

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

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

object storagefreeprefix, not folders
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

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

There are no folders, only prefixes

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

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);
}
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)

What you can answer without downloading anything

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];
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)

For the whole storage rather than a prefix, usage answers in one call.