> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentium.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Notion

> Search, read, and create pages in Notion databases.

# Notion

Search pages, read content, create new pages, and query databases in Notion.

***

## Quick Start

```typescript theme={null}
import { Agent, openai, NotionToolkit } from "@agentium/core";

const notion = new NotionToolkit();
// Uses NOTION_API_KEY env var

const agent = new Agent({
  name: "notion-assistant",
  model: openai("gpt-4o"),
  instructions: "Help manage Notion pages and databases.",
  tools: [...notion.getTools()],
});

const result = await agent.run("Search for meeting notes from last week");
```

***

## Config

<ParamField body="token" type="string">
  Notion internal integration token. Falls back to `NOTION_API_KEY` env var.
</ParamField>

***

## Tools

| Tool                    | Description                                             |
| ----------------------- | ------------------------------------------------------- |
| `notion_search`         | Search Notion for pages and databases by title/content. |
| `notion_get_page`       | Get content of a page by ID (returns text blocks).      |
| `notion_create_page`    | Create a page in a database or as a child of a page.    |
| `notion_query_database` | Query a database with optional Notion filters.          |

***

## Setup

1. Create an [internal integration](https://www.notion.so/my-integrations)
2. Copy the integration token
3. Share your pages/databases with the integration (click "..." > "Connections" > add your integration)

***

## Environment Variables

```bash theme={null}
export NOTION_API_KEY="ntn_..."
```

***

## Tool Usage Examples

### Search Pages

```typescript theme={null}
const result = await agent.run("Find meeting notes from last week about the product roadmap");

// The agent calls notion_search with:
// { query: "product roadmap meeting notes" }
//
// Returns matching pages with titles, IDs, and snippets
```

### Create a Page

```typescript theme={null}
const result = await agent.run(
  "Create a new page in the Meeting Notes database titled 'Sprint Planning - Feb 26' " +
  "with sections for Attendees, Agenda, and Action Items"
);

// The agent calls notion_create_page with:
// {
//   parentDatabaseId: "abc123...",
//   title: "Sprint Planning - Feb 26",
//   content: "## Attendees\n\n## Agenda\n\n## Action Items\n"
// }
```

### Query Database

```typescript theme={null}
const result = await agent.run(
  "Show me all tasks in the Project Tracker database that are marked 'In Progress'"
);

// The agent calls notion_query_database with:
// {
//   databaseId: "def456...",
//   filter: { property: "Status", status: { equals: "In Progress" } }
// }
```

### Read Page Content

```typescript theme={null}
const result = await agent.run("Read the content of our API documentation page");

// The agent calls notion_search to find the page,
// then notion_get_page with the page ID
// Returns the full text content of the page
```
