Notion -> Block: Append Children
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.
Xano Action: Notion -> Block: Append Children
This Xano Action appends the children blocks to a specified Notion block. Below is the breakdown of the inputs, function stack, and response.
1. Inputs
The action accepts the following inputs:
| Name | Type | Description |
|---|---|---|
notion_api_key |
Text | Your Notion integration API key. |
block_id |
Text | The ID of the Notion block whose children to append to. |
children |
JSON[] | The list of children blocks. |
after |
Text | (Optional) Cursor for where to put the block |
2. Function Stack
2.1 Notion API Request
Request: Sends a POST request to the Notion API to append to the children of the specified block.
Endpoint:
https://api.notion.com/v1/blocks/%s/children- The
%splaceholder is replaced with theblock_idinput usingsprintf.
- The
Headers:
- Authorization:
Bearer notion_api_key - Content-Type:
application/json
- Authorization:
Precondition:
- Ensures the HTTP status of the response is
200.
- Ensures the HTTP status of the response is
2.2 Precondition
- Condition:
var: notion_api.response.status = 200- Ensures the API call was successful before proceeding.
3. Response
The response returns the children blocks fetched from Notion:
| Key | Value |
|---|---|
As Self |
var: notion_api.response.result |
This includes details about each child block, such as its type, content, and metadata.
Notes
- Ensure your Notion integration has access to the block being queried.
- For paginated results, pass the after cursor to retrieve the next set of children.
Outputs
| Key | Description |
|---|---|
| As Self | Returns the response from the Notion API. |
Example
Here’s an example of a request body to create a Notion page with structured content:
Input
{
"notion_api_key": "your-api-key",
"block_id": "example-block-id",
"children": [
{
"heading_2": {
"rich_text": [
{
"text": {
"content": "Lacinato kale"
}
}
]
}
},
{
"paragraph": {
"rich_text": [
{
"text": {
"content": "Lacinato kale is a variety of kale with a long tradition in Italian cuisine, especially that of Tuscany. It is also known as Tuscan kale, Italian kale, dinosaur kale, kale, flat back kale, palm tree kale, or black Tuscan palm.",
"link": {
"url": "https://en.wikipedia.org/wiki/Lacinato_kale"
}
}
}
]
}
}
],
"after": "optional-children-cursor"
}
Response
{
"object": "list",
"results": [
{
"object": "block",
"id": "c02fc1d3-db8b-45c5-a222-27595b15aea7",
"parent": {
"type": "page_id",
"page_id": "59833787-2cf9-4fdf-8782-e53db20768a5"
},
"created_time": "2022-03-01T19:05:00.000Z",
"last_edited_time": "2022-07-06T19:41:00.000Z",
"created_by": {
"object": "user",
"id": "ee5f0f84-409a-440f-983a-a5315961c6e4"
},
"last_edited_by": {
"object": "user",
"id": "ee5f0f84-409a-440f-983a-a5315961c6e4"
},
"has_children": false,
"archived": false,
"type": "heading_2",
"heading_2": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Lacinato kale",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "Lacinato kale",
"href": null
}
],
"color": "default",
"is_toggleable": false
}
},
{
"object": "block",
"id": "acc7eb06-05cd-4603-a384-5e1e4f1f4e72",
"parent": {
"type": "page_id",
"page_id": "59833787-2cf9-4fdf-8782-e53db20768a5"
},
"created_time": "2022-03-01T19:05:00.000Z",
"last_edited_time": "2022-07-06T19:51:00.000Z",
"created_by": {
"object": "user",
"id": "ee5f0f84-409a-440f-983a-a5315961c6e4"
},
"last_edited_by": {
"object": "user",
"id": "0c3e9826-b8f7-4f73-927d-2caaf86f1103"
},
"has_children": false,
"archived": false,
"type": "paragraph",
"paragraph": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Lacinato kale is a variety of kale with a long tradition in Italian cuisine, especially that of Tuscany. It is also known as Tuscan kale, Italian kale, dinosaur kale, kale, flat back kale, palm tree kale, or black Tuscan palm.",
"link": {
"url": "https://en.wikipedia.org/wiki/Lacinato_kale"
}
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "Lacinato kale is a variety of kale with a long tradition in Italian cuisine, especially that of Tuscany. It is also known as Tuscan kale, Italian kale, dinosaur kale, kale, flat back kale, palm tree kale, or black Tuscan palm.",
"href": "https://en.wikipedia.org/wiki/Lacinato_kale"
}
],
"color": "default"
}
}
],
"next_cursor": null,
"has_more": false,
"type": "block",
"block": {}
}
Version notes
2025-01-20 16:20:10
Current