---
title: "getEntry"
description: "Read one entry by slug."
canonical: "https://www.qino.works/docs/api/collection/get-entry"
---

# getEntry

> Read one entry by slug.

Reads a single file by slug, validates it, and applies the selected view.

```ts title="src/app/posts/[slug]/page.tsx"
const post = await postCollection.getEntry("hello-world");
const detail = await postCollection.getEntry("hello-world", { view: "detail" });
```

## Signature

```ts title="@qino/cms"
collection.getEntry(slug: Slug, options?: { view?: ViewName }): Promise<Entry>;
```

## Parameters

| Name           | Type      | Required | Default     | Description                                                      |
| -------------- | --------- | -------- | ----------- | ---------------------------------------------------------------- |
| `slug`         | `string`  | yes      |             | Filename without the extension. Autocompletes after `qino build` |
| `options.view` | view name | no       | `"default"` | A view declared in `views`                                       |

## Returns

`Promise<Entry>`, shaped like one element of [getEntries](https://www.qino.works/docs/api/collection/get-entries).

## Filter interaction

If the selected view has a `filter` and it rejects this entry, `getEntry` throws rather than returning it. Select a view without a filter, such as `view({})`, to read every entry.

## Throws

- `Entry "<slug>" in collection "<directory>" is excluded by view "<view>".`
- A raw `ENOENT` error from Node when the file does not exist.
- `Unknown view "<name>". Available views: <names>.`
- Validation, relation, and augment errors. See [Errors](https://www.qino.works/docs/api/errors).

## See also

- [getAllSlugs](https://www.qino.works/docs/api/collection/get-all-slugs)
