Notion API: Notion API, how to retrieve the entries in a database

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


Here’s how to list all entries in a Notion database using the official Notion API.

First, you need to have a reference to the Notion instance:

import { Client } from '@notionhq/client'

//...

const notion = new Client({ auth: process.env.NOTION_API_KEY })

Then you can call notion.database.query() to retrieve the entries.

This retrieves all entries:

const postsReady = await notion.databases.query({
  database_id: process.env.NOTION_DB_ID,
})

This retrieves all entries with the checkbox property named “Ready” checked:

const postsReady = await notion.databases.query({
  database_id: process.env.NOTION_DB_ID,
  filter: {
    and: [
      {
        property: 'Ready',
        checkbox: {
          equals: true,
        },
      },
    ],
  },
})

You can do a lot more.

You can add more filtering rules, combining them with or or and logic.

You can sort them by a specific property, ascending or descending.

It’s pretty cool.

See the official docs of notion.databases.query(): https://developers.notion.com/reference/post-database-query

Lessons in this unit:

0: Introduction
1: ▶︎ Notion API, how to retrieve the entries in a database
2: Notion API, select all pages with a specific emoji
3: Notion API, update a checkbox value in a database
4: Notion API, update the icon emoji of a page