# Fetch functions

> fetchBlocks and fetchPage, from notionic/fetch.

```typescript
import { fetchBlocks, fetchPage } from "notionic/fetch"
```

## fetchBlocks(client, blockId, options?)

Returns `Promise<NotionBlock[]>`: every block under `blockId`, with nested blocks as `children`, linked pages and subpages as `linkedPage`, and previews of the pages behind bookmarks, embeds and link previews as `bookmarkPreview`.

## fetchPage(client, pageId, options?)

Returns `Promise<{ page: NotionPage; blocks: NotionBlock[] }>`. `page` has `id`, `url`, `title`, `icon`, `cover`, `lastEditedTime` and `properties`.

## Options

| Option | Default | Description |
| --- | --- | --- |
| `maxDepth` | `5` | Levels of nested blocks to fetch below the top level. |
| `concurrency` | `3` | Requests in flight at once per level. |
| `bookmarkPreviews` | `true` | Fetch the page behind each bookmark, embed and link preview for its title, description, image and favicon, so they render as cards. `false` makes no requests outside Notion. |

## The client

`client` is a `Client` from `@notionhq/client`, or anything with the same `blocks.children.list` and `pages.retrieve` methods. Without `pages.retrieve`, `fetchBlocks` still works, but `link to page` blocks get no titles and subpages no icons.
