notion
We drive the Notion API with
curl + jq. The user's OAuth bearer token is in $NOTION_TOKEN; every
call needs it plus the Notion-Version header.
Notion-Version is currently 2022-06-28 (the most recent stable). Bump
this header when Notion ships a new version.
The user's connection only sees the pages and databases they explicitly shared with the integration when they authorized. If a search or page read returns nothing, the most likely cause is "the page was never shared with the integration" — surface that hint to the user.
Recipes
Verify auth (always run first)
curl -sS https://api.notion.com/v1/users/me \
-H "Authorization: Bearer $NOTION_TOKEN" \
-H "Notion-Version: 2022-06-28" \
| jq '{id, name, type, bot: (.bot != null)}'
Search the workspace
curl -sS https://api.notion.com/v1/search \
-H "Authorization: Bearer $NOTION_TOKEN" \
-H "Notion-Version: 2022-06-28" \
-H "Content-Type: application/json" \
-d '{"query": "Q1 budget", "page_size": 10}' \
| jq '.results[] | {id, type: .object, url, title: (.properties.title // .properties.Name)?.title?[0]?.plain_text // .child_page?.title}'
Read a page (metadata only)
curl -sS "https://api.notion.com/v1/pages/PAGE_ID" \
-H "Authorization: Bearer $NOTION_TOKEN" \
-H "Notion-Version: 2022-06-28"
Read a page's full content
curl -sS "https://api.notion.com/v1/blocks/PAGE_ID/children?page_size=100" \
-H "Authorization: Bearer $NOTION_TOKEN" \
-H "Notion-Version: 2022-06-28" \
| jq '.results[] | {type, content: (.[.type] // {})}'
Append a paragraph to a page
curl -sS -X PATCH "https://api.notion.com/v1/blocks/PAGE_ID/children" \
-H "Authorization: Bearer $NOTION_TOKEN" \
-H "Notion-Version: 2022-06-28" \
-H "Content-Type: application/json" \
-d "$(jq -nc --arg text "Appended via the assistant." '
{children: [{
object: "block",
type: "paragraph",
paragraph: {rich_text: [{type:"text", text:{content:$text}}]}
}]}')"
Query a database
curl -sS -X POST "https://api.notion.com/v1/databases/DATABASE_ID/query" \
-H "Authorization: Bearer $NOTION_TOKEN" \
-H "Notion-Version: 2022-06-28" \
-H "Content-Type: application/json" \
-d '{
"filter": {"property": "Status", "select": {"equals": "Open"}},
"sorts": [{"property": "Updated", "direction": "descending"}],
"page_size": 25
}'
Create a page in a database
curl -sS -X POST "https://api.notion.com/v1/pages" \
-H "Authorization: Bearer $NOTION_TOKEN" \
-H "Notion-Version: 2022-06-28" \
-H "Content-Type: application/json" \
-d "$(jq -nc \
--arg db "DATABASE_ID" \
--arg title "New entry" \
'{
parent: {database_id: $db},
properties: {
Name: {title: [{text: {content: $title}}]},
Status: {select: {name: "Open"}}
}
}')"
Notes
- Notion's pagination is cursor-based: append
start_cursor=$cursorto paginate, using thenext_cursorfrom each response. Stop whenhas_moreisfalse. - Most write failures (400/404) come from a property type mismatch —
e.g. sending
{"select": "Open"}instead of{"select": {"name": "Open"}}. Read the database schema once viaGET /v1/databases/<id>if unsure.
More from acedatacloud/skills
luma-video
Generate AI videos with Luma Dream Machine via AceDataCloud API. Use when creating videos from text prompts, generating videos from reference images, extending existing videos, or any video generation task with Luma. Supports text-to-video, image-to-video, and video extension.
10short-url
Create short URLs via AceDataCloud API. Use when generating shortened links for sharing, or batch-creating multiple short URLs at once. Supports custom slugs and expiration.
9seedream-image
Generate and edit AI images with Seedream (ByteDance) via AceDataCloud API. Use when creating images from text prompts, editing existing images, or working with high-resolution outputs. Supports Seedream 3.0 T2I, 4.0, 4.5, 5.0, and SeedEdit 3.0 models.
9flux-image
Generate and edit images with Flux (Black Forest Labs) via AceDataCloud API. Use when creating images from text prompts, editing existing images with text instructions, or when high-quality image generation is needed. Supports multiple Flux models including dev, pro, ultra, and kontext for editing.
9veo-video
Generate AI videos with Google Veo via AceDataCloud API. Use when creating videos from text descriptions, animating still images into video, upscaling/extending videos, re-shooting with new camera motion, or inserting/removing objects. Supports Veo 2, Veo 3, and Veo 3.1 models including fast variants.
9sora-video
Generate AI videos with OpenAI Sora via AceDataCloud API. Use when creating videos from text prompts, generating videos from reference images, or using character references from existing videos. Supports text-to-video, image-to-video, and character-driven generation with multiple models and resolutions.
8