awesome cli.

Work & messaging

Notion CLI for coding agents

Notion auth, API requests, data sources, file uploads, and Notion Workers.

Command: ntn

Open the official project ↗

This article follows the official documentation. We haven’t tested this tool for a hands-on review.

A coding agent that needs information from a Notion workspace can use the ntn command-line interface to run Notion commands in a terminal. The CLI supports sign-in, requests to Notion’s API, access to data sources such as databases, file uploads, and Notion Workers, Notion’s hosted environment for custom code. The official CLI overview explains how to set it up and what it can do.

An agent could read a project database and summarize open tasks before changing code. The commands below come from Notion’s CLI documentation. Use that documentation rather than guessing flags or credentials for the agent.

Set up the CLI

Notion’s installation guide has an install script for macOS and Linux and a WinGet package for Windows. There is also an npm package, which needs Node.js 22 or newer. Then sign in:

curl -fsSL https://ntn.dev | bash
ntn --version
ntn login

ntn login opens a browser window where you approve access. Before you approve, check that the code in the browser matches the code in your terminal. According to the authentication documentation, the CLI stores a workspace token in your system keychain. On a machine without a browser, ntn login --no-browser prints a URL and a code. You confirm them in any browser, then run ntn login poll on the original machine. Guests and restricted members cannot log in with the CLI. For scripts and CI, Notion recommends a personal access token in the NOTION_API_TOKEN environment variable, which takes precedence over the keychain login. Commands that request workspace data connect to Notion over the network. Installing the CLI and reviewing local project files do not change workspace content.

Do not put credentials in the agent prompt. Sign in through the documented CLI steps, then let the agent use the signed-in CLI. Before running a command that writes to Notion or deploys code, check what the command does and which workspace or resource it targets.

The CLI reads from and writes to Notion’s API. It also manages Workers. Notion’s Developer Platform announcement from May 2026 says the CLI is available on all plans. It says deploying and managing Workers is available on Business and Enterprise plans, with Workers in public beta.

Read a project database

An agent can find open work related to a code change and summarize it for the developer. In Notion’s API, a database holds one or more data sources, and each data source is a table of pages. The data sources guide shows how to look up the data source and query it:

ntn datasources resolve <database-id>
ntn datasources query <data-source-id> --limit 25 \
  --filter '{"property":"Status","select":{"equals":"Open"}}' --json

Replace the placeholders with your own IDs, and the Status filter with a property your database has. The first command turns a database ID into its data source IDs. The second lists up to 25 matching pages. The guide says --json gives machine-readable output, and --start-cursor with the next_cursor value from the previous response gets the next page. Both commands only read data.

For example, give the agent this prompt:

Use the authenticated Notion CLI and its official command reference to find the project data source for the current repository. Read the open tasks, then summarize the ones related to the files I changed. Do not create, update, or delete Notion content. If you cannot identify a read-only command or the correct data source, stop and ask me.

The command reference lists the ntn commands and their flags. The agent should check it before building a request. ntn api is the general command for any Notion API path. Without body fields it sends a GET request. With body fields it sends a POST unless you set another method with -X, so an ntn api call with fields can change data.

Separate local work from workspace changes

Reading and summarizing data does not change Notion. A write request changes workspace content. Deploying a Worker sends code to Notion’s hosted environment. The CLI includes a Worker deployment command, ntn workers deploy, which builds and uploads the worker in the current directory. Deployment is a service-side change, not a local check. Confirm the target and review the Worker code before asking an agent to run it. Notion’s Workers overview says Workers can sync external data into Notion databases on a schedule, which is one reason deployment deserves separate approval.

Check the official docs for current installation steps and sign-in instructions. Consult them for command syntax and output options. This matters when an agent has access to the command line: a mistaken read request wastes time, while a mistaken write or deployment changes the workspace.

Tool details come from awesome-ai-cli.