//native
/**
* Move Page to Trash or Restore
* Move a page to the trash (`in_trash` true), or restore it from the trash (`in_trash` false). Trashed pages can be restored until Notion empties the trash.
*/
export async function main(
auth: RT.Notion,
page_id: string,
in_trash: boolean = true
) {
const response = await fetch(`https://api.notion.com/v1/pages/${page_id}`, {
method: "PATCH",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
"Notion-Version": "2026-03-11",
},
body: JSON.stringify({ in_trash }),
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 4 hours ago