0

I need to create a page for every single day in my database in notion, So can I create pages for each month in one request using notion-api?

Cagatay Barin
  • 3,428
  • 2
  • 24
  • 43

2 Answers2

3

No, only a single page can be created per request.

adlopez15
  • 3,449
  • 2
  • 14
  • 19
0

You need multiple requests to create multiple pages.

However, you can make them in parallel using Promise.all:

import { range } from "lodash-es";
import { Client } from "@notionhq/client";

const notion = new Client();

await Promise.all(
  range(1, 31).map((day) =>
    notion.pages.create({
      parent: {
        database_id: "...",
      },
      properties: {
        day,
      },
    })
  )
);
Nick McCurdy
  • 17,658
  • 5
  • 50
  • 82
  • Well, you'll probably hit the requests limit, according to the Notion documentation: "The rate limit for incoming requests is an average of 3 requests per second." – Alex MAN Oct 07 '22 at 08:03