Notion search

From theheavenlyd3mon/hermes-profiles · View interactive version

Notion search is an AI agent skill from the GitHub repository theheavenlyd3mon/hermes-profiles. Search across a Notion workspace — find pages, databases, and content by query.

How to use this skill

Skill file

Notion Search

Search across your Notion workspace to find pages, databases (data sources), and content.

Prerequisites

Basic Search

curl -s -X POST "https://api.notion.com/v1/search" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{"query": "page title or keyword"}' | jq .

Search with Filters

Filter by object type:

# Search only pages
curl -s -X POST "https://api.notion.com/v1/search" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "research",
    "filter": {"value": "page", "property": "object"}
  }' | jq .

# Search only databases (data sources)
curl -s -X POST "https://api.notion.com/v1/search" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "logbook",
    "filter": {"value": "data_source", "property": "object"}
  }' | jq .

Sort Results

curl -s -X POST "https://api.notion.com/v1/search" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "agent",
    "sort": {"direction": "descending", "timestamp": "last_edited_time"}
  }' | jq .

Paginated Search (get all results)

#!/bin/bash
SEARCH_QUERY="notion"
HAS_MORE=true
START_CURSOR=""

while [ "$HAS_MORE" = true ]; do
  if [ -z "$START_CURSOR" ]; then
    RESULT=$(curl -s -X POST "https://api.notion.com/v1/search" \
      -H "Authorization: Bearer $NOTION_API_KEY" \
      -H "Notion-Version: 2025-09-03" \
      -H "Content-Type: application/json" \
      -d "{\"query\": \"$SEARCH_QUERY\", \"page_size\": 100}")
  else
    RESULT=$(curl -s -X POST "https://api.notion.com/v1/search" \
      -H "Authorization: Bearer $NOTION_API_KEY" \
      -H "Notion-Version: 2025-09-03" \
      -H "Content-Type: application/json" \
      -d "{\"query\": \"$SEARCH_QUERY\", \"page_size\": 100, \"start_cursor\": \"$START_CURSOR\"}")
  fi

  echo "$RESULT" | jq '.results[] | {id: .id, type: .object, title: .title?.[0]?.plain_text? // .properties?.Name?.title?.[0]?.plain_text?}'
  HAS_MORE=$(echo "$RESULT" | jq -r '.has_more')
  START_CURSOR=$(echo "$RESULT" | jq -r '.next_cursor // empty')
done

Find Items in a Database (Targeted Query)

curl -s -X POST "https://api.notion.com/v1/data_sources/{data_source_id}/query" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {"property": "Name", "title": {"contains": "keyword"}},
    "page_size": 20
  }' | jq '.results[] | {id: .id, name: .properties.Name.title[0].plain_text}'

List Everything

Use an empty query to list ALL pages and databases shared with the integration:

curl -s -X POST "https://api.notion.com/v1/search" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{"query": "", "page_size": 100}' | jq '.results[] | {id: .id, type: .object, title: .title?.[0]?.plain_text? // .properties?.Name?.title?.[0]?.plain_text?}'

Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.