Skip to content

Get all pages title and url in Notion API

homepage-banner

To generate sitemap.xml for a Notion based website, list of all shared with integration pages and urls are needed.

curl -s -X POST 'https://api.notion.com/v1/search' \
  -H 'Authorization: Bearer '"$NOTION_API_KEY"'' \
  -H 'Content-Type: application/json' \
  -H 'Notion-Version: 2022-06-28' \
  --data '{
    "filter": {
        "value": "page",
        "property": "object"
    },
    "sort":{
      "direction":"descending",
      "timestamp":"last_edited_time"
    }
  }'

Reference

  • https://developers.notion.com/reference/post-search
  • https://developers.notion.com/reference/post-database-query

Table of contents

Disclaimer
  1. License under CC BY-NC 4.0
  2. Copyright issue feedback me#imzye.me, replace # with @
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No personal information is collected.
Feedback