Questions tagged [notion-api]

Questions related to the Notion API. The API is REST-based and the officially supported SDK is written in TypeScript.

The Notion API is a JSON-based REST API for working with the Notion application.

It allows you to work with and manipulate data in Databases, Pages, and Properties in your Notion workspace(s).

You can find documentation for the API on Notion's Developer Portal.

The official client is written in TypeScript.

299 questions
25
votes
5 answers

Where to find Database Id for my database in Notion?

I have been using notion to track my habits and my finances. Now I want to get the data from the database using the Notion API. But the notion API requires Database ID and I can't seem to find it.
Atul Bhatt
  • 485
  • 1
  • 6
  • 15
13
votes
3 answers

How to get the rows of a database in the order in which they're displayed?

I have some Python code that retrieves the rows in a Notion database using the notion-client library. The code does manage to retrieve all the rows, but the order is wrong. I looked at the Sort object from the API reference, but was unable to figure…
feihong
  • 131
  • 1
  • 4
8
votes
1 answer

How to insert data in database via Notion API?

I am really new to Notion, and I want to use the API for a project. How I am supposed to insert data in a Notion database ? I know how to read information about the database, I know how to update schema, I know how to retrieve data from database,…
thmatew
  • 83
  • 1
  • 3
7
votes
3 answers

Notion API search method returns nothing

I'm trying to get all the pages of my Notion workspace but the search method returns an empty response while there is pages on my personal workspace. Code : import { Client, LogLevel } from '@notionhq/client' const notion = new Client({ auth:…
Xstoudi
  • 112
  • 6
7
votes
4 answers

Notion API, Getting Invalid_Grant when trying to generate authorization token

I created an intergration on Notion.so I got the interim OAuth code using the following URL Add to Notion This above URL, after authorizing from Notion UI, gives me the following code XXXXXXX-XXXXXXX NOW using the code from above step to get the…
6
votes
0 answers

Can I create a database view by Notion API?

Like this when using Notion Client. But I haven't figured out whether we can do this through Notion API.
Arsenal591
  • 1,396
  • 2
  • 9
  • 12
6
votes
1 answer

List all databases accessed by integration on the Notion

Is there a more efficient way to get the list of all databases in notion? I have tried using the https://api.notion.com/v1/databases endpoint but it's deprecated now. Another option is the /search endpoint but it is returning all the records within…
user16578778
6
votes
1 answer

Can I use fetch to call the Notion API?

I want to use Notion as a content gateway for a SPA. Can I use the Notion API from fetch? I'm trying to use fetch to get the data but It's not working because of CORS. let notion =…
Ricardo Vargas
  • 721
  • 4
  • 14
6
votes
2 answers

Notion API: how to get the URL of uploaded files

I'm using the Notion API Beta, reading pages from a table that has a "Files & media" property I'm interested in. The API response just gives me the names of the files uploaded there, but I don't have a URL to actually access them. What am I missing?…
lorenzo-s
  • 16,603
  • 15
  • 54
  • 86
5
votes
0 answers

Notion Api - Export PDF

Is it possible to download a Notion page as PDF via the API? Just like the Export -> PDF function that is available in the UI? I am trying to automate the exporting process. I have searched the Notion API but could not find anything.
nsis
  • 63
  • 6
5
votes
0 answers

How to get count of pages in database

I would like to ask if there is a way to easily get the number of pages in the database? Since I didn't find any endpoint for that, I came up with this not very nice solution: let count = 0 let hasMore = true let nextCursor = undefined …
5
votes
1 answer

Extract HTML from page child blocks

I'm relatively new to the notion API - as far as I can tell there's no straightforward way to do what I want, but thought I'd ask in case I've missed something. As the question title suggests, I want to be able to query a notion page and get its…
B_D_E
  • 109
  • 2
  • 10
5
votes
1 answer

Querying Notion database using API returns results that don't match the actual Database values

I am making successful calls to query a Notion Database, but the data that I am getting from the API call is just not consistent with the actual data from Notion. I've been pulling my hair out, as I can't figure out what could possibly be causing…
tonigiri
  • 147
  • 6
5
votes
3 answers

What is the Date format in the Notion API?

{ "object": "error", "status": 400, "code": "validation_error", "message": "{Bal has an invalid date value." } I tried many types and always failed.Why not just write it in the document. 2021/05/14 2021/14/05 2021/5/14 2021/05/14…
ser163
  • 61
  • 1
  • 3
4
votes
3 answers

Can i get notion page content using notion api?

I'm planning to make some blog using notion api. I would like to use the notion api to bring the notion page markdown and show on my blog. But, I can't find to get page content.. Is there a way to import page markdown content using api?
Yeummy
  • 157
  • 3
  • 7
1
2 3
19 20