New functionality not available to old API versions; code, inline databases, and database page blocks
New API endpoints and block types not supported in older versions of the API as of September 28
As of September 28, 2021, new block types and API endpoints will not be supported in older versions of the API. If you're currently on version
2021-05-11
or2021-05-13
, upgrade to2021-08-16
to take advantage of the new block types in this changelog and any other block types or endpoints introduced after September 28.API functionality introduced before September 28 will continue to work with older API versions.
We have added support for retrieving, adding and updating code blocks, inline databases and database page blocks.
Code blocks
You can now can retrieve and add code blocks when using Append block children and Retrieve block children.
Below is an example response from Retrieve block children containing a code block uploaded to Notion.
{
"object": "list",
"results": [
{
"object": "block",
"id": "ee27cd42-eaad-467f-9956-c0aa4efa94b5",
"created_time": "2021-09-22T20:27:00.000Z",
"last_edited_time": "2021-09-27T19:25:00.000Z",
"has_children": false,
"archived": false,
"type": "code",
"code": {
"text": [
{
"type": "text",
"text": {
"content": "const a = 21\nconst b = a + 5",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "const a = 21\nconst b = a + 5",
"href": null
}
],
"language": "javascript"
}
},
],
"next_cursor": null,
"has_more": false
}
Inline databases and database page blocks
You can now can retrieve child database blocks when using Retrieve block children and Retrieve block.
Updating
child_database
blocksTo update
child_database
type blocks, use the Update database endpoint. Updating the block'stitle
updates the text displayed in the associatedchild_database
block.
Below is an example response from Retrieve block children containing a child database uploaded to Notion.
{
"object": "list",
"results": [
{
"object": "block",
"id": "0d6ff4f9-1211-4129-ab4a-19dfc33d4d7a",
"created_time": "2021-09-27T20:25:00.000Z",
"last_edited_time": "2021-09-27T20:25:00.000Z",
"has_children": false,
"archived": false,
"type": "child_database",
"child_database": {
"title": "My child database"
}
}
],
"next_cursor": null,
"has_more": false
}