All skills
intellectronica avatar

/notion-api

@7078194

This skill provides comprehensive instructions for interacting with the Notion API via REST calls. This skill should be used whenever the user asks to interact with Notion, including reading, creating, updating, or deleting pages, databases, blocks, comments, or any other Notion content. The skill covers authentication, all available endpoints, pagination, error handling, and best practices.

Use this Skill: https://skilld.dev/gh/intellectronica/agent-skills/notion-api

This session only. Nothing lands on disk.

referencesrich-text.md

≈2.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Notion Rich Text Reference

This document provides comprehensive documentation for rich text objects in the Notion API.

Rich Text Array Structure

Rich text in Notion is represented as an array of rich text objects. Each block or property that supports formatted text uses this structure:

{
  "rich_text": [
    {
      "type": "text",
      "text": {"content": "Hello "},
      "annotations": {"bold": false, "italic": false, "strikethrough": false, "underline": false, "code": false, "color": "default"},
      "plain_text": "Hello ",
      "href": null
    },
    {
      "type": "text",
      "text": {"content": "world", "link": {"url": "https://example.com"}},
      "annotations": {"bold": true, "italic": false, "strikethrough": false, "underline": false, "code": false, "color": "default"},
      "plain_text": "world",
      "href": "https://example.com"
    }
  ]
}

Common Fields

All rich text objects contain:

Field Type Description
type string The type of rich text object
annotations object Styling applied to the text
plain_text string Plain text without formatting
href string or null URL if the text is a link

Rich Text Types

Text

Basic text content with optional link:

{
  "type": "text",
  "text": {
    "content": "Link text",
    "link": {"url": "https://example.com"}
  },
  "annotations": { /* ... */ },
  "plain_text": "Link text",
  "href": "https://example.com"
}

Without link:

{
  "type": "text",
  "text": {
    "content": "Plain text"
  },
  "annotations": { /* ... */ },
  "plain_text": "Plain text",
  "href": null
}

Equation

Inline mathematical expressions using LaTeX/KaTeX:

{
  "type": "equation",
  "equation": {
    "expression": "E = mc^2"
  },
  "annotations": { /* ... */ },
  "plain_text": "E = mc^2",
  "href": null
}

Mention

References to other Notion objects or users.

User Mention
{
  "type": "mention",
  "mention": {
    "type": "user",
    "user": {
      "object": "user",
      "id": "user-uuid",
      "name": "John Doe",
      "avatar_url": "https://...",
      "type": "person",
      "person": {"email": "john@example.com"}
    }
  },
  "annotations": { /* ... */ },
  "plain_text": "@John Doe",
  "href": "https://www.notion.so/user-uuid"
}
Page Mention
{
  "type": "mention",
  "mention": {
    "type": "page",
    "page": {
      "id": "page-uuid"
    }
  },
  "annotations": { /* ... */ },
  "plain_text": "Page Title",
  "href": "https://www.notion.so/page-uuid"
}

Note: If the integration doesn't have access to the mentioned page, only the ID is returned.

Database Mention
{
  "type": "mention",
  "mention": {
    "type": "database",
    "database": {
      "id": "database-uuid"
    }
  },
  "annotations": { /* ... */ },
  "plain_text": "Database Title",
  "href": "https://www.notion.so/database-uuid"
}
Date Mention
{
  "type": "mention",
  "mention": {
    "type": "date",
    "date": {
      "start": "2024-01-15",
      "end": null,
      "time_zone": null
    }
  },
  "annotations": { /* ... */ },
  "plain_text": "January 15, 2024",
  "href": null
}

With date range:

{
  "type": "mention",
  "mention": {
    "type": "date",
    "date": {
      "start": "2024-01-15",
      "end": "2024-01-20",
      "time_zone": null
    }
  },
  "annotations": { /* ... */ },
  "plain_text": "January 15, 2024 → January 20, 2024",
  "href": null
}
Link Preview Mention
{
  "type": "mention",
  "mention": {
    "type": "link_preview",
    "link_preview": {
      "url": "https://github.com/..."
    }
  },
  "annotations": { /* ... */ },
  "plain_text": "https://github.com/...",
  "href": "https://github.com/..."
}
Template Mention (Date)

Used in template blocks for dynamic dates:

{
  "type": "mention",
  "mention": {
    "type": "template_mention",
    "template_mention": {
      "type": "template_mention_date",
      "template_mention_date": "today"
    }
  },
  "annotations": { /* ... */ },
  "plain_text": "@today",
  "href": null
}

Template date options: today, now

Template Mention (User)

Used in template blocks for dynamic user references:

{
  "type": "mention",
  "mention": {
    "type": "template_mention",
    "template_mention": {
      "type": "template_mention_user",
      "template_mention_user": "me"
    }
  },
  "annotations": { /* ... */ },
  "plain_text": "@me",
  "href": null
}

Annotations

Annotations control text styling:

{
  "annotations": {
    "bold": false,
    "italic": false,
    "strikethrough": false,
    "underline": false,
    "code": false,
    "color": "default"
  }
}
Property Type Description
bold boolean Bold text
italic boolean Italic text
strikethrough boolean Strikethrough text
underline boolean Underlined text
code boolean Inline code styling
color string Text or background color

Color Options

Text colors:

  • default
  • gray
  • brown
  • orange
  • yellow
  • green
  • blue
  • purple
  • pink
  • red

Background colors:

  • gray_background
  • brown_background
  • orange_background
  • yellow_background
  • green_background
  • blue_background
  • purple_background
  • pink_background
  • red_background

Creating Rich Text

Simple Text

[
  {
    "type": "text",
    "text": {"content": "Simple text"}
  }
]

Formatted Text

[
  {
    "type": "text",
    "text": {"content": "Bold and italic"},
    "annotations": {"bold": true, "italic": true}
  }
]

Mixed Formatting

[
  {"type": "text", "text": {"content": "Normal "}},
  {"type": "text", "text": {"content": "bold"}, "annotations": {"bold": true}},
  {"type": "text", "text": {"content": " and "}},
  {"type": "text", "text": {"content": "italic"}, "annotations": {"italic": true}},
  {"type": "text", "text": {"content": " text."}}
]

Text with Link

[
  {"type": "text", "text": {"content": "Check out "}},
  {
    "type": "text",
    "text": {"content": "this link", "link": {"url": "https://example.com"}}
  },
  {"type": "text", "text": {"content": " for more info."}}
]

Code Styling

[
  {"type": "text", "text": {"content": "Use the "}},
  {"type": "text", "text": {"content": "console.log()"}, "annotations": {"code": true}},
  {"type": "text", "text": {"content": " function."}}
]

Colored Text

[
  {
    "type": "text",
    "text": {"content": "Important!"},
    "annotations": {"color": "red", "bold": true}
  }
]

With Background Color

[
  {
    "type": "text",
    "text": {"content": "Highlighted text"},
    "annotations": {"color": "yellow_background"}
  }
]

User Mention

[
  {"type": "text", "text": {"content": "Assigned to "}},
  {
    "type": "mention",
    "mention": {
      "type": "user",
      "user": {"id": "user-uuid"}
    }
  }
]

Page Mention

[
  {"type": "text", "text": {"content": "See also: "}},
  {
    "type": "mention",
    "mention": {
      "type": "page",
      "page": {"id": "page-uuid"}
    }
  }
]

Date Mention

[
  {"type": "text", "text": {"content": "Due: "}},
  {
    "type": "mention",
    "mention": {
      "type": "date",
      "date": {"start": "2024-12-31"}
    }
  }
]

Inline Equation

[
  {"type": "text", "text": {"content": "The formula is "}},
  {"type": "equation", "equation": {"expression": "x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}"}},
  {"type": "text", "text": {"content": "."}}
]

Limits

Type Limit
Rich text content 2000 characters per rich text object
Rich text array 100 items max
Equations 1000 characters

Reading Rich Text

When processing rich text from API responses, you can:

  1. Get plain text: Concatenate all plain_text values
  2. Preserve formatting: Process each object and apply annotations
  3. Extract links: Check href field or text.link.url

Example (JavaScript):

function getPlainText(richTextArray) {
  return richTextArray.map(rt => rt.plain_text).join('');
}

function getLinks(richTextArray) {
  return richTextArray
    .filter(rt => rt.href)
    .map(rt => ({text: rt.plain_text, url: rt.href}));
}

Example (bash with jq):

# Get plain text
echo "$rich_text_json" | jq -r '[.[].plain_text] | join("")'

# Get all links
echo "$rich_text_json" | jq '[.[] | select(.href != null) | {text: .plain_text, url: .href}]'

Source: SKILL.md on GitHub

2 warnings17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill provides a standard and well-documented interface for interacting with the Notion API using curl and jq. It follows security best practices by recommending environment variables for tokens and requiring user confirmation for destructive operations. The only identified risk is the potential for indirect prompt injection from external data retrieved from Notion workspaces, which is a common vulnerability for skills processing external content.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: MEDIUM · 1 issue

  • Runlayer7mo

    5/5 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 7078194. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 8 months ago
  • API
  • notion
  • rest
  • curl
  • authentication
  • pages
  • databases
  • blocks
  • pagination

README badge

README badge for intellectronica/agent-skills/notion-api

Enables REST API interactions with Notion workspaces via curl and custom scripts—covering authentication, all endpoints for pages, blocks, databases, data sources, users, and comments, plus rate limits and request size constraints. Use this skill when the user asks to read, create, update, or delete Notion content, including handling of API key management and confirmation for destructive operations.

Generated from the current SKILL.md.

What Notion API version does this skill use?
The skill uses API version 2025-09-03, which is required in the Notion-Version header for all requests.
How should I provide my Notion API key to the skill?
The skill checks for NOTION_API_TOKEN in the environment first, then accepts a user-provided key. It will ask you for the key if neither is available. Never display or log the token outside the Authorization header.
Does this skill handle rate limiting?
The skill documents the 3 requests per second limit and 429 responses, and recommends implementing exponential backoff when rate limited. You must implement the backoff logic in your requests.
What happens when I try to modify or delete Notion content?
The skill requires you to confirm any destructive operation (updates, deletes, archives, schema changes) before executing it. A single confirmation covers a logical group of related operations.
Can this skill work with data sources in the latest Notion API?
Yes, the skill covers data sources as of API version 2025-09-03, including how to create them as individual tables within a database.

Generated from the current SKILL.md. These answers refresh after source changes.