Notion

From vargasjr-dev/mycadet-temp · View interactive version

Notion is an AI agent skill from the GitHub repository vargasjr-dev/mycadet-temp. Read and write Notion pages and databases using the Notion API

How to use this skill

Skill file

You have access to the Notion API via the cloud OAuth connection or an internal integration secret stored in the credential vault. Both paths inject the Authorization header automatically. Never reveal credential values or echo token values into the shell.

Authentication

Step 1 - Determine connection type:

assistant credentials list

Look at the results to decide which path to use:

Step 2 - Make authenticated API calls:

Choose the path that matches what you found in Step 1.


Path A. Managed OAuth (preferred)

Use assistant oauth request --provider notion. The Authorization header is injected automatically; do not supply it manually.

assistant oauth request --provider notion \
  -X POST \
  -H "Notion-Version: 2022-06-28" \
  -H "Content-Type: application/json" \
  -d '{}' \
  https://api.notion.com/v1/search

General shape: assistant oauth request --provider notion -X <METHOD> -H "Notion-Version: 2022-06-28" [-H "Content-Type: application/json"] [-d '<json-body>'] <url>


Path B. Proxied bash with credential auto-injection

Note: The standard Notion setup flow (cadet-oauth-integrations) does not currently produce credentials with the metadata required by this path. Most users should use Path A instead. Path B is documented for credentials that have been manually configured with the required metadata.

For internal integration secrets registered with allowedTools: ["bash"] and an injection_templates entry for api.notion.com. The proxy adds Authorization: Bearer <token> automatically. Do not include an Authorization header in the curl command.

bash:
  network_mode: proxied
  credential_ids: ["<credential_id_from_step_1>"]
  command: |
    curl -s -X POST https://api.notion.com/v1/search \
      -H "Notion-Version: 2022-06-28" \
      -H "Content-Type: application/json" \
      -d '{}'

Where <credential_id_from_step_1> is the id field from the matching entry in assistant credentials list output.

The credential MUST have:

If these are missing, you will get a credential tool policy denied error. Switch to Path A instead.


All Notion API calls go to https://api.notion.com/v1/. Always include the Notion-Version: 2022-06-28 header.

Reading Pages

Get a page by ID

GET https://api.notion.com/v1/pages/{page_id}

Returns page properties. Use the page ID from a Notion URL - the last segment of the URL, e.g. for https://notion.so/My-Page-abc123def456 the ID is abc123def456 (formatted as UUID: abc123de-f456-...).

Get page content (blocks)

GET https://api.notion.com/v1/blocks/{block_id}/children?page_size=100

Pages are blocks too - use the page ID as the block_id. Iterates through the page's child blocks. Use start_cursor for pagination when has_more is true.

Block types and how to render them:

Searching

Search pages and databases

POST https://api.notion.com/v1/search
{
  "query": "your search term",
  "filter": { "value": "page", "property": "object" },
  "sort": { "direction": "descending", "timestamp": "last_edited_time" },
  "page_size": 10
}

Omit filter to search both pages and databases. Use filter.value: "database" to search only databases.

Returns results[] with id, url, properties.title (for pages), and title[] (for databases).

Reading Databases

Get database metadata

GET https://api.notion.com/v1/databases/{database_id}

Returns the database schema (all property definitions).

Query a database

POST https://api.notion.com/v1/databases/{database_id}/query
{
  "filter": {
    "property": "Status",
    "select": { "equals": "In Progress" }
  },
  "sorts": [
    { "property": "Created", "direction": "descending" }
  ],
  "page_size": 20
}

Omit filter to retrieve all rows. Returns results[] where each item is a page (database row).

Extracting property values from database rows:

Creating Pages

Create a new page

POST https://api.notion.com/v1/pages
{
  "parent": { "page_id": "<parent_page_id>" },
  "properties": {
    "title": {
      "title": [{ "text": { "content": "My New Page" } }]
    }
  },
  "children": [
    {
      "object": "block",
      "type": "paragraph",
      "paragraph": {
        "rich_text": [{ "text": { "content": "Page content here." } }]
      }
    }
  ]
}

For database rows, use "parent": { "database_id": "<database_id>" } and include the database's required properties.

Updating Pages

Update page properties

PATCH https://api.notion.com/v1/pages/{page_id}
{
  "properties": {
    "Status": { "select": { "name": "Done" } },
    "Due": { "date": { "start": "2024-12-31" } }
  }
}

Append blocks to a page

PATCH https://api.notion.com/v1/blocks/{block_id}/children
{
  "children": [
    {
      "object": "block",
      "type": "paragraph",
      "paragraph": {
        "rich_text": [{ "text": { "content": "Appended content." } }]
      }
    },
    {
      "object": "block",
      "type": "heading_2",
      "heading_2": {
        "rich_text": [{ "text": { "content": "A heading" } }]
      }
    },
    {
      "object": "block",
      "type": "bulleted_list_item",
      "bulleted_list_item": {
        "rich_text": [{ "text": { "content": "A bullet point" } }]
      }
    },
    {
      "object": "block",
      "type": "to_do",
      "to_do": {
        "rich_text": [{ "text": { "content": "A task" } }],
        "checked": false
      }
    }
  ]
}

Update a block's content

PATCH https://api.notion.com/v1/blocks/{block_id}
{
  "paragraph": {
    "rich_text": [{ "text": { "content": "Updated text." } }]
  }
}

Delete (archive) a block

DELETE https://api.notion.com/v1/blocks/{block_id}

Archive / Delete Pages

Notion does not permanently delete pages via the API - it archives them:

PATCH https://api.notion.com/v1/pages/{page_id}
{
  "archived": true
}

Pagination

When a response includes "has_more": true, pass "start_cursor": response.next_cursor in the next request to get the next page of results.

Error Handling

Tips

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.