Notion API - Database & Page Automation avatar
Notion API - Database & Page Automation

Pricing

Pay per event

Go to Apify Store
Notion API - Database & Page Automation

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

John Rippy

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

5 days ago

Last modified

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

  1. Go to notion.so/my-integrations
  2. Click "+ New integration"
  3. Give it a name (e.g., "Apify Automation")
  4. Select the workspace you want to connect
  5. Click Submit
  6. 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:

  1. Open the Notion page or database you want to access
  2. Click "..." (three dots) in the top right
  3. Click "Connect to" → Select your integration
  4. 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

ParameterTypeRequiredDescription
taskstringYesOperation to perform (see tasks below)
accessTokenstringYes*Notion integration token (*not needed for demoMode)
databaseIdstringNoDatabase ID for database operations
pageIdstringNoPage ID for page operations
blockIdstringNoBlock ID for block operations
searchQuerystringNoSearch text for search task
searchFilterstringNoFilter by 'page' or 'database'
filterobjectNoDatabase filter (JSON)
sortsarrayNoDatabase sort configuration
pageTitlestringNoTitle for new page
propertiesobjectNoProperties for create/update
contentarrayNoBlock content array
batchPagesarrayNoPages for batch creation
webhookUrlstringNoURL for webhook delivery
demoModebooleanNoRun 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:

  1. Open the Notion page or database
  2. Click "...""Connect to" → Select your integration
  3. The page must be explicitly shared with your integration

"Invalid token" or "Unauthorized" error

Cause: Your access token is wrong or expired. Fix:

  1. Go to notion.so/my-integrations
  2. Click your integration and copy the token again
  3. 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_database task 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:

OperationCost
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