Join us for our Developer Platform Hackathon, May 16-17. Apply now →
import { Client } from "@notionhq/client"
const notion = new Client({ auth: process.env.NOTION_API_KEY })
const response = await notion.dataSources.query({
data_source_id: "d9824bdc-8445-4327-be8b-5b47500af6ce",
filter: {
property: "Status",
select: { equals: "Done" }
},
sorts: [
{
property: "Created",
direction: "descending"
}
]
}){
"type": "<string>",
"page_or_data_source": {},
"object": "<string>",
"next_cursor": "<string>",
"has_more": true,
"results": [
{
"object": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_time": "2023-11-07T05:31:56Z",
"last_edited_time": "2023-11-07T05:31:56Z",
"in_trash": true,
"is_archived": true,
"is_locked": true,
"url": "<string>",
"public_url": "<string>",
"parent": {
"type": "<string>",
"database_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"properties": {},
"icon": {
"type": "<string>",
"emoji": "<string>"
},
"cover": {
"type": "<string>",
"file": {
"url": "<string>",
"expiry_time": "2023-11-07T05:31:56Z"
}
},
"created_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"object": "<string>"
},
"last_edited_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"object": "<string>"
}
}
],
"request_status": {
"type": "complete",
"incomplete_reason": "query_result_limit_reached"
}
}import { Client } from "@notionhq/client"
const notion = new Client({ auth: process.env.NOTION_API_KEY })
const response = await notion.dataSources.query({
data_source_id: "d9824bdc-8445-4327-be8b-5b47500af6ce",
filter: {
property: "Status",
select: { equals: "Done" }
},
sorts: [
{
property: "Created",
direction: "descending"
}
]
}){
"type": "<string>",
"page_or_data_source": {},
"object": "<string>",
"next_cursor": "<string>",
"has_more": true,
"results": [
{
"object": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_time": "2023-11-07T05:31:56Z",
"last_edited_time": "2023-11-07T05:31:56Z",
"in_trash": true,
"is_archived": true,
"is_locked": true,
"url": "<string>",
"public_url": "<string>",
"parent": {
"type": "<string>",
"database_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"properties": {},
"icon": {
"type": "<string>",
"emoji": "<string>"
},
"cover": {
"type": "<string>",
"file": {
"url": "<string>",
"expiry_time": "2023-11-07T05:31:56Z"
}
},
"created_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"object": "<string>"
},
"last_edited_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"object": "<string>"
}
}
],
"request_status": {
"type": "complete",
"incomplete_reason": "query_result_limit_reached"
}
}Documentation Index
Fetch the complete documentation index at: https://developers.notion.com/llms.txt
Use this file to discover all available pages before exploring further.
page_size of results. If the response includes a next_cursor value, refer to the pagination reference for details about how to use a cursor to iterate through the list.
result_type filter of "page" or "data_source" if you’re only looking for query results that are one of those two types instead of both."and" filter. Similar a set of filters chained by “Or” in the UI would be represented as filters in the array of the "or" compound filter.
Filters operate on data source properties and can be combined. If no filter is provided, all the pages in the data source will be returned with pagination.

{
"and": [
{
"property": "Done",
"checkbox": {
"equals": true
}
},
{
"or": [
{
"property": "Tags",
"contains": "A"
},
{
"property": "Tags",
"contains": "B"
}
]
}
]
}
{
"property": "Done",
"checkbox": {
"equals": true
}
}
last_edited_time to fetch only recently changed pages).filter_properties query parameter to filter only the properties of the data source schema you need from the response items. For example:
https://api.notion.com/v1/data_sources/[DATA_SOURCE_ID]/query?filter_properties[]=title
filter_properties query param. For example:
https://api.notion.com/v1/data_sources/[DATA_SOURCE_ID]/query?filter_properties[]=title&filter_properties[]=status
filter_properties endpoint expects an array of strings. For example:
notion.dataSources.query({
data_source_id: id,
filter_properties: ["title", "status"]
})
filter_properties can make a significant improvement to the speed of the API and size of the JSON objects in the results, especially for databases with lots of properties, some of which might be rollups, relations, or formulas. If you need additional properties from each returned page, you can make subsequent calls to the Retrieve page property item or Retrieve a page APIs.
If you’re still running into long query times with this API, other tips include:
Add connections, and use the search bar to find and select the connection from the dropdown list.additional_data object with retry guidance:
{
"object": "error",
"status": 503,
"code": "service_unavailable",
"message": "Public API data source query is temporarily unavailable due to backend datastore timeouts. Retry with exponential backoff; if retries continue to fail, reduce page_size or narrow filters/sorts.",
"additional_data": {
"endpoint_name": "public_queryDataSource",
"notion_error_name": "PgPoolWaitConnectionTimeout",
"retry_guidance": [
"Use exponential backoff with jitter",
"Reduce page_size",
"Narrow query filters/sorts"
]
}
}
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The API version to use for this request. The latest version is 2026-03-11.
2026-03-11 Show child attributes
Show child attributes
Optionally filter the results to only include pages or data sources. Regular, non-wiki databases only support page children. The default behavior is no result type filtering, in other words, returning both pages and data sources for wikis.
page, data_source "page_or_data_source""list"Show child attributes
Show child attributes