> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://notion.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://notion.ferndocs.com/_mcp/server.

# Query a data source

POST https://api.notion.com/v1/data_sources/{data_source_id}/query
Content-Type: application/json

Gets a list of [Pages](/reference/page) and/or [Data Sources](/reference/data-source)  contained in the data source, filtered and ordered according to the filter conditions and sort criteria provided in the request. The response may contain fewer than `page_size` of results. If the response includes a `next_cursor` value, refer to the [pagination reference](https://developers.notion.com/reference/intro#pagination) for details about how to use a cursor to iterate through the list.

[Wiki](https://www.notion.so/help/wikis-and-verified-pages) data sources can contain both pages and databases as children. In all other cases, the children can only be pages.

When there's a [database](/reference/database) result, this API returns all data sources that are children of *that* database, instead of surfacing the database directly. Surfacing the data source instead of the direct database child helps make it easier to craft your next API request (for example, retrieving the data source).

[**Filters**](/reference/filter-data-source-entries) are similar to the [filters provided in the Notion UI](https://www.notion.so/help/views-filters-and-sorts) where the set of filters and filter groups chained by "And" in the UI is equivalent to having each filter in the array of the compound `"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.

```json Filter Object
{
  "and": [
    {
      "property": "Done",
      "checkbox": {
        "equals": true
      }
    }, 
    {
      "or": [
        {
          "property": "Tags",
          "contains": "A"
        },
        {
          "property": "Tags",
          "contains": "B"
        }
      ]
  	}
  ]
}
```

In addition to chained filters, data sources can be queried with single filters.

```json JSON
{
    "property": "Done",
    "checkbox": {
        "equals": true
   }
 }
```

[**Sorts**](/reference/sort-data-source-entries) are similar to the [sorts provided in the Notion UI](https://notion.so/notion/Intro-to-databases-fd8cd2d212f74c50954c11086d85997e#0eb303043b1742468e5aff2f3f670505). Sorts operate on database properties or page timestamps and can be combined. The order of the sorts in the request matter, with earlier sorts taking precedence over later ones.

The properties of the data source schema returned in the response body can be filtered with the `filter_properties` query parameter.

```
https://api.notion.com/v1/data_sources/[data_source_id]/query?filter_properties=[property_id_1]
```

Multiple filter properties can be provided by chaining the `filter_properties` query param.

```
https://api.notion.com/v1/data_sources/[data_source_id]/query?filter_properties=[property_id_1]&filter_properties=[property_id_2]
```

Property IDs can be determined with the [Retrieve a data source](/reference/retrieve-a-data-source) endpoint.

If you are using the [Notion JavaScript SDK](https://github.com/makenotion/notion-sdk-js), the `filter_properties` endpoint expects an array of property ID strings.

```JavaScript JavaScript
notion.dataSources.query({
	data_source_id: id,
	filter_properties: ["propertyID1", "propertyID2"]
})
```

Before an integration can query a data source, its parent database must be shared with the integration. Attempting to query a database that has not been shared will return an HTTP response with a 404 status code.

To share a database with an integration, click the ••• menu at the top right of a database page, scroll to `Add connections`, and use the search bar to find and select the integration from the dropdown list.

This endpoint requires an integration to have read content capabilities. Attempting to call this API without read content capabilities will return an HTTP response with a 403 status code. For more information on integration capabilities, see the [capabilities guide](/reference/capabilities).

1. Add a rollup property to the data source which uses a formula to get the related page's title. This works well if you have access to [update](/reference/update-a-data-source) the data source's schema.

2. Otherwise, [retrieve the individual related pages](/reference/retrieve-a-page) using each page ID.

* If a formula depends on a page property that is a relation, and that relation has more than 25 references, only 25 will be evaluated as part of the formula.
* Rollups and formulas that depend on multiple layers of relations may not return correct results.
* Notion recommends individually [retrieving each page property item](/reference/retrieve-a-page-property) to get the most accurate result.

### Errors

Returns a 404 HTTP response if the data source doesn't exist, or if the integration doesn't have access to the data source.

Returns a 400 or a 429 HTTP response if the request exceeds the [request limits](/reference/request-limits).

*Note: Each Public API endpoint can return several possible error codes. See the [Error codes section](https://developers.notion.com/reference/status-codes#error-codes) of the Status codes documentation for more information.*

Reference: https://notion.ferndocs.com/reference/query-a-data-source

## Request

### Path parameters

- `data_source_id` (string, required) — ID of a Notion data source. This is a UUIDv4, with or without dashes.

### Headers

- `Notion-Version` (string, required) — The [API version](/reference/versioning) to use for this request. The latest version is `<<internalLatestNotionVersion>>`.

### Body (application/json)

This endpoint expects an object.

- `sorts` (list of V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaSortsItems, optional) — An array of property or timestamp sort objects.
- `filter` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilter, optional)
- `start_cursor` (string, optional)
- `page_size` (integer, optional)

## Response

### 200

200

- `map from string to any`

## Errors

### 400 Bad Request Error

400

- `map from string to any`

## Types

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaSortsItems

- `direction` (enum, required)
  - Allowed values: `"ascending"`, `"descending"`
- `property` (string, optional)
- `timestamp` (enum, optional)
  - Allowed values: `"created_time"`, `"last_edited_time"`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilter

- `timestamp` (enum, optional)
  - Allowed values: `"created_time"`, `"last_edited_time"`
- `created_time` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTime, optional)
- `last_edited_time` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTime, optional)
- `property` (string, optional)
- `title` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterTitle, optional)
- `rich_text` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterRichText, optional)
- `number` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterNumber, optional)
- `checkbox` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCheckbox, optional)
- `select` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterSelect, optional)
- `multi_select` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterMultiSelect, optional)
- `status` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterStatus, optional)
- `date` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDate, optional)
- `people` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterPeople, optional)
- `files` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFiles, optional)
- `url` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterUrl, optional)
- `email` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterEmail, optional)
- `phone_number` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterPhoneNumber, optional)
- `relation` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterRelation, optional)
- `created_by` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedBy, optional)
- `last_edited_by` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedBy, optional)
- `formula` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormula, optional)
- `unique_id` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterUniqueId, optional)
- `verification` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterVerification, optional)

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTime

