---
title: "content.list()"
description: "Fetches lightweight document entries from the handler's list route."
canonical_url: "https://content.comark.dev/reference/client/list"
---
# content.list()

> Fetches lightweight document entries from the handler's list route.

## `content.list(names?)`

Fetches lightweight document entries from the handler's `list` route.

**Parameters:**

- `names?`: instance names to restrict the listing to. Defaults to the client's [name](https://content.comark.dev/reference/client/create-content-client#name) when it is bound to one, else every instance the endpoint serves. Only meaningful against a [hub](https://content.comark.dev/advanced/hub) endpoint; a single instance accepts its own name and ignores others.

**Returns:** `Promise<`[`ContentListFile`](https://content.comark.dev/reference/types/content#contentlistfiletdata)`<Data>[]>`

```ts [usage.ts]
const all = await content.list() // everything the endpoint serves
const blog = await content.list('blog') // one instance of a hub endpoint
```

A client bound to an instance filters by default, so `list()` is already scoped:

```ts [named.ts]
const blog = createContentClient('blog')
await blog.list() // the blog instance only
```

Like its [server counterpart](https://content.comark.dev/reference/content/list), the client `list()` is typed against the generated registry. Bind the client with [a name](https://content.comark.dev/reference/client/create-content-client#name) and a bare `list()` narrows to that instance. Against a hub endpoint, naming instances narrows the same way:

```ts [typed.ts]
const blog = await content.list('blog')
// blog[n].data: BlogData

const some = await content.list(['blog', 'docs'])
// some[n].data: BlogData | DocsData
```

Run [type generation](https://content.comark.dev/guide/typescript) to populate the registry. Without it, `data` stays an open record, and you can always pass an explicit type argument (`content.list<PostData>('blog')`).


## Sitemap

See the full [sitemap](https://content.comark.dev/sitemap.md) for all pages.
