Work with NOTION API and PowerShell

Recently is started to work with Notion, as OneNote was too limited, and with Notion, I can connect Notes with ToDos and many more. So, of course, I immediately started working with the API of Notion to Sync with Microsoft ToDo. This will be a future Blog Post. Today, we will begin with an easy example of working with Notion API and PowerShell.

Notion Documentation

The Documentation is always an excellent point to start with an API: Notion API

Next is the Notion API References to see some examples.: Introduction (

API Authentication

The first thing is always the correct Authentication to run the Scripts without any User prompts. Notion is using API Keys, so we need to get some.

  • Login to the Developers part in Notion and see “My Integrations” here: My integrations | Notion Developers
  • Click “+ New Integrations”
  • Fill in a Name and click Save
  • At the next Page Copy the Secret Key, that Key will be used in our PowerShell Script

First Notion API Call with PowerShell

In our example, we want to query a Notion database with PowerShell and its content. I have created a Database with all My Tasks, projects, and Epics in Notion. This Database will be used for this.

When you look at the example herE: Query a database (, you note that we need the Database ID. So open the Database in Notion and check the Brwoeder URL for Id.

So the URL will look like this

So the first GUID is our Database ID, so in our example, it is “ae000000efd0000e000cf000bf000b0c”

Before you can query the Database, you need to share the Database with the API Integration we created a few minutes before.

Click on the “Share” on the top right and ensure your Integration has EDIT Permissions.

The PowerShell Script to query Notion Database

Now we have all Information and Perperations, so let’s run the Script

$NotionAPIKey="Your Secret"

$Notionheaders = @{
    "Authorization"  = "Bearer $($NotionAPIKey)"
    "Content-type"   = "application/json"
    "Notion-Version" = "2021-08-16"

$DatabaseID="Your Databse ID"

$Result = Invoke-RestMethod -Uri "$DatabaseID/query" -Method Post -Headers $Notionheaders


The Result then show each DB Entry in your Database


All Notion examples can be found in my GitHub Repo: Seidlm/NOTION-PowerShell: PowerShell Scripts to work with NOTION (

Michael Seidl, aka Techguy
au2mate, everything

2 thoughts on “Work with NOTION API and PowerShell”

  1. Pingback: Pagination with Notion API and PowerShell - TechGuy

  2. Pingback: Add a Page to a Notion Database with PowerShell - TechGuy

Leave a Comment

Your email address will not be published. Required fields are marked *