You can connect to Notion using Retool's REST API integration and make it available as a resource. Once complete, you can write queries to interact with the Notion API.
Requirements
All users for Retool organizations on Free or Team plans have global Edit permissions and can add, edit, and remove resources. If your organization manages user permissions for resources, you must be a member of a group with Edit all permissions.
To create your Notion resource, you need:
- REST API connection details.
- A valid API key.
Notion uses Bearer (token) authentication. You must provide an API key or access token for Retool to authorize requests. Refer to the Notion documentation on authenticating requests to learn how to obtain an API key or access token.
If Notion is behind a firewall, you must also allow access from Retool's IP addresses. Add these IP addresses to your firewall's allowlist before you create the resource.
1. Create a new resource
Sign in to your Retool organization and navigate to the Resources tab. Click Create new, then select Resource.
Retool can connect to almost any API or database, and has built-in integrations for popular data sources. Select the REST API integration.
2. Configure the resource
Provide the necessary details to configure the resource so Retool can connect to Notion. Not all settings are required, but refer to the Notion documentation to learn what is needed.
General
These settings configure the name and location of the resource within Retool.
Name
The name to use for the resource (e.g., Notion).
Folder
The folder in which to save the resource.
Description
A brief description of the resource (e.g., Customer data).
Credentials
These settings configure how Retool connects to Notion.
Base URL
The base URL for the Notion API. This must be an absolute URL. Use https://api.notion.com
.
URL parameters
Key-value pairs to include as URL parameters with Notion API requests. No additional URL parameters are required.
Headers
Key-value pairs to include as headers with Notion API requests. Notion uses Bearer (token) authentication which includes your API key or token as a header value. Notion also recommends you include a Notion-Version
header to specify the version date, in the format YYYY-MM-DD
. Include the following key-value pairs:
Key | Value |
---|---|
Authorization | Bearer access_token |
Notion-Version | version_date |
Body
Key-value pairs to include in the body of Notion API requests. No additional body values are required.
Cookies
Cookies to include with Notion API requests. No cookies are required.
Authentication
The method of authentication to use with Notion. Select None
. Notion authenticates requests using the API key or token you specified as a header value.
Forward all cookies
Whether to forward all cookies. This is useful if you have dynamic cookie names.
3. Save the resource
Click Create resource to complete the setup. You can then click either Create an app to immediately start building a Retool app or Back to resources to return to the list of resources.
Wrap up
Your Notion resource is now ready to use. You write queries to make API requests by specifying the request method and endpoint, additional parameters to include, and the request body.
To verify you can successfully interact with Notion, write a test query to retrieve some data. The following example retrieves Comment objects for the given block.
- Request
- Response
GET https://api.notion.com/comments?block_id=5c6a28216bb14a7eb6e1c50111515c3d
{
"object": "list",
"results": [
{
"object": "comment",
"id": "94cc56ab-9f02-409d-9f99-1037e9fe502f",
"parent": {
"type": "page_id",
"page_id": "5c6a2821-6bb1-4a7e-b6e1-c50111515c3d"
},
"discussion_id": "f1407351-36f5-4c49-a13c-49f8ba11776d",
"created_time": "2022-07-15T16:52:00.000Z",
"last_edited_time": "2022-07-15T19:16:00.000Z",
"created_by": {
"object": "user",
"id": "9b15170a-9941-4297-8ee6-83fa7649a87a"
},
"rich_text": [
{
"type": "text",
"text": {
"content": "Single comment",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "Single comment",
"href": null
}
]
}
],
"next_cursor": null,
"has_more": false,
"type": "comment",
"comment": {}
}