Notion API - Database & Page Automation
Pricing
Pay per event
Notion API - Database & Page Automation
Automate your Notion workspace with the official API. Query databases, create and update pages, manage blocks, search content, and sync data. Perfect for CMS automation, content pipelines, project management, and knowledge base workflows.
Pricing
Pay per event
Rating
0.0
(0)
Developer

John Rippy
Actor stats
0
Bookmarked
2
Total users
1
Monthly active users
5 days ago
Last modified
Categories
Share
Automate Notion workspaces with the official API. Query databases, create/update pages, manage blocks, search content, and sync data. Perfect for CMS automation, content pipelines, and knowledge base management. Built by John Rippy (https://www.linkedin.com/in/johnrippy/).
How to Get Your Notion Integration Token
- Go to notion.so/my-integrations
- Click "+ New integration"
- Give it a name (e.g., "Apify Automation")
- Select the workspace you want to connect
- Click Submit
- Copy your Internal Integration Token (starts with
secret_)
⚠️ IMPORTANT: Connect Pages to Your Integration
After creating the integration, you must explicitly share pages/databases with it:
- Open the Notion page or database you want to access
- Click "..." (three dots) in the top right
- Click "Connect to" → Select your integration
- Repeat for each page/database you need access to
Without this step, you'll get "Object not found" errors!
Features
Database Operations
- Query Database - Filter and sort database entries
- Get Database - Retrieve database schema and properties
- Create Database - Create new databases with custom properties
- Update Database - Modify database title and properties
Page Management
- Get Page - Retrieve page properties
- Create Page - Create new pages in databases or as subpages
- Update Page - Modify page properties
- Batch Create - Create multiple pages in one run
Block Operations
- Get Block - Retrieve block content
- Get Block Children - List child blocks (page content)
- Append Blocks - Add content to pages
- Update Block - Modify block content
- Delete Block - Remove blocks
Search & Discovery
- Search - Find pages and databases by title
User & Comments
- List Users - Get workspace members
- Get User - Retrieve user details
- List Comments - Get page/block comments
- Create Comment - Add comments to pages
Quick Start
Try it first (Free - Demo Mode)
{"demoMode": true,"task": "query_database"}
This returns sample Notion data so you can see the output format without charges.
Query a Database
{"accessToken": "secret_XXXXXXXXXXXXXXXXXXXXXXXXX","task": "query_database","databaseId": "12345678abcd1234abcd1234abcd1234","demoMode": false}
Create a Page in a Database
{"accessToken": "secret_XXXXXXXXXXXXXXXXXXXXXXXXX","task": "create_page","databaseId": "12345678abcd1234abcd1234abcd1234","properties": {"Name": {"title": [{"text": {"content": "New Task"}}]},"Status": {"select": {"name": "To Do"}}},"demoMode": false}
Search for Pages
{"accessToken": "secret_XXXXXXXXXXXXXXXXXXXXXXXXX","task": "search","searchQuery": "project roadmap","searchFilter": "page","demoMode": false}
Where to find your Database ID:
- Open the database in Notion as a full page
- Look at the URL:
notion.so/Your-Database-Name-12345678abcd1234abcd1234abcd1234 - The 32-character ID at the end is your database ID (ignore dashes)
Demo Mode
Set demoMode: true to test with sample data (no charges). When you're ready for real results, set demoMode: false or omit it.
{"demoMode": true,...}
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| task | string | Yes | Operation to perform (see tasks below) |
| accessToken | string | Yes* | Notion integration token (*not needed for demoMode) |
| databaseId | string | No | Database ID for database operations |
| pageId | string | No | Page ID for page operations |
| blockId | string | No | Block ID for block operations |
| searchQuery | string | No | Search text for search task |
| searchFilter | string | No | Filter by 'page' or 'database' |
| filter | object | No | Database filter (JSON) |
| sorts | array | No | Database sort configuration |
| pageTitle | string | No | Title for new page |
| properties | object | No | Properties for create/update |
| content | array | No | Block content array |
| batchPages | array | No | Pages for batch creation |
| webhookUrl | string | No | URL for webhook delivery |
| demoMode | boolean | No | Run with sample data (default: true) |
Output Format
Results are saved to the default dataset:
Query Result
{"task": "query_database","success": true,"pages": [{"id": "abc123...","url": "https://notion.so/...","properties": {"Name": { "title": [{ "plain_text": "Project Alpha" }] },"Status": { "select": { "name": "In Progress" } }}}],"total": 15,"databaseId": "xyz789..."}
Page Created
{"task": "create_page","success": true,"page": {"id": "new123...","url": "https://notion.so/...","created_time": "2025-01-10T12:00:00.000Z"}}
Common Problems & Solutions
"Object not found" error
Cause: Your integration doesn't have access to the page/database. Fix:
- Open the Notion page or database
- Click "..." → "Connect to" → Select your integration
- The page must be explicitly shared with your integration
"Invalid token" or "Unauthorized" error
Cause: Your access token is wrong or expired. Fix:
- Go to notion.so/my-integrations
- Click your integration and copy the token again
- Make sure you copied the full token starting with
secret_
"validation_error" when creating pages
Cause: The properties don't match the database schema. Fix:
- Property names are case-sensitive and must match exactly
- Each property type requires a specific format (title, select, date, etc.)
- Use the
get_databasetask first to see the correct property structure
"Could not find database" error
Cause: The database ID is incorrect or the database is not shared with your integration. Fix:
- Double-check the database ID from the URL
- Make sure the database is connected to your integration
Demo data showing instead of real results
Cause: demoMode is still set to true.
Fix: Set demoMode: false and provide your accessToken.
Pricing
This actor uses pay-per-event billing:
| Operation | Cost |
|---|---|
| Search | $0.01 |
| Query database | $0.02 |
| Get database/page/block | $0.01 |
| Create database | $0.05 |
| Create page | $0.03 |
| Update database/page/block | $0.02 |
| Delete block | $0.01 |
| Append blocks | $0.02 |
| List users/comments | $0.01 |
| Create comment | $0.02 |
| Batch create (per page) | $0.03 |
Use Cases
CMS & Content Management
- Sync blog posts from Notion to website
- Auto-publish content based on status
- Update metadata across pages
Project Management
- Create tasks from external sources
- Update project statuses automatically
- Generate reports from databases
Knowledge Base
- Search and retrieve documentation
- Auto-organize content
- Sync with external systems
Data Pipelines
- Import data to Notion databases
- Export Notion data for analysis
- Sync between Notion and other tools
Automation Workflows
- Trigger actions on database changes
- Create pages from form submissions
- Update records from API calls
Built by John Rippy | Actor Arsenal