$npx -y skills add adityahimaone/hermes-agent-rtk-caveman --skill notionNotion API for creating and managing pages, databases, and blocks via curl. Search, create, update, and query Notion workspaces directly from the terminal.
| 1 | # Notion API |
| 2 | |
| 3 | Use the Notion API via curl to create, read, update pages, databases (data sources), and blocks. No extra tools needed — just curl and a Notion API key. |
| 4 | |
| 5 | ## Prerequisites |
| 6 | |
| 7 | 1. Create an integration at https://notion.so/my-integrations |
| 8 | 2. Copy the API key (starts with `ntn_` or `secret_`) |
| 9 | 3. Store it in `~/.hermes/.env`: |
| 10 | ``` |
| 11 | NOTION_API_KEY=ntn_your_key_here |
| 12 | ``` |
| 13 | 4. **Important:** Share target pages/databases with your integration in Notion (click "..." → "Connect to" → your integration name) |
| 14 | |
| 15 | ## API Basics |
| 16 | |
| 17 | All requests use this pattern: |
| 18 | |
| 19 | ```bash |
| 20 | curl -s -X GET "https://api.notion.com/v1/..." \ |
| 21 | -H "Authorization: Bearer $NOTION_API_KEY" \ |
| 22 | -H "Notion-Version: 2025-09-03" \ |
| 23 | -H "Content-Type: application/json" |
| 24 | ``` |
| 25 | |
| 26 | The `Notion-Version` header is required. This skill uses `2025-09-03` (latest). In this version, databases are called "data sources" in the API. |
| 27 | |
| 28 | ## Common Operations |
| 29 | |
| 30 | ### Search |
| 31 | |
| 32 | ```bash |
| 33 | curl -s -X POST "https://api.notion.com/v1/search" \ |
| 34 | -H "Authorization: Bearer $NOTION_API_KEY" \ |
| 35 | -H "Notion-Version: 2025-09-03" \ |
| 36 | -H "Content-Type: application/json" \ |
| 37 | -d '{"query": "page title"}' |
| 38 | ``` |
| 39 | |
| 40 | ### Get Page |
| 41 | |
| 42 | ```bash |
| 43 | curl -s "https://api.notion.com/v1/pages/{page_id}" \ |
| 44 | -H "Authorization: Bearer $NOTION_API_KEY" \ |
| 45 | -H "Notion-Version: 2025-09-03" |
| 46 | ``` |
| 47 | |
| 48 | ### Get Page Content (blocks) |
| 49 | |
| 50 | ```bash |
| 51 | curl -s "https://api.notion.com/v1/blocks/{page_id}/children" \ |
| 52 | -H "Authorization: Bearer $NOTION_API_KEY" \ |
| 53 | -H "Notion-Version: 2025-09-03" |
| 54 | ``` |
| 55 | |
| 56 | ### Create Page in a Database |
| 57 | |
| 58 | ```bash |
| 59 | curl -s -X POST "https://api.notion.com/v1/pages" \ |
| 60 | -H "Authorization: Bearer $NOTION_API_KEY" \ |
| 61 | -H "Notion-Version: 2025-09-03" \ |
| 62 | -H "Content-Type: application/json" \ |
| 63 | -d '{ |
| 64 | "parent": {"database_id": "xxx"}, |
| 65 | "properties": { |
| 66 | "Name": {"title": [{"text": {"content": "New Item"}}]}, |
| 67 | "Status": {"select": {"name": "Todo"}} |
| 68 | } |
| 69 | }' |
| 70 | ``` |
| 71 | |
| 72 | ### Query a Database |
| 73 | |
| 74 | ```bash |
| 75 | curl -s -X POST "https://api.notion.com/v1/data_sources/{data_source_id}/query" \ |
| 76 | -H "Authorization: Bearer $NOTION_API_KEY" \ |
| 77 | -H "Notion-Version: 2025-09-03" \ |
| 78 | -H "Content-Type: application/json" \ |
| 79 | -d '{ |
| 80 | "filter": {"property": "Status", "select": {"equals": "Active"}}, |
| 81 | "sorts": [{"property": "Date", "direction": "descending"}] |
| 82 | }' |
| 83 | ``` |
| 84 | |
| 85 | ### Create a Database |
| 86 | |
| 87 | ```bash |
| 88 | curl -s -X POST "https://api.notion.com/v1/data_sources" \ |
| 89 | -H "Authorization: Bearer $NOTION_API_KEY" \ |
| 90 | -H "Notion-Version: 2025-09-03" \ |
| 91 | -H "Content-Type: application/json" \ |
| 92 | -d '{ |
| 93 | "parent": {"page_id": "xxx"}, |
| 94 | "title": [{"text": {"content": "My Database"}}], |
| 95 | "properties": { |
| 96 | "Name": {"title": {}}, |
| 97 | "Status": {"select": {"options": [{"name": "Todo"}, {"name": "Done"}]}}, |
| 98 | "Date": {"date": {}} |
| 99 | } |
| 100 | }' |
| 101 | ``` |
| 102 | |
| 103 | ### Update Page Properties |
| 104 | |
| 105 | ```bash |
| 106 | curl -s -X PATCH "https://api.notion.com/v1/pages/{page_id}" \ |
| 107 | -H "Authorization: Bearer $NOTION_API_KEY" \ |
| 108 | -H "Notion-Version: 2025-09-03" \ |
| 109 | -H "Content-Type: application/json" \ |
| 110 | -d '{"properties": {"Status": {"select": {"name": "Done"}}}}' |
| 111 | ``` |
| 112 | |
| 113 | ### Add Content to a Page |
| 114 | |
| 115 | ```bash |
| 116 | curl -s -X PATCH "https://api.notion.com/v1/blocks/{page_id}/children" \ |
| 117 | -H "Authorization: Bearer $NOTION_API_KEY" \ |
| 118 | -H "Notion-Version: 2025-09-03" \ |
| 119 | -H "Content-Type: application/json" \ |
| 120 | -d '{ |
| 121 | "children": [ |
| 122 | {"object": "block", "type": "paragraph", "paragraph": {"rich_text": [{"text": {"content": "Hello from Hermes!"}}]}} |
| 123 | ] |
| 124 | }' |
| 125 | ``` |
| 126 | |
| 127 | ## Property Types |
| 128 | |
| 129 | Common property formats for database items: |
| 130 | |
| 131 | - **Title:** `{"title": [{"text": {"content": "..."}}]}` |
| 132 | - **Rich text:** `{"rich_text": [{"text": {"content": "..."}}]}` |
| 133 | - **Select:** `{"select": {"name": "Option"}}` |
| 134 | - **Multi-select:** `{"multi_select": [{"name": "A"}, {"name": "B"}]}` |
| 135 | - **Date:** `{"date": {"start": "2026-01-15", "end": "2026-01-16"}}` |
| 136 | - **Checkbox:** `{"checkbox": true}` |
| 137 | - **Number:** `{"number": 42}` |
| 138 | - **URL:** `{"url": "https://..."}` |
| 139 | - **Email:** `{"email": "user@example.com"}` |
| 140 | - **Relation:** `{"relation": [{"id": "page_id"}]}` |
| 141 | |
| 142 | ## Key Differences in API Version 2025-09-03 |
| 143 | |
| 144 | - **Databases → Data Sources:** Use `/data_sources/` endpoints for queries and retrieval |
| 145 | - **Two IDs:** Each database has both a `database_id` and a `data_source_id` |
| 146 | - Use `database_id` when creating pages (`parent: {"database_id": "..."}`) |
| 147 | - Use `data_source_id` when querying (`POST /v1/data_sources/{id}/query`) |
| 148 | - **Search results:** Databases return as `"object": "data_source"` with their `data_source_id` |
| 149 | |
| 150 | ## Notes |
| 151 | |
| 152 | - Page/database IDs are UUIDs (with or without dashes) |
| 153 | - Rate limit: ~3 requests/second average |
| 154 | - Th |