Skip to main content
You need a Notion account and a terminal.

Step 1: Get a personal access token

A personal access token (PAT) lets you authenticate API requests as yourself without setting up a connection or completing an OAuth flow.
1
Open Personal access tokens in the Developer portal.
2
Select New token.
3
Enter a name, select the Notion API capability, and then select Create token. If a workspace picker appears, select a workspace first.
4
Copy the token and save it somewhere secure. You wonโ€™t be able to see it again.
Donโ€™t see the option to create a token?On Business and Enterprise plans, PAT creation is restricted by default. Ask a workspace owner to enable it in Settings โ†’ Connections.See Who can create PATs.
Set the token as an environment variable so you can use it in the examples below. This lasts for your current terminal session โ€” run it again if you open a new window.

Step 2: Create a page

Make a POST request to the Create a page endpoint with markdown content. The API creates a private page in your workspace, using the # heading as the page title automatically.
The markdown field accepts Notion-flavored Markdown โ€” headings, lists, code blocks, links, and more. The API converts it to Notion blocks for you.
Notion pages are made up of blocks โ€” headings, paragraphs, lists, and more. When you send markdown, the API converts it into this block structure automatically.You can also build this structure directly using the children field. Hereโ€™s what the same page looks like expressed as blocks:
The block model gives you precise control over every element โ€” formatting, colors, toggles, and block types that markdown canโ€™t express. Use markdown when you want simplicity, and children when you need that control.See Working with page content to learn more about the block model.

Check the result

A successful response returns a page object:
Response
To see your new page:
  • From the response: Copy the url value and open it in your browser.
  • From Notion: Look in Private in your sidebar for ๐Ÿš€ Hello from the API.
Open the page and you should see your heading, paragraph, and bullet list inside.
Error responses return a JSON object with a code and message:
For the full list of error codes, see Status codes.

Next steps

Now that youโ€™ve made your first request, explore what else you can build โ€” create databases, query content, manage comments, upload files, and more.

API reference

Browse every endpoint, request parameter, and response field.

JavaScript SDK

Official client library for Node.js.