notion-api-2-query-databases
Sub-skill of notion-api: 2. Query Databases.
Best use case
notion-api-2-query-databases is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Sub-skill of notion-api: 2. Query Databases.
Teams using notion-api-2-query-databases should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/2-query-databases/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How notion-api-2-query-databases Compares
| Feature / Agent | notion-api-2-query-databases | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Sub-skill of notion-api: 2. Query Databases.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 2. Query Databases
## 2. Query Databases
**Basic Query:**
```bash
# Query all items
curl -s -X POST "https://api.notion.com/v1/databases/DATABASE_ID/query" \
-H "Authorization: Bearer $NOTION_API_KEY" \
-H "Notion-Version: 2022-06-28" \
-H "Content-Type: application/json" \
-d '{}' | jq '.results'
# Query with filter
curl -s -X POST "https://api.notion.com/v1/databases/DATABASE_ID/query" \
-H "Authorization: Bearer $NOTION_API_KEY" \
-H "Notion-Version: 2022-06-28" \
-H "Content-Type: application/json" \
-d '{
"filter": {
"property": "Status",
"select": {
"equals": "In Progress"
}
}
}' | jq '.results'
# Query with sort
curl -s -X POST "https://api.notion.com/v1/databases/DATABASE_ID/query" \
-H "Authorization: Bearer $NOTION_API_KEY" \
-H "Notion-Version: 2022-06-28" \
-H "Content-Type: application/json" \
-d '{
"sorts": [
{
"property": "Due Date",
"direction": "ascending"
}
]
}' | jq '.results'
```
**Python - Query Operations:**
```python
# Simple query
results = notion.databases.query(database_id="your-database-id")
for page in results["results"]:
props = page["properties"]
name = props["Name"]["title"][0]["plain_text"] if props["Name"]["title"] else "Untitled"
print(f"- {name}")
# Query with filter
results = notion.databases.query(
database_id="your-database-id",
filter={
"property": "Status",
"select": {
"equals": "In Progress"
}
}
)
# Query with multiple filters (AND)
results = notion.databases.query(
database_id="your-database-id",
filter={
"and": [
{
"property": "Status",
"select": {"equals": "In Progress"}
},
{
"property": "Priority",
"select": {"equals": "High"}
}
]
}
)
# Query with OR filter
results = notion.databases.query(
database_id="your-database-id",
filter={
"or": [
{"property": "Status", "select": {"equals": "To Do"}},
{"property": "Status", "select": {"equals": "In Progress"}}
]
}
)
# Query with sorting
results = notion.databases.query(
database_id="your-database-id",
sorts=[
{"property": "Priority", "direction": "ascending"},
{"property": "Due Date", "direction": "ascending"}
]
)
# Paginated query
def query_all_pages(database_id, filter=None):
"""Query all pages with pagination"""
all_results = []
has_more = True
start_cursor = None
while has_more:
response = notion.databases.query(
database_id=database_id,
filter=filter,
start_cursor=start_cursor,
page_size=100
)
all_results.extend(response["results"])
has_more = response["has_more"]
start_cursor = response.get("next_cursor")
return all_results
all_items = query_all_pages("your-database-id")
print(f"Total items: {len(all_items)}")
```Related Skills
notion
Notion API for creating and managing pages, databases, and blocks via curl. Search, create, update, and query Notion workspaces directly from the terminal.
activepieces-integration-with-notion-and-slack
Sub-skill of activepieces: Integration with Notion and Slack.
mcp-builder-example-1-database-query-tool
Sub-skill of mcp-builder: Example 1: Database Query Tool (+1).
sql-queries-bigquery-google-cloud
Sub-skill of sql-queries: BigQuery (Google Cloud) (+2).
polars-2-lazy-evaluation-and-query-optimization
Sub-skill of polars: 2. Lazy Evaluation and Query Optimization.
obsidian-integration-with-notion-export
Sub-skill of obsidian: Integration with Notion Export.
notion-api-integration-with-slack
Sub-skill of notion-api: Integration with Slack (+1).
notion-api-example-1-task-management-system
Sub-skill of notion-api: Example 1: Task Management System (+2).
notion-api-8-search-api
Sub-skill of notion-api: 8. Search API.
notion-api-6-rich-text-formatting
Sub-skill of notion-api: 6. Rich Text Formatting (+1).
notion-api-5-block-operations
Sub-skill of notion-api: 5. Block Operations.
notion-api-4-page-operations
Sub-skill of notion-api: 4. Page Operations.