What's the proper way to remove a page from a Notion database?

I’m trying to get rid of a page in my Notion database but I’m running into some trouble. The docs say we can delete a page by changing the ‘archived’ status to true. Here’s what I’ve got:

// inside an async function
await notionClient.pages.modify({
  pageId: myPageId,
  archived: true
});

But it’s not doing anything. I can change other stuff on the page no problem, but this archived thing just won’t budge. Am I missing something obvious here? Has anyone else run into this?

Update: Fixed it! Turns out I needed to update my API version. Thanks for the help, everyone!

Glad you got it sorted out! Updating the API version is often the culprit for unexpected behavior. For others who might stumble upon this, it’s worth noting that the ‘archived’ property is indeed the correct way to remove pages from databases in Notion’s API. Just ensure you’re using the latest version and have the necessary permissions. Also, remember that ‘archived’ pages aren’t permanently deleted - they’re just hidden from view. If you need to completely purge the data, you might need to take additional steps.

hey there! i had similar issue before. make sure ur using the latest API version (2022-06-28 or newer). also double-check ur pageId is correct. if that dont work, try deleting the page manually thru the UI and see if any errors pop up. good luck!

I’ve been using Notion’s API for a while now, and I’ve learned that sometimes the simplest solutions are the ones we overlook. Have you verified that your API token has the necessary permissions to modify pages? It’s a common oversight. Also, double-check that you’re not hitting any rate limits - Notion can be finicky about that. If all else fails, try creating a new page and then immediately archiving it. This can help isolate whether the issue is specific to that particular page or a more general problem with your setup. Glad to hear you resolved it by updating the API version, though. That’s definitely a key troubleshooting step for anyone else facing similar issues.