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 afterntn api. The leading slash is optional:
ntn api sends a GET request.
To send a request body, add inline body fields:
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:
:= when the value should keep its JSON type:
null:
Choose body syntax
For nested objects, use bracket or dot notation:[] to append repeated values in input order:
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:
--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:
Header:Value for request headers:
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:
NOTION_API_VERSION for a shell session or script:
Inspect endpoints before calling them
List the public API surface:-X so ntn api knows which operation to inspect.
Debug a request
Run with--verbose to print request and response metadata to stderr:
Authorization request header is redacted by default.
Troubleshooting
Next steps
File uploads
Upload local files or import external files into Notion.
API reference
Browse Notion API endpoints and schemas.