In this guide

Query a Database

Get rows from a database, filtered and sorted.

Action referenceRead

What this action does #

First, connect Notion in Services. Then open Actions → + → Notion and choose Query a Database.

To find this direct request action, choose Every Notion endpoint in the integration’s picker. The setup guide also explains the dedicated forms for common tasks.

More about this action

The read counterpart to Create a Page. Filter and Sorts take Notion's own query shapes, which reference the person's column names.

A query returns at most 10,000 rows however many pages are fetched.

Inputs to fill in #

Open an input to choose its value. Keep a fixed value with Text, receive it from Shortcuts, ask when the action runs, or use an Earlier Step. Read how input sources work.

Database

RequiredText

Data source ID of the database to read.

Example value (replace with your own):
248104cd-477e-80a9-8a1b-e4f8b0f8c1d2

Filter

OptionalStructured data (JSON)

A Notion filter object. Omit to return every row.

Example value (replace with your own):
{"property":"Done","checkbox":{"equals":false}}

Sorts

OptionalStructured data (JSON)

A list of sort objects, applied in order.

Example value (replace with your own):
[{"timestamp":"created_time","direction":"descending"}]

Page Size

OptionalWhole number

1–100.

Example value (replace with your own):
100

Start Cursor

OptionalText

Bind this to a slot to page from a Repeat loop instead.

What comes back #

In the action editor, open Output → Returned Value to choose fields for your shortcut. These are the response fields described by the app; a service may omit an optional field or return an empty list. JSON File contains the full response.

Returned fieldTypeMeaning
has_morebooleanWhether another page exists.
resultsarrayA list of values.
results[].idstringText value.
results[].urlstringText value.
results[].created_timestringText value.
results[].last_edited_timestringText value.
results[].propertiesobjectKeyed by your own column names.

Run it from Shortcuts #

  1. Give the action a recognizable name and tap Save.
  2. In Apple Shortcuts, add Shortcutify’s Execute Action and select the saved action.
  3. Supply any Param or File slots you bound in the inputs, then run the shortcut.

If the result is unexpected, open Logs in Shortcutify, select the run, and inspect this step’s inputs and response.

This action supports multiple pages of results. Open its Fetch setting to retrieve more pages when one page is not enough. Each page adds a service request.

Advanced reference #

Request, permissions, and identifiers

Request: POST https://api.notion.com/v1/data_sources/{data_source_id}/query

Action identifier: notion.datasource.query.v1

No additional per-action permissions are declared in the app’s catalog. The integration’s connection and account access rules still apply.

InputRequest keyLocation
Databasedata_source_idpath
Filterfilterbody
Sortssortsbody
Page Sizepage_sizebody
Start Cursorstart_cursorbody

Notion API reference