- `equals` (string, optional)
- `before` (string, optional)
- `after` (string, optional)
- `on_or_before` (string, optional)
- `on_or_after` (string, optional)
- `this_week` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimeThisWeek, optional) — Empty object `{}`
- `past_week` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimePastWeek, optional) — Empty object `{}`
- `past_month` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimePastMonth, optional) — Empty object `{}`
- `past_year` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimePastYear, optional) — Empty object `{}`
- `next_week` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimeNextWeek, optional) — Empty object `{}`
- `next_month` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimeNextMonth, optional) — Empty object `{}`
- `next_year` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimeNextYear, optional) — Empty object `{}`
- `is_empty` (enum, optional)
  - Allowed values: `true`
- `is_not_empty` (boolean, optional) — true

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTime

- `equals` (string, optional)
- `before` (string, optional)
- `after` (string, optional)
- `on_or_before` (string, optional)
- `on_or_after` (string, optional)
- `this_week` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimeThisWeek, optional) — Empty object `{}`
- `past_week` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimePastWeek, optional) — Empty object `{}`
- `past_month` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimePastMonth, optional) — Empty object `{}`
- `past_year` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimePastYear, optional) — Empty object `{}`
- `next_week` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimeNextWeek, optional) — Empty object `{}`
- `next_month` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimeNextMonth, optional) — Empty object `{}`
- `next_year` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimeNextYear, optional) — Empty object `{}`
- `is_empty` (enum, optional)
  - Allowed values: `true`
- `is_not_empty` (boolean, optional) — true

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterTitle

- `equals` (string, optional)
- `does_not_equal` (string, optional)
- `contains` (string, optional)
- `does_not_contain` (string, optional)
- `starts_with` (string, optional)
- `ends_with` (string, optional)
- `is_empty` (string, optional)
- `is_not_empty` (string, optional)

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterRichText

- `equals` (string, optional)
- `does_not_equal` (string, optional)
- `contains` (string, optional)
- `does_not_contain` (string, optional)
- `starts_with` (string, optional)
- `ends_with` (string, optional)
- `is_empty` (string, optional)
- `is_not_empty` (string, optional)

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterNumber

- `equals` (double, optional)
- `does_not_equal` (double, optional)
- `greater_than` (double, optional)
- `less_than` (double, optional)
- `greater_than_or_equal_to` (double, optional)
- `less_than_or_equal_to` (double, optional)
- `is_empty` (double, optional)
- `is_not_empty` (double, optional)

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCheckbox

