Skip to main content

Notion

The Notion service provider allows you to easily connect and authorize with a Notion workspace you have access to. Then, you can set up your schema with queries to access your databases, pages, and users from Notion's API.

note

Notion's API is currently in beta, so that means our integration is also in beta. The Notion API may unexpectedly change, and our integration is currently locked at version 2021-08-16.

Connect Notion

You can connect new services from the Schema page. To get there, open your project's Schema tab. Then, use the "Connect Service" button at the top of the services list, then pick "Notion" from the gallery of available services.

Decide the Name, Slug, and Namespace to use within your API.

Then, select save. You'll be taken to an OAuth page within Notion to select the items you'd like to access from your project. After you've made you selections, select authorize.

After a successful authorization, you'll be taken back to your schema page. You should see the Notion service is now connected.

Find Notion IDs

When working with the Notion API, you'll often need the ID of a database or a page. The ID for any resource can be found in its URL.

  • If you're using Notion in the browser, you can easily access and inspect the URL to find the ID you're looking for.
  • If you're using one of Notion's apps, you'll need to copy the URL for the page and then paste it into a text document for inspection.

Add shapes and queries

We are working to provide a pattern that provides some starter queries and shapes for working with Notion.

The Notion service is based on the REST service provider. Learn more about configuring your schema to use REST resolvers.

Examples

Get a Notion database
{
"queries": {
"getDatabase": {
"resolver": {
"name": "rest:get",
"service": "notion",
"path": {
"ops": [
{
"path": "id",
"mapping": "$args.id"
}
],
"serialize": {
"template": "/databases/{id}",
"defaults": {
"style": "simple",
"explode": false
}
}
}
},
"args": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": ["id"]
},
"shape": "Database"
}
},
"shapes": {
"Database": {
"id": "Database",
"name": "Database",
"title": "Database",
"description": "A database from Notion",
"schema": {
"type": "object",
"properties": {
"object": {
"type": "string",
"description": "Always `\"database\"`."
},
"id": {
"type": "string",
"description": "Unique identifier for the database."
},
"created_time": {
"type": "string",
"description": "Date and time when this database was created. Formatted as an ISO 8601 date time string."
},
"last_edited_time": {
"type": "string",
"description": "Date and time when this database was updated. Formatted as an ISO 8601 date time string."
}
}
}
}
}
}