> ## Documentation Index
> Fetch the complete documentation index at: https://deepline.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Notion: Post Database Query

> Query a data source. Notion Post Database Query reference includes SDK V2 and CLI requests, input constraints, response fields, and Deepline cost.

Query a data source.

<Info>
  Tool ID: `notion_post_database_query`
</Info>

## Run this action

Use the TypeScript SDK for a single call. Put `ctx.tools.execute(...)` inside a Play when the call should be durable, scheduled, or run across a CSV.

```ts theme={null}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'notion_post_database_query',
  {
    "data_source_id": "data_source_123"
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={null}
deepline tools execute notion_post_database_query --input '{
  "data_source_id": "data_source_123"
}' --json
```

## Example response

The SDK exposes this shape at `result.toolResponse.raw`. Values below are representative.

```json theme={null}
{
  "data": {
    "type": "page_or_data_source",
    "page_or_data_source": {},
    "object": "list",
    "next_cursor": "cursor_123",
    "has_more": true,
    "results": [
      {
        "object": "page",
        "id": "123e4567-e89b-42d3-a456-426614174000"
      }
    ]
  }
}
```

Use `deepline tools get notion_post_database_query --json` for the latest machine-readable contract.

## Input reference

Query a data source

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.data_source_id` | `string` | Yes | — | — |
| `payload.filter_properties` | `array` | No | — | — |
| `payload.sorts` | `array` | No | — | — |
| `payload.filter` | `object` | No | — | — |
| `payload.start_cursor` | `string` | No | — | — |
| `payload.page_size` | `integer` | No | — | Minimum: 1. Maximum: 100. |
| `payload.is_archived` | `boolean` | No | — | Whether to return archived pages. When omitted or false, returns non-archived pages. When true, returns archived pages. |
| `payload.result_type` | `"page" \| "data_source"` | No | — | 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. Allowed: `page`, `data_source`. |

<Info>
  This input schema is too large to embed without slowing the page. Get the complete live contract with `deepline tools get notion_post_database_query --json`.
</Info>

## Output reference

Standard tool result payload.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `result.data` | `object` | Yes | — | Provider response payload. |
| `result.data.type` | `"page_or_data_source"` | Yes | — | — |
| `result.data.page_or_data_source` | `object` | Yes | — | — |
| `result.data.object` | `"list"` | Yes | — | — |
| `result.data.next_cursor` | `string \| null` | Yes | — | — |
| `result.data.has_more` | `boolean` | Yes | — | — |
| `result.data.results` | `array` | Yes | — | — |
| `result.data.results[].object` | `"page"` | Yes | — | The page object type name. |
| `result.data.results[].id` | `string` | Yes | — | — |
| `result.data.results[].created_time` | `string` | Yes | — | Date and time when this page was created. |
| `result.data.results[].last_edited_time` | `string` | Yes | — | Date and time when this page was last edited. |
| `result.data.results[].in_trash` | `boolean` | Yes | — | Whether the page is in trash. |
| `result.data.results[].is_archived` | `boolean` | Yes | — | Whether the page has been archived. |
| `result.data.results[].is_locked` | `boolean` | Yes | — | Whether the page is locked from editing in the Notion app UI. |
| `result.data.results[].url` | `string` | Yes | — | The URL of the Notion page. |
| `result.data.results[].public_url` | `string \| null` | Yes | — | The public URL of the Notion page, if it has been published to the web. |
| `result.data.results[].parent` | `object` | Yes | — | — |
| `result.data.results[].parent.type` | `"database_id"` | Yes | — | The parent type. |
| `result.data.results[].parent.database_id` | `string` | Yes | — | — |
| `result.data.results[].parent.data_source_id` | `string` | Yes | — | — |
| `result.data.results[].parent.page_id` | `string` | Yes | — | — |
| `result.data.results[].parent.block_id` | `string` | Yes | — | — |
| `result.data.results[].parent.agent_id` | `string` | Yes | — | — |
| `result.data.results[].parent.workspace` | `true` | Yes | — | Always true for workspace parent. |
| `result.data.results[].properties` | `record` | Yes | — | Property values of this page. |
| `result.data.results[].icon` | `object \| null` | Yes | — | Page icon. |
| `result.data.results[].icon.type` | `"emoji"` | Yes | — | Type of icon. In this case, an emoji. |
| `result.data.results[].icon.emoji` | `string` | Yes | — | — |
| `result.data.results[].icon.file` | `object` | Yes | — | — |
| `result.data.results[].icon.file.url` | `string` | Yes | — | The URL of the file. |
| `result.data.results[].icon.file.expiry_time` | `string` | Yes | — | The time when the URL will expire. |
| `result.data.results[].icon.external` | `object` | Yes | — | The external URL for the icon. |
| `result.data.results[].icon.external.url` | `string` | Yes | — | The URL of the external file or resource. |
| `result.data.results[].icon.custom_emoji` | `object` | Yes | — | — |
| `result.data.results[].icon.custom_emoji.id` | `string` | Yes | — | — |
| `result.data.results[].icon.custom_emoji.name` | `string` | Yes | — | The name of the custom emoji. |
| `result.data.results[].icon.custom_emoji.url` | `string` | Yes | — | The URL of the custom emoji. |
| `result.data.results[].icon.icon` | `object` | Yes | — | — |
| `result.data.results[].icon.icon.name` | `string` | Yes | — | — |
| `result.data.results[].icon.icon.color` | `"gray" \| "lightgray" \| "brown" \| "yellow" \| "orange" \| "green" \| "blue" \| "purple" \| "pink" \| "red"` | Yes | — | — |
| `result.data.results[].cover` | `object \| null` | Yes | — | Page cover image. |
| `result.data.results[].cover.type` | `"file"` | Yes | — | Type of cover. In this case, a file. |
| `result.data.results[].cover.file` | `object` | Yes | — | — |
| `result.data.results[].cover.file.url` | `string` | Yes | — | The URL of the file. |
| `result.data.results[].cover.file.expiry_time` | `string` | Yes | — | The time when the URL will expire. |
| `result.data.results[].cover.external` | `object` | Yes | — | The external URL for the cover. |
| `result.data.results[].cover.external.url` | `string` | Yes | — | The URL of the external file or resource. |
| `result.data.results[].created_by` | `object` | Yes | — | — |
| `result.data.results[].created_by.id` | `string` | Yes | — | — |
| `result.data.results[].created_by.object` | `"user"` | Yes | — | Always `user` |

The table shows the first 50 fields. Use the live contract below for every field.

<Info>
  This output schema is too large to embed without slowing the page. Get the complete live contract with `deepline tools get notion_post_database_query --json`.
</Info>

## Deepline cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.

## Related documentation

* [Notion provider guide](/docs/providers/notion/guide)
* [SDK V2 quickstart](/docs/sdk-v2/quickstart)
* [SDK reference](/docs/sdk-v2/sdk-reference)
* [Run tools across a CSV](/docs/sdk-v2/batch-csv)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.