Skip to main content
Build tools and automations that create pages, organize data, and share feedback in Notion. This guide walks you through creating your first page with the API. 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. Set it again if you open a new terminal. Keep the token out of browser code and public repositories.

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 enhanced 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.

Pages

Create, update, and retrieve page content.

Databases

Create a database and find its data sources.

Views

Create and configure database views programmatically.

Data sources

Manage data sources, properties, entries, and schemas.

File uploads

Upload and attach files to pages and databases.

Comments

Handle page and inline comments.

Content queries

Find pages and data sources by title.

Users

Read user profiles available to your connection.
For a team automation or an app others can install, compare connections and tokens.

API reference

Browse every endpoint, request parameter, and response field.

JavaScript SDK

Official client library for Node.js.