- `equals` (boolean, optional)
- `does_not_equal` (boolean, optional)

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterSelect

- `equals` (string, optional)
- `does_not_equal` (string, optional)
- `is_empty` (enum, optional)
  - Allowed values: `true`
- `is_not_empty` (enum, optional)
  - Allowed values: `true`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterMultiSelect

- `equals` (string, optional)
- `does_not_equal` (string, optional)
- `is_empty` (enum, optional)
  - Allowed values: `true`
- `is_not_empty` (enum, optional)
  - Allowed values: `true`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterStatus

- `equals` (string, optional)
- `does_not_equal` (string, optional)
- `is_empty` (enum, optional)
  - Allowed values: `true`
- `is_not_empty` (enum, optional)
  - Allowed values: `true`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDate

- `equals` (string, optional)
- `before` (string, optional)
- `after` (string, optional)
- `on_or_before` (string, optional)
- `on_or_after` (string, optional)
- `this_week` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDateThisWeek, optional) — Empty object `{}`
- `past_week` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDatePastWeek, optional) — Empty object `{}`
- `past_month` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDatePastMonth, optional) — Empty object `{}`
- `past_year` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDatePastYear, optional) — Empty object `{}`
- `next_week` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDateNextWeek, optional) — Empty object `{}`
- `next_month` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDateNextMonth, optional) — Empty object `{}`
- `next_year` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDateNextYear, optional) — Empty object `{}`
- `is_empty` (enum, optional)
  - Allowed values: `true`
- `is_not_empty` (boolean, optional) — true

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterPeople

- `contains` (string, optional)
- `does_not_contain` (string, optional)
- `is_empty` (enum, optional)
  - Allowed values: `true`
- `is_not_empty` (enum, optional)
  - Allowed values: `true`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFiles

- `is_empty` (enum, optional)
  - Allowed values: `true`
- `is_not_empty` (enum, optional)
  - Allowed values: `true`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterUrl

- `equals` (string, optional)
- `does_not_equal` (string, optional)
- `contains` (string, optional)
- `does_not_contain` (string, optional)
- `starts_with` (string, optional)
- `ends_with` (string, optional)
- `is_empty` (string, optional)
- `is_not_empty` (string, optional)

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterEmail

- `equals` (string, optional)
- `does_not_equal` (string, optional)
- `contains` (string, optional)
- `does_not_contain` (string, optional)
- `starts_with` (string, optional)
- `ends_with` (string, optional)
- `is_empty` (string, optional)
- `is_not_empty` (string, optional)

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterPhoneNumber

- `equals` (string, optional)
- `does_not_equal` (string, optional)
- `contains` (string, optional)
- `does_not_contain` (string, optional)
- `starts_with` (string, optional)
- `ends_with` (string, optional)
- `is_empty` (string, optional)
- `is_not_empty` (string, optional)

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterRelation

- `contains` (string, optional)
- `does_not_contain` (string, optional)
- `is_empty` (enum, optional)
  - Allowed values: `true`
- `is_not_empty` (enum, optional)
  - Allowed values: `true`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedBy

- `contains` (string, optional)
- `does_not_contain` (string, optional)
- `is_empty` (enum, optional)
  - Allowed values: `true`
- `is_not_empty` (enum, optional)
  - Allowed values: `true`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedBy

- `contains` (string, optional)
- `does_not_contain` (string, optional)
- `is_empty` (enum, optional)
  - Allowed values: `true`
- `is_not_empty` (enum, optional)
  - Allowed values: `true`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormula

- `string` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaString, optional)
- `checkbox` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaCheckbox, optional)
- `number` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaNumber, optional)
- `date` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDate, optional)

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterUniqueId

- `equals` (double, optional)
- `does_not_equal` (double, optional)
- `greater_than` (double, optional)
- `less_than` (double, optional)
- `greater_than_or_equal_to` (double, optional)
- `less_than_or_equal_to` (double, optional)
- `is_empty` (double, optional)
- `is_not_empty` (double, optional)

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterVerification

- `status` (enum, required)
  - Allowed values: `"verified"`, `"expired"`, `"none"`, ``

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimeThisWeek

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimePastWeek

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimePastMonth

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimePastYear

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimeNextWeek

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimeNextMonth

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterCreatedTimeNextYear

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimeThisWeek

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimePastWeek

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimePastMonth

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimePastYear

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimeNextWeek

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimeNextMonth

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterLastEditedTimeNextYear

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDateThisWeek

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDatePastWeek

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDatePastMonth

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDatePastYear

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDateNextWeek

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDateNextMonth

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterDateNextYear

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaString

