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.| Form | Meaning | Example |
|---|---|---|
path=value | Body field with a string value | parent[page_id]=abc123 |
path:=json | Body field parsed as JSON | archived:=true |
name==value | Query parameter | page_size==100 |
Header:Value | Request header | Accept:application/json |
= 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
| Problem | What to check |
|---|---|
The request used POST unexpectedly | Body input, --data, or stdin JSON makes POST the default. Use -X to override it. |
| An inline value has the wrong type | Use := for JSON values like true, 10, null, arrays, and objects. Use = only for strings. |
| A nested body path is hard to read | Prefer bracket notation, especially for property names with spaces or punctuation. |
--spec or --docs says the method is ambiguous | Add -X GET, -X POST, -X PATCH, or the method you want to inspect. |
| The body source conflicts | Use only one of stdin JSON, --data, or inline body fields. |
| You need to inspect a failing request | Add --verbose and check the final method, URL, status, and x-request-id. |
Next steps
File uploads
Upload local files or import external files into Notion.
API reference
Browse Notion API endpoints and schemas.