> For the complete documentation index, see [llms.txt](https://agpt.co/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://agpt.co/docs/integrations/block-integrations/read_database.md).

# Notion Read Database

Blocks for querying and reading data from Notion databases.

## Notion Read Database

### What it is

Query a Notion database with optional filtering and sorting, returning structured entries.

### How it works

This block queries a Notion database using the Notion API. It retrieves entries with optional filtering by property values and sorting. The block requires your Notion integration to have access to the database.

Results include all property values for each entry, the entry IDs for further operations, and the total count. The database connection must be shared with your integration from Notion.

### Inputs

| Input            | Description                                                          | Type | Required |
| ---------------- | -------------------------------------------------------------------- | ---- | -------- |
| database\_id     | Notion database ID. Must be accessible by the connected integration. | str  | Yes      |
| filter\_property | Property name to filter by (e.g., 'Status', 'Priority')              | str  | No       |
| filter\_value    | Value to filter for in the specified property                        | str  | No       |
| sort\_property   | Property name to sort by                                             | str  | No       |
| sort\_direction  | Sort direction: 'ascending' or 'descending'                          | str  | No       |
| limit            | Maximum number of entries to retrieve                                | int  | No       |

### Outputs

| Output          | Description                                             | Type                   |
| --------------- | ------------------------------------------------------- | ---------------------- |
| error           | Error message if the operation failed                   | str                    |
| entries         | List of database entries with their properties.         | List\[Dict\[str, Any]] |
| entry           | Individual database entry (yields one per entry found). | Dict\[str, Any]        |
| entry\_ids      | List of entry IDs for batch operations.                 | List\[str]             |
| entry\_id       | Individual entry ID (yields one per entry found).       | str                    |
| count           | Number of entries retrieved.                            | int                    |
| database\_title | Title of the database.                                  | str                    |

### Possible use case

**Task Management**: Query a Notion task database to find items with a specific status or assigned to a particular person.

**Content Pipeline**: Read entries from a content calendar database to identify posts scheduled for today or this week.

**CRM Sync**: Fetch customer records from a Notion database to sync with other systems or trigger workflows.

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://agpt.co/docs/integrations/block-integrations/read_database.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
