# Notion

> Connect a Notion workspace to FlyMyAI agents.

Lets an agent read, search, and update Notion pages and databases in a
workspace you control.

## What it can do

| Method | What it does |
| --- | --- |
| `notion_search` | Search pages/databases in Notion workspace. |
| `notion_get_page` | Get Notion page metadata and optional first-level children. |
| `notion_create_page` | Create a page in Notion under parent page id. |
| `notion_append_text` | Append plain text paragraph to Notion page. |
| `notion_query_database` | Query database rows - POST /v1/databases/{id}/query with filter, sorts, pagination. |
| `notion_update_page` | Patch a page or a database row by page_id; pass properties matching the column schema. |
| `notion_create_database_page` | Create a row in a database - POST /v1/pages with parent.database_id and properties. |

## How to get credentials

Notion uses a workspace integration token.

1. Go to [notion.so/profile/integrations](https://www.notion.so/profile/integrations)
   and click **New integration**.
2. Give it a name (e.g. "FlyMyAI Agent"), pick the workspace, and set the
   type to **Internal**.
3. Under **Capabilities**, enable at least *Read content*, *Update
   content*, *Insert content*, plus any user-info scope you need.
4. Click **Save**. On the next screen copy the **Internal Integration
   Secret** - it starts with `secret_` or `ntn_`.
5. Open any page or database you want the agent to touch, click **…** →
   **Connections** → **Add connections**, and select your new
   integration. Notion only exposes pages that are explicitly shared with
   the integration.

## Fields to fill in FlyMyAI

| FlyMyAI field | Where it comes from |
| --- | --- |
| `Notion API token` | The *Internal Integration Secret* from step 4. |

## Troubleshooting

- **`unauthorized` or `object_not_found`** - the page isn't shared with
  the integration. Share it from the page's **Connections** menu.
- **`restricted_resource`** - the integration is missing the capability
  the agent tried to use. Re-open the integration settings and enable the
  missing scope.
- **Token rotated** - paste the new secret in FlyMyAI; the old one stops
  working immediately.

## Links

- [Notion integrations dashboard](https://www.notion.so/profile/integrations)
- [Notion API reference](https://developers.notion.com/reference/intro)
