{"data":{"slug":"discovered-cfb67182af82367553df7abbb7b7b3f5cebf5a8f3a9696f9","title":"Notion API Integration","summary":"Interact with Notion through MCP or the internal v3 API for advanced operations like select-option recolour, reminders, grouped views, and bulk writes. Use this skill to read or write Notion pages, databases, rows, schemas, or views, or when an MCP plugin call fails or does nothing.","url":"https:\/\/skillshunter.net\/skills\/discovered-cfb67182af82367553df7abbb7b7b3f5cebf5a8f3a9696f9","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-cfb67182af82367553df7abbb7b7b3f5cebf5a8f3a9696f9","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-cfb67182af82367553df7abbb7b7b3f5cebf5a8f3a9696f9.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-cfb67182af82367553df7abbb7b7b3f5cebf5a8f3a9696f9\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure the Toolbox tooling is installed and the Notion token is present in Doppler. Use a subshell and heredoc for Python scripts, and set `PYTHONIOENCODING=utf-8` on Windows to handle non-ASCII characters properly.","instructions":"---\nname: notion\ndescription: >-\n  Work with Notion through MCP, or the internal v3 API (token_v2, \/api\/v3\/) for what MCP cannot do: select-option recolour, reminders, grouped views, bulk writes.\n  TRIGGER when: reading or writing Notion pages, databases, rows, schemas or views; an\n  mcp__plugin_Notion_notion__* call failed, was rejected or did nothing; or changing how a Notion table\n  looks.\n  DO NOT TRIGGER for Notion-bound prose with no API call, or a database a task skill owns\n  (flightradar24, update-conventions).\n---\n\n# Notion: two APIs, one decision table\n\nNotion is reachable two ways, and picking wrong is the usual failure. **Default to MCP.** Drop to the\ninternal v3 API only for an operation on the closed list in *Which surface* \u2014 not on the first error.\n\n## Context\n- Toolbox tooling: !`python -c \"import notion_tools,pathlib;print(pathlib.Path(notion_tools.__file__).resolve().parents[3])\" 2>\/dev\/null || echo MISSING`\n- Notion token: !`T=$(python -c \"import notion_tools,pathlib;print(pathlib.Path(notion_tools.__file__).resolve().parents[3])\" 2>\/dev\/null) && ( cd \"$T\" && doppler secrets --only-names 2>\/dev\/null | grep -q NOTION_TOKEN_V2 && echo PRESENT || echo MISSING ) || echo NO-TOOLING`\n\nIf **Toolbox tooling** is `MISSING`, only the MCP half of this skill is available: the v3 client is the\n`notion_tools` package from the user's `toolbox` repo, installed with `pip install -e .`. If **Notion\ntoken** is `MISSING`, v3 cannot authenticate \u2014 see *Running a v3 call* below.\n\n## Which surface\n\n| Operation | Surface | Why |\n|---|---|---|\n| Read rows, filter, aggregate | **MCP** `notion-query-data-sources` | Real SQL. Avoids the v3 view-id trap entirely. |\n| Read a page, resolve ancestry, get inline image URLs | **MCP** `notion-fetch` | Returns pre-signed S3 image URLs needing no cookie \u2014 v3 needs the proxy dance. |\n| Edit page properties (under ~50 rows) | **MCP** `notion-update-page` | Safer, no transaction to hand-assemble. |\n| Create a database with a simple schema | **MCP** `notion-create-database` | One DDL string vs. hand-building collection + block + `listAfter`. |\n| Create\/repoint a view (coarse config) | **MCP** `notion-create-view` \/ `notion-update-view` | Type, name, `CALENDAR BY`, `SORT BY` all work. |\n| Create rows in bulk (plain values) | **MCP** `notion-create-pages` | Takes up to 100 rows under one parent per call \u2014 twice v3's batch. |\n| Comments, teamspaces | **MCP** only | v3 has no comment endpoint, and v3 `getTeams` is dead. |\n| Enumerate workspace users | **MCP** `notion-get-users` | Cursor-paginated, lists guests. v3 reads a single `notion_user` via `syncRecordValues` but cannot list members. |\n| **Recolor or remove a select option** | **v3** | MCP columns can be added\/dropped\/renamed, but its *options* are add-only: `Cannot update color of select with name: X`. |\n| **Date format on a column** | **v3** | Schema-level `date_format`; not exposed by MCP. |\n| **Date reminders** | **v3** | Lives inside the date property value. |\n| **Conditional row colours \/ banding** | **v3** | `format.conditional_color_rules` on the view. |\n| **Column widths, group entries** | **v3** | `format.table_properties[i].width` and the `format.collection_groups` array. Plain grouping and property visibility are **MCP** \u2014 `GROUP BY` \/ `SHOW` \/ `HIDE`. |\n| **Trash a row, page or view** | **v3** | MCP has no verb that trashes an individual row, page or view \u2014 though it *is* destructive elsewhere, see **MCP is not the safe surface**. |\n| **Bulk row edits (50+), or rows needing rich-text values** | **v3** | `notion-update-page` is one call per page; v3 batches ~50 per transaction. |\n\nTwo things are impossible on **both** surfaces \u2014 stop looking: **column text alignment** (every field\nname persists, none renders; it is UI-only) and **enabling Sub-items** (a UI toggle; afterwards the\npaired relation properties *are* writable via v3).\n\n**MCP is not the safe surface.** It has no verb for trashing a row, page or view, but three of its\ncalls destroy data: `notion-update-data-source` with `in_trash: true` (\"cannot be undone without\nNotion UI\") or `DROP COLUMN` (wipes that column on every row), and `notion-update-page` with\n`allow_deleting_content: true` on `replace_content` **or** `update_content` (deletes child pages and\ndatabases missing from the new content). Confirm those with the user exactly as you would a v3 delete.\n\n## Running a v3 call from any project\n\n`notion_tools` is an editable install, so it imports from any cwd \u2014 but the token comes from Doppler,\nwhich is bound to the toolbox directory. Derive that directory and run there:\n\n```bash\nTOOLBOX=\"$(python -c \"import notion_tools,pathlib;print(pathlib.Path(notion_tools.__file__).resolve().parents[3])\")\"\n( cd \"$TOOLBOX\" && PYTHONIOENCODING=utf-8 doppler run -- python <<'EOF'\nfrom notion_tools.client import create_client\nc = create_client()\n...\nEOF\n)\n```\n\nUse a subshell so the `cd` does not follow you back and misdirect later file writes. Always a heredoc,\nnever `python -c`. `PYTHONIOENCODING=utf-8` is not optional on Windows \u2014 Notion values carry `\u2192`, the\nreminder marker `\u2023` and non-ASCII titles, and the default console codec crashes the script.\n\nIf the token is missing, `create_client()` exits with instructions; the fix is `doppler login && doppler\nsetup` in the toolbox repo, not a config file. There is deliberately no on-disk fallback.\n\n## Anatomy of a v3 call\n\n`NotionClient.post(endpoint, data)` prefixes bare names with `\/api\/v3\/` and returns a raw\n`requests.Response`.\n\n**Reading** \u2014 `syncRecordValues` for known ids, `queryCollection` for rows. Every record arrives inside\na permission envelope, `{\"value\": {\"role\": ..., \"value\": {...}}}`. Reading one level too few raises\n`KeyError` on every field. Use the shared helper:\n\n```python\nfrom notion_tools.client import create_client, unwrap_record\nrec = unwrap_record(resp[\"recordMap\"][\"block\"][block_id])\n```\n\n**Writing** \u2014 one `saveTransactionsFanout` call carries many operations:\n\n```python\nc.post(\"saveTransactionsFanout\", {\"requestId\": str(uuid.uuid4()), \"transactions\": [\n    {\"id\": str(uuid.uuid4()), \"spaceId\": SPACE, \"debug\": {\"userAction\": \"<label>\"},\n     \"operations\": [{\"id\": TARGET, \"table\": \"collection\", \"path\": [\"schema\", key, \"options\"],\n                     \"command\": \"set\", \"args\": value}]}]}).raise_for_status()\n```\n\nFour commands cover everything: `set` (write at `path`), `update` (merge at the record root, e.g.\n`{\"alive\": False}`), `listAfter` (append an id into a `content` array), `listRemove` (detach one).\n\n## Non-negotiables\n\n- **Check the status before `.json()`.** Retired endpoints answer `404` with an HTML body, so `.json()`\n  raises a bare `JSONDecodeError` that looks like a parse bug rather than a dead endpoint.\n- **`client.post` never raises.** It has no `raise_for_status()`, so a 400 reads as success. Call\n  `.raise_for_status()` on every write, and on failure print `r.text` \u2014 the useful detail is only there.\n- **Writes are not idempotent.** Every `requestId`, transaction id and new record id is a client-side\n  `uuid4`, so a re-run duplicates rather than reconciling. Anything resumable needs a dedup key read\n  back from the collection or a state file.\n- **Confirm before anything destructive**, and prefer `alive: False` (recoverable for 30 days) over\n  `permanentlyDelete`. A botched write is often recoverable \u2014 see `references\/reading-data.md`.\n- **No request sets a timeout, and you cannot add one at the call site.** `NotionClient.post` takes\n  only `(endpoint, data)` and forwards no `timeout`, so a hung call blocks forever. For a long job go\n  through `c.session.post(url, json=..., timeout=...)` directly.\n\n## Verified endpoint status\n\nConfirmed live on 2026-08-16. Notion retires v3 endpoints without notice \u2014 re-probe before trusting an\nold recipe (`references\/reading-data.md` has the probe).\n\n| Alive | Retired (404) |\n|---|---|\n| `loadUserContent`, `getSpaces`, `syncRecordValues`, `queryCollection`, `loadPageChunk`, `search`, `saveTransactionsFanout`, `getActivityLog`, `getUploadFileUrl`, `getSignedFileUrls`, `getBacklinksForBlock`, `getPublicPageData` | `getTeams`, `submitTransaction` |\n\n`submitTransaction` being dead matters for [`jamalex\/notion-py`](https:\/\/github.com\/jamalex\/notion-py),\nthe most complete public v3 client: it writes through that endpoint, so **its write path no longer\nworks**. Read it for structure, not for working code.\n\n## References\n\n- `references\/v3-recipes.md` \u2014 copy-paste recipes: select options, `date_format`, reminders, trashing,\n  conditional row colours, grouped views, blocks, rich text, file upload.\n- `references\/mcp-surface.md` \u2014 exact MCP call shapes and their traps (the `date:Prop:start` expansion,\n  silent no-op writes, schema-extending moves).\n- `references\/reading-data.md` \u2014 response shapes, both `queryCollection` forms, endpoint probing, and\n  recovering blocks you just trashed.\n\n## Out of scope\n\n- Do **not** put a `token_v2` anywhere but Doppler \u2014 no config file, no `.env`, no committed constant.\n- Do **not** drop to v3 because an MCP call errored once; match the operation against the table first.\n- Do **not** hand-roll a Notion client; `notion_tools` already exists.\n- Do **not** run a bulk write against a live database without a dry run or a scratch page first.\n","use_cases":["Reading or writing Notion pages, databases, rows, schemas, or views","Handling failed or rejected MCP plugin calls","Changing the appearance of Notion tables","Bulk writing data to Notion","Managing reminders and grouped views"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/AnotherSava\/claude-code-common\/blob\/1a7f9f9cce53f6946ae1e3a9cc0733f2524a4b93\/claude\/skills\/notion\/SKILL.md","source_commit":"1a7f9f9cce53f6946ae1e3a9cc0733f2524a4b93","license":null,"version":null,"listing_approved_at":"2026-12-01","created_at":"2026-11-30T08:08:13.000000Z","updated_at":"2026-12-01T12:48:20.000000Z","seo_title":"Notion API Integration for Data and Development","seo_description":"Integrate with Notion using MCP or the internal v3 API for advanced operations like reminders, grouped views, and bulk writes. Ideal for developers and data professionals","seo_keywords":["Notion API","Notion integration","MCP Notion","Notion v3 API","Notion data management","Notion bulk writes","Notion reminders","Notion grouped views"]}}