- `equals` (string, optional)
- `does_not_equal` (string, optional)
- `contains` (string, optional)
- `does_not_contain` (string, optional)
- `starts_with` (string, optional)
- `ends_with` (string, optional)
- `is_empty` (string, optional)
- `is_not_empty` (string, optional)

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaCheckbox

- `equals` (boolean, optional)
- `does_not_equal` (boolean, optional)

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaNumber

- `equals` (double, optional)
- `does_not_equal` (double, optional)
- `greater_than` (double, optional)
- `less_than` (double, optional)
- `greater_than_or_equal_to` (double, optional)
- `less_than_or_equal_to` (double, optional)
- `is_empty` (double, optional)
- `is_not_empty` (double, optional)

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDate

- `equals` (string, optional)
- `before` (string, optional)
- `after` (string, optional)
- `on_or_before` (string, optional)
- `on_or_after` (string, optional)
- `this_week` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDateThisWeek, optional) — Empty object `{}`
- `past_week` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDatePastWeek, optional) — Empty object `{}`
- `past_month` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDatePastMonth, optional) — Empty object `{}`
- `past_year` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDatePastYear, optional) — Empty object `{}`
- `next_week` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDateNextWeek, optional) — Empty object `{}`
- `next_month` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDateNextMonth, optional) — Empty object `{}`
- `next_year` (V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDateNextYear, optional) — Empty object `{}`
- `is_empty` (enum, optional)
  - Allowed values: `true`
- `is_not_empty` (boolean, optional) — true

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDateThisWeek

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDatePastWeek

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDatePastMonth

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDatePastYear

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDateNextWeek

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDateNextMonth

Empty object `{}`

### V1DataSourcesDataSourceIdQueryPostRequestBodyContentApplicationJsonSchemaFilterFormulaDateNextYear

Empty object `{}`

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "object": "list",
  "results": [
    {
      "object": "page",
      "id": "59833787-2cf9-4fdf-8782-e53db20768a5",
      "created_time": "2022-03-01T19:05:00.000Z",
      "last_edited_time": "2022-07-06T20:25:00.000Z",
      "created_by": {
        "object": "user",
        "id": "ee5f0f84-409a-440f-983a-a5315961c6e4"
      },
      "last_edited_by": {
        "object": "user",
        "id": "0c3e9826-b8f7-4f73-927d-2caaf86f1103"
      },
      "cover": {
        "type": "external",
        "external": {
          "url": "https://upload.wikimedia.org/wikipedia/commons/6/62/Tuscankale.jpg"
        }
      },
      "icon": {
        "type": "emoji",
        "emoji": "🥬"
      },
      "parent": {
        "type": "data_source_id",
        "database_id": "d9824bdc-8445-4327-be8b-5b47500af6ce",
        "data_source_id": "27a2eeb5-b4f6-4dbe-b3b5-609a7ab26620"
      },
      "archived": false,
      "properties": {
        "Store availability": {
          "id": "%3AUPp",
          "type": "multi_select",
          "multi_select": [
            {
              "id": "t|O@",
              "name": "Gus's Community Market",
              "color": "yellow"
            },
            {
              "id": "{Ml\\",
              "name": "Rainbow Grocery",
              "color": "gray"
            }
          ]
        },
        "Food group": {
          "id": "A%40Hk",
          "type": "select",
          "select": {
            "id": "5e8e7e8f-432e-4d8a-8166-1821e10225fc",
            "name": "🥬 Vegetable",
            "color": "pink"
          }
        },
        "Price": {
          "id": "BJXS",
          "type": "number",
          "number": 2.5
        },
        "Responsible Person": {
          "id": "Iowm",
          "type": "people",
          "people": [
            {
              "object": "user",
              "id": "cbfe3c6e-71cf-4cd3-b6e7-02f38f371bcc",
              "name": "Cristina Cordova",
              "avatar_url": "https://lh6.googleusercontent.com/-rapvfCoTq5A/AAAAAAAAAAI/AAAAAAAAAAA/AKF05nDKmmUpkpFvWNBzvu9rnZEy7cbl8Q/photo.jpg",
              "type": "person",
              "person": {
                "email": "cristina@makenotion.com"
              }
            }
          ]
        },
        "Last ordered": {
          "id": "Jsfb",
          "type": "date",
          "date": {
            "start": "2022-02-22",
            "end": null,
            "time_zone": null
          }
        },
        "Cost of next trip": {
          "id": "WOd%3B",
          "type": "formula",
          "formula": {
            "type": "number",
            "number": 0
          }
        },
        "Recipes": {
          "id": "YfIu",
          "type": "relation",
          "relation": [
            {
              "id": "90eeeed8-2cdd-4af4-9cc1-3d24aff5f63c"
            },
            {
              "id": "a2da43ee-d43c-4285-8ae2-6d811f12629a"
            }
          ],
          "has_more": false
        },
        "Description": {
          "id": "_Tc_",
          "type": "rich_text",
          "rich_text": [
            {
              "type": "text",
              "text": {
                "content": "A dark ",
                "link": null
              },
              "annotations": {
                "bold": false,
                "italic": false,
                "strikethrough": false,
                "underline": false,
                "code": false,
                "color": "default"
              },
              "plain_text": "A dark ",
              "href": null
            },
            {
              "type": "text",
              "text": {
                "content": "green",
                "link": null
              },
              "annotations": {
                "bold": false,
                "italic": false,
                "strikethrough": false,
                "underline": false,
                "code": false,
                "color": "green"
              },
              "plain_text": "green",
              "href": null
            },
            {
              "type": "text",
              "text": {
                "content": " leafy vegetable",
                "link": null
              },
              "annotations": {
                "bold": false,
                "italic": false,
                "strikethrough": false,
                "underline": false,
                "code": false,
                "color": "default"
              },
              "plain_text": " leafy vegetable",
              "href": null
            }
          ]
        },
        "In stock": {
          "id": "%60%5Bq%3F",
          "type": "checkbox",
          "checkbox": true
        },
        "Number of meals": {
          "id": "zag~",
          "type": "rollup",
          "rollup": {
            "type": "number",
            "number": 2,
            "function": "count"
          }
        },
        "Photo": {
          "id": "%7DF_L",
          "type": "url",
          "url": "https://i.insider.com/612fb23c9ef1e50018f93198?width=1136&format=jpeg"
        },
        "Name": {
          "id": "title",
          "type": "title",
          "title": [
            {
              "type": "text",
              "text": {
                "content": "Tuscan kale",
                "link": null
              },
              "annotations": {
                "bold": false,
                "italic": false,
                "strikethrough": false,
                "underline": false,
                "code": false,
                "color": "default"
              },
              "plain_text": "Tuscan kale",
              "href": null
            }
          ]
        }
      },
      "url": "https://www.notion.so/Tuscan-kale-598337872cf94fdf8782e53db20768a5"
    }
  ],
  "next_cursor": null,
  "has_more": false,
  "type": "page_or_data_source",
  "page_or_data_source": {}
}
```

**SDK Code**

```javascript
const { Client } = require('@notionhq/client');

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

(async () => {
  const dataSourceId = 'd9824bdc-8445-4327-be8b-5b47500af6ce';
  const response = await notion.dataSources.query({
    data_source_id: dataSourceId,
    filter: {
      or: [
        {
          property: 'In stock',
          checkbox: {
            equals: true,
          },
        },
        {
          property: 'Cost of next trip',
          number: {
            greater_than_or_equal_to: 2,
          },
        },
      ],
    },
    sorts: [
      {
        property: 'Last ordered',
        direction: 'ascending',
      },
    ],
  });
  console.log(response);
})();
```

```python
import requests

url = "https://api.notion.com/v1/data_sources/data_source_id/query"

payload = {}
headers = {
    "Notion-Version": "Notion-Version",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.notion.com/v1/data_sources/data_source_id/query"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Notion-Version", "Notion-Version")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.notion.com/v1/data_sources/data_source_id/query")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Notion-Version"] = 'Notion-Version'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.notion.com/v1/data_sources/data_source_id/query")
  .header("Notion-Version", "Notion-Version")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.notion.com/v1/data_sources/data_source_id/query', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'Notion-Version' => 'Notion-Version',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.notion.com/v1/data_sources/data_source_id/query");
var request = new RestRequest(Method.POST);
request.AddHeader("Notion-Version", "Notion-Version");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Notion-Version": "Notion-Version",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.notion.com/v1/data_sources/data_source_id/query")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```