Skip to main content
Use ntn api to call the Notion API from your terminal. It adds the Authorization and Notion-Version headers. Log in with the CLI or set NOTION_API_TOKEN to the token you want to use.

Make a request

Set PAGE_ID to the ID of a page you can read. Pass its API path to ntn api. The leading slash is optional.
Without request body input, ntn api sends a GET request. To create a child page, set PARENT_PAGE_ID to the ID of a page you can add content to. Pass the parent and title as body fields.
When body fields are present, ntn api sends a POST request unless you override the method. Use -X to choose the method. This request restores a page from the trash.

Build request data inline

Inline inputs after the path can set body fields, query parameters, and request headers. Use = when the value should be a string:
Use := to send a number. This page must have a number property named Priority.
Typed values can be booleans, numbers, strings, arrays, objects, or null:

Choose body syntax

For nested objects, use brackets or dots. Quote the whole argument when it contains brackets or spaces so your shell passes it as one field.
Use explicit array indexes when order matters:
Use [] to append repeated values in input order:
For a rich text property named Build version, put the name in brackets.
Inline request syntax is inspired by HTTPie and implemented in httpcliparser.

Send JSON from a file or stdin

Use inline inputs for small bodies. Use stdin or --data when the body is easier to write as JSON. Send a JSON file:
Pipe generated JSON:
Pass a JSON string directly:
Only use one body source per request: stdin JSON, --data, or inline body fields. You can still combine headers and query parameters with any one body source.

Add query parameters and headers

Use == for query parameters. This request lists up to 10 users.
Use Header:Value for request headers:
Repeated query parameters and headers are preserved in the order you pass them.
ntn api already sets Authorization and Notion-Version. You usually do not need to pass those headers manually.

Override the API version

By default, ntn api fetches the latest supported Notion-Version. Use --notion-version for one request:
Use NOTION_API_VERSION for a shell session or script:

Inspect endpoints before calling them

List the public API surface:
Print it as JSON for scripts:
Show the live endpoint help for a path:
Print the reduced OpenAPI fragment for an endpoint:
Print the official markdown reference page for an endpoint:
If a path supports multiple methods, pass -X so ntn api knows which operation to inspect.

Debug a request

Run with --verbose to print request and response metadata to stderr:
Verbose output includes the final method, URL, request headers, JSON request body, response status, response headers, and response body. The Authorization request header is redacted by default.
--unsafe-verbose is a hidden debugging flag that disables Authorization header redaction in verbose logs. It is dangerous because it can display your bearer token in command output. Only use it in a controlled local environment, and never paste its output into shared logs, tickets, or chat.

Troubleshooting

Next steps

File uploads

Upload local files or import external files into Notion.

API reference

Browse Notion API endpoints and schemas.