notion-clilisted
Install: claude install-skill magnusrodseth/dotfiles
# Notion CLI (`ntn`)
Drive Notion from the terminal using the official `ntn` CLI. Covers page CRUD, file uploads, block operations, and the common workflow of publishing a markdown article (with images) into a database.
## Prerequisites
`ntn` must be installed and a Notion **integration token** must be available. Verify both:
```bash
ntn --version # should print a version
[ -n "$NOTION_API_TOKEN" ] && echo ok || echo "missing token"
```
If the binary is missing, install with `curl -fsSL https://ntn.dev | NTN_INSTALL_DIR="$HOME/.local/bin" bash` (avoids the default `/usr/local/bin` permission prompt on macOS).
If the token is missing but a similarly-named var is set (e.g. `NOTION_API_KEY`), map it before running CLI commands: `export NOTION_API_TOKEN="$NOTION_API_KEY"`.
`ntn login` (OAuth flow) is **separate** from `NOTION_API_TOKEN` and only required for `ntn workers`. For `pages` and `files`, only the env var is required.
The integration must be invited to the target page or database from Notion's UI (the page's `...` menu → "Connect to integration"). Without that, fetches return `403 restricted_resource`.
## Quick start
Create a simple page in a database from inline markdown:
```bash
ntn pages create \
--parent data-source:<DATA_SOURCE_ID> \
--content $'# Title\n\nFirst paragraph.' \
--json
```
Output (with `--json`) includes the new page's `id` and `url`.
To find `<DATA_SOURCE_ID>`: open the target database in Notion