2

I am currently trying to download a site/page using notions API. I shared the page and tried this:

(async () => {

    const pageId = 'abcd-editorial-efe.notion.site/Sites-abc123';
  
    const response = await notion.pages.retrieve({ page_id: pageId });
  
    console.log(response);
  
  })();

I get an error saying:

@notionhq/client warn: request fail {
  code: 'object_not_found',
  message: 'Could not find page with ID: abc123..... Make sure the relevant pages and databases are shared with your integration.'
}

Is this the correct API endpoint to retrieve a page?

Notions docs pageId is a GUID...but when I shared my page I get a complete/full URL:

(async () => {

  const pageId = 'b55c9c91-384d-452b-81db-d1ef79372b75';

  const response = await notion.pages.retrieve({ page_id: pageId });

  console.log(response);

})();

I am using "@notionhq/client": "^1.0.4"

Blankman
  • 259,732
  • 324
  • 769
  • 1,199

2 Answers2

4

Before Nov 2022

You used to have to invite integrations like Muhammad Magdi mentioned in the comments:

In the share section (top right), select invite and invite your integration.

After Nov 2022

As stated by [umihico] below, in the latest version of Notion you 'Add connections' from the top-right "three dots" menu.

Juan Campa
  • 1,181
  • 2
  • 14
  • 20
Jake
  • 4,322
  • 6
  • 39
  • 83
1

It looks like you have a successful workspace connection but that you haven't granted that connection access to a database within your workspace.

To do this:

  1. Click on the 3 dots in the top right.
  2. Find "Add Connections" near the bottom.
  3. Search for the name of your connection in the box.
  4. Select and confirm your connection's access to the database.
andmckay
  • 11
  • 2