Skip to content

Instantly share code, notes, and snippets.

@bmorrisondev
Created August 18, 2022 14:38
Show Gist options
  • Save bmorrisondev/c7890c0c6e5925c0510fa40837f3cecc to your computer and use it in GitHub Desktop.
Save bmorrisondev/c7890c0c6e5925c0510fa40837f3cecc to your computer and use it in GitHub Desktop.
Query Notion DB with JS
const { Client } = require("@notionhq/client")
const notion = new Client({
auth: "<NOTION_SECRET>",
notionVersion: "2022-02-22"
})
;(async() => {
const res = await notion.databases.query({
database_id: "<NOTION_DBID>"
})
console.log(JSON.stringify(res))
})()
@bmorrisondev
Copy link
Author

Note the API version on line 5. Its part of the Options object passed into the constructor when creating a new client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment