Notioneer is a Python toolkit that automates the flow of structured data between LLMs and Notion. It lets you generate, validate, and insert entries (like tasks, projects, goals) into Notion databases using JSON dumps produced by an LLM, all while ensuring schema compliance and relation resolution. The project was developed for personal use but is open-sourced for anyone interested in similar workflows. Use at your own risk.
- 🔄 Schema-driven validation – every entry conforms to Notion’s database schema.
- 🧩 Relation handling with
temp_id– create interlinked tasks and projects without knowing page IDs. - 📦 Database export & schema generation – automatically pull schemas and entries from Notion.
- ✍️ Instruction merging – build LLM-ready instructions with embedded schema contracts.
- ⚡ Block operations – append, insert, replace, update, or delete Notion blocks on the fly.
With Notioneer, you can design workflows where an LLM generates structured actions, and they’re safely executed in Notion without breaking consistency.
Clone the repository and install dependencies:
git clone https://github.com/YOUR_USERNAME/notioneer.git
cd notioneer
pip install .There are three global variables that you can set:
CONFIG_PATH(default:config.json) – path to your config file.SCHEMA_DIR(default:schemas/) – directory to store generated schemaEXPORT_DIR(default:exports/) – directory to store exported entries
There are two ways to set up configuration via config.json:
-
Provide your token and a first database Example
config.json:{ "notion_token": "secret_123", "databases": { "tasks": { "database_id": "abcd-1234-efgh-5678", "schema": "tasks_schema.json", "output": "exported_tasks.json", "filter": { // optional "property": "Status", "status": { "does_not_equal": "Done" } }, "required": [], // optional "icon": { // optional "type": "external", "external": { "url": "https://www.notion.so/icons/checkmark_orange.svg" } } } } }In the field
filteryou can specify a filter according to Notion's API. See the docs for details.In the field
requiredyou can specify a list of properties that must be present in the database entries. This is useful to ensure that certain fields are always filled when creating or updating entries. -
Provide just your integration token Then, bootstrap schemas by providing a database ID directly when calling the schema generator:
Example
config.json:{ "notion_token": "secret_123" }Example command:
python scripts/generate_schemas.py <DATABASE_ID>
👉 In both cases, notion_token must be your Notion integration token.
See Notion’s API docs for how to create one.
To get started, follow this setup flow:
This step fetches schema definitions for your database(s). If only a token is provided in config.json, you must supply a database ID. Otherwise, you can supply database names to restrict which schemas to generate:
python scripts/generate_schemas.py <DATABASE_ID> OR [database_name ...]The database ID can be found in the URL of your Notion database or via the Notion API. E.g., https://www.notion.so/<DATABASE_ID>?v=....
The base instructions are in docs/base_instructions.md. They contain general rules for the LLM to follow. In order to ensure the LLM knows the exact schema of your Notion databases, you need to merge these with the generated schema definitions. You can specify which schemas to include by passing their safe names as arguments:
python scripts/generate_instructions.py [database_name ...]This produces instructions.md, which contains both the general rules and the specific schemas.
There are two main workflows:
-
Provide the
instructions.mdfile to the LLM. -
Ask it to generate a
dump.jsoncontaining new entries (tasks, projects, etc.). -
Apply the entries into Notion. The script will by default expect
dump.jsonin the current directory, but you can specify a different path:python scripts/dump_entries.py <DUMP_FILE_PATH>
-
First, export existing entries. The script will by default export all known databases, but you can specify which ones to export by passing their safe names as arguments:
python scripts/fetch_entries.py [database_name ...]
-
Provide both
instructions.mdand the exported JSON (e.g.,exported_tasks.json) to the LLM. -
The LLM can then generate updates (with
page_id) or new entries that reference existing items. -
Apply the updates/new entries:
python scripts/dump_entries.py <DUMP_FILE_PATH>
This makes it possible to:
- Start fresh with new entries, or
- Work incrementally by providing the LLM with current data and asking for modifications or extensions.
Notioneer does currently support deletions only for content blocks within a page. If you want to remove entries, you must do so manually in Notion.
Also, database exports from the fetch_entries script can become large (i.e., 100k+ lines of JSON) if your databases contain many entries. Be mindful of token limits when providing this data to an LLM and the context window size.
The base instructions can be customized to fit your specific use case. You might want to:
- Add more examples of desired entries.
- Specify particular workflows or rules for how entries should be created or linked.
- Tailor the language model’s behavior to better suit your needs.
Notioneer/
├── notioneer/ # Core package
│ ├── __init__.py
│ ├── api.py
│ ├── operations.py
│ ├── schema_utils.py
│ ├── schemas.py
│ └── generate_schemas.py
│
├── scripts/ # CLI entry points
│ ├── dump_entries.py
│ ├── fetch_entries.py
│ ├── generate_schemas.py
│ └── generate_instructions.py
│
├── docs/
│ └── base_instructions.md
│
├── config.json # Example config (dummy values only)
├── requirements.txt
├── setup.py
├── README.md
├── LICENSE
├── .gitignore
└── .gitattributes
-
Generate schemas from your Notion DB
python scripts/generate_schemas.py projects tasks
-
Merge instructions for your LLM
python scripts/generate_instructions.py
-
Use the instructions (and optionally exported data) with your LLM to produce a
dump.json. -
Insert or update those entries in Notion:
python scripts/dump_entries.py dump.json
-
Verify results by exporting again:
python scripts/fetch_entries.py projects tasks
MIT License — see LICENSE.
Pull requests are welcome! For major changes, please open an issue first to discuss what you’d like to change.
- Notion API Reference
- Notion Python SDK (alternative library)