notion-cli
A CLI for Notion, built in Go.
Install
Homebrew
brew install inforix/tap/notion-cli
Release binary
Download from the GitHub releases page and place the binary on your PATH.
From source
go build -o ./bin/notion ./src/cmd/notion
Auth
Set a Notion integration token:
export NOTION_TOKEN=YOUR_TOKEN
Usage
notion --help
notion pages export <page_id>
notion files --help
Pages
notion pages list --query "project" --all
notion pages get <page_id>
notion pages create --body @page.json
notion pages update <page_id> --body @update.json
notion pages archive <page_id>
notion pages export <page_id> --assets=download -o page.md
Databases
notion databases get <db_id>
notion databases query <db_id> --body @query.json
notion databases create --body @database.json
notion databases update <db_id> --body @update.json
Blocks
notion blocks get <block_id>
notion blocks update <block_id> --body @block.json
notion blocks children append <block_id> --body @children.json
Users
notion users list
notion users get <user_id>
notion comments list --page-id <page_id>
notion comments create --body @comment.json
Auth
notion auth status
notion auth set --token YOUR_TOKEN
Search
notion search --body @query.json
notion search --body @query.json --all --page-size 100
notion users list --format '{{json .results}}'
# Create a file upload
notion files create --body @file-upload.json
# Retrieve a file upload
notion files read <file_upload_id>
# List file uploads
notion files list --page-size 100
# Download a file from a file object (external or file URL)
notion files read --body @file.json --output ./downloads/
Development
- Source code lives in
./src/
- Build output goes to
./bin/ or ./dist/ (ignored by git)
Releases
This project uses GoReleaser. To validate config locally:
goreleaser check