Actions16
Overview
This node enables advanced interaction with Notion's API, specifically supporting the creation of databases among other resources. For the Database - Create operation, it allows users to create a new database within a specified parent page in Notion. This is useful for automating workspace setup, organizing data structures programmatically, or integrating Notion database creation into larger workflows.
Practical examples include:
- Automatically creating project tracking databases when a new project is initiated.
- Generating custom databases based on user input or external triggers.
- Setting up templated databases with predefined properties for consistent data entry.
Properties
| Name | Meaning |
|---|---|
| Additional Fields | Optional extra settings for the created database. Includes: |
| - Icon | Page icon, which can be an emoji or an image URL representing the database visually. |
| - Cover | URL for a cover image displayed on the database page. |
| - Archive | Boolean flag indicating whether the page should be archived upon creation (usually false). |
Note: The provided JSON only defines "Additional Fields" for the Database resource, but the code shows that the createDatabase method also accepts:
- Parent: ID of the parent page under which the database will be created.
- Title: The title of the new database.
- Properties: A collection of property definitions specifying the schema of the database.
These are required inputs for creating a database but were not included in the user's JSON snippet.
Output
The output JSON structure from the create database operation corresponds to the response from the Notion API's /databases endpoint after successful creation. It includes:
object: The type of object returned, typically"database".id: The unique identifier of the newly created database.title: The title of the database as an array of rich text objects.properties: An object describing the schema properties of the database.parent: Information about the parent page.- Other metadata fields as defined by the Notion API.
No binary data output is involved in this operation.
Dependencies
- Requires valid Notion API credentials configured in n8n to authenticate requests.
- Uses internal utility functions for:
- Resolving page IDs from input strings.
- Creating rich text objects.
- Making HTTP requests to the Notion API.
- The node depends on the Notion API being accessible and the user having permissions to create databases under the specified parent page.
Troubleshooting
- Invalid Credentials Error: If the node throws an error about invalid Notion API credentials, verify that the API key/token is correctly set up and has sufficient permissions.
- Invalid Parent ID: Providing an incorrect or inaccessible parent page ID will cause the creation to fail. Ensure the parent ID is correct and the authenticated user has access.
- Malformed Properties JSON: Property values must be valid JSON if complex types are used. Invalid JSON will cause errors during parsing.
- Missing Required Fields: Omitting required parameters like parent or title will result in errors.
- API Rate Limits: Frequent calls may hit Notion API rate limits; implement retry logic or reduce request frequency if needed.