Move a block, or a page by its ID, to the trash.
1
//native
2
3
/**
4
* Delete Block
5
* Move a block to the trash, with its children. A page ID also works. Restore it with Update Block content {"in_trash": false}, or a page with Move Page to Trash or Restore.
6
*/
7
export async function main(auth: RT.Notion, block_id: string) {
8
const response = await fetch(`https://api.notion.com/v1/blocks/${block_id}`, {
9
method: "DELETE",
10
headers: {
11
Authorization: `Bearer ${auth.token}`,
12
Accept: "application/json",
13
"Notion-Version": "2026-03-11",
14
},
15
})
16
17
if (!response.ok) {
18
throw new Error(`${response.status} ${await response.text()}`)
19
}
20
21
return await response.json()
22
23