Actions16
Overview
This node operation creates new content blocks inside a specified parent block or page in Notion. It allows users to programmatically build complex and richly formatted Notion pages by adding various types of blocks such as paragraphs, headings, lists, images, code snippets, tables, and more.
Typical use cases include:
- Automating the generation of structured documents or reports.
- Dynamically building content pages with mixed media (text, images, embeds).
- Creating templates or standardized content layouts within Notion.
- Appending multiple blocks at once to an existing page or block.
For example, you could create a new section with a heading, followed by a bulleted list and an embedded image, all in one operation.
Properties
| Name | Meaning |
|---|---|
| Parent ID | The ID of the parent page or block where the new blocks will be created. This is required to specify the location in Notion's hierarchy. |
| Blocks | A collection of one or more blocks to create. Each block supports: - Type: The kind of block to create (e.g., Paragraph, Heading 1, Bulleted List Item, To Do, Code, Image, Table, etc.). - Content: Text or URL content for the block. - Rich Text (JSON): Richly formatted text as a JSON array. - Properties (JSON): Additional block properties like color, checked state, language, etc., provided as JSON. - Children (JSON): Child blocks nested inside this block, as a JSON array. |
| Additional Fields | Optional extra fields for the parent page/block: - Icon: Emoji or image URL to set as the page icon. - Cover: URL for the page cover image. - Archive: Boolean flag to archive the page. |
Output
The output is a JSON object representing the response from the Notion API after creating the blocks. It includes details about the newly created blocks under the specified parent, confirming their types, contents, properties, and hierarchical structure.
If binary data were involved (e.g., files or images), it would be summarized here, but this operation primarily deals with JSON block data.
Dependencies
- Requires valid Notion API credentials configured in n8n to authenticate requests.
- Uses Notion's official API endpoints to create and manage blocks.
- Relies on utility functions for parsing rich text, validating block structures, and resolving page/block IDs.
- No additional external services beyond Notion API are needed.
Troubleshooting
- Invalid Credentials Error: If the node throws an "Invalid Notion API credentials" error, verify that your API key/token is correctly set up and has sufficient permissions.
- No Blocks Provided: Errors like "No blocks provided" occur if the blocks input is empty or improperly formatted. Ensure at least one block is defined with correct JSON syntax for properties and children.
- Error Processing Block: If a block's properties or children JSON is malformed, the node will throw an error indicating which block failed. Validate JSON inputs carefully.
- Unknown Resource or Operation: Using unsupported resource or operation values will cause errors. Confirm you selected "Block" as resource and "Create" as operation.
- API Rate Limits: Large batch operations may hit Notion API rate limits; consider splitting requests or adding delays.