Notion -> Database: Create
Readonly
Action summary
How to Get a Notion API Key
Create an Integration
- Go to the Notion Developers Portal.
- Click "New Integration", name it, select a workspace, and submit.
Get Your API Key
- Copy the Internal Integration Token from the integration settings page.
Grant Database Access
- Open your Notion database.
- Click the three button dropdown at the top right of your screen, click Connections, and then select your integration.
Use the API Key
- Add it to your Xano Actions in the
Settings Registryinput option:
- Add it to your Xano Actions in the
For more details, see the Notion API Docs.
Notion → Database: Create
Overview
This Xano action creates a new database in Notion using the Notion API. It uses the Notion API's POST method to create a database with specified properties, title, icon, and cover.
Inputs
| Name | Type | Description |
|---|---|---|
notion_api_key |
registry | text |
database_id |
text | The unique identifier for the new database |
parent |
text | The parent page ID where database will be created |
icon |
text | The icon for the database (optional) |
cover |
text | The cover image for the database (optional) |
title |
text | The title of the database |
properties |
json | The properties schema for the database |
Function Stack
Prepare body params
- Create Variable
parent_obj: Prepare parent object - Create Variable
icon_obj: Prepare icon object if icon is provided - Create Variable
cover_obj: Prepare cover object if cover is provided - Create Variable
title_obj: Prepare title object - Create Variable
body: Combine all parameters
- Create Variable
Notion API Request
- API Endpoint:
https://api.notion.com/v1/databases - HTTP Method: POST
- Headers:
- Authorization: Bearer
<notion_api_key> - Notion-Version: 2022-06-28
- Authorization: Bearer
- API Endpoint:
Precondition
- Ensures that the HTTP request was successful
- Condition:
notion_api_response.status == 200 - If this condition fails, execution halts and an error is thrown
Response
| Key | Value |
|---|---|
As Self |
Returns notion_api_response.result |
Overview
This Xano action moves a Notion page to trash using its unique identifier (page_id). It uses the Notion API's PATCH method to archive the page.
Inputs
| Name | Type | Description |
|---|---|---|
notion_api_key |
registry | text |
page_id |
text | The unique identifier of the page to trash |
Function Stack
Notion API Request
- API Endpoint:
https://api.notion.com/v1/pages/%s - HTTP Method: PATCH
- Headers:
- Authorization: Bearer
<notion_api_key> - Notion-Version: 2022-06-28
- Authorization: Bearer
- Replace
%sin the endpoint with the providedpage_id
- API Endpoint:
Precondition
- Ensures that the HTTP request was successful
- Condition:
notion_api_response.status == 200 - If this condition fails, execution halts and an error is thrown
Response
| Key | Value |
|---|---|
As Self |
Returns notion_api_response.result |
Example
Input
{
"parent": "98ad959b-2b6a-4774-80ee-00246fb0ea9b",
"icon": "📝",
"cover": "https://website.domain/images/image.png",
"title": "abcd",
"properties": {
"Name": {
"title": {}
},
"Description": {
"rich_text": {}
}
}
}
Output
{
"object": "database",
"id": "bc1211ca-e3f1-4939-ae34-5260b16f627c",
"created_time": "2021-07-08T23:50:00.000Z",
"last_edited_time": "2021-07-08T23:50:00.000Z",
"icon": {
"type": "emoji",
"emoji": "🎉"
},
"cover": {
"type": "external",
"external": {
"url": "https://website.domain/images/image.png"
}
},
.
.
.
{
.
.
.
"Name": {
"id": "title",
"name": "Name",
"type": "title",
"title": {}
}
},
"parent": {
"type": "page_id",
"page_id": "98ad959b-2b6a-4774-80ee-00246fb0ea9b"
},
"archived": false,
"is_inline": false
}
Version notes
2025-02-03 18:05:26
Current