Skip to main content
Use ntn api to make authenticated Notion API requests from your terminal. It is useful when you want to inspect an endpoint, test a request body, script an API call, or debug a response without setting up a separate HTTP client. ntn api adds the Authorization and Notion-Version headers for you. It uses your CLI authentication by default, or a token from NOTION_API_TOKEN when you set one.

Make a request

Pass a Notion API path after ntn api. The leading slash is optional:
Without request body input, ntn api sends a GET request. To send a request body, add inline body fields:
When body fields are present, ntn api sends a POST request unless you override the method. Use -X when the endpoint needs a different method:

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 := when the value should keep its JSON type:
Typed values can be booleans, numbers, strings, arrays, objects, or null:

Choose body syntax

For nested objects, use bracket or dot notation:
Use explicit array indexes when order matters:
Use [] to append repeated values in input order:
Bracket notation is safest for keys that contain punctuation or spaces:
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:
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.