Actions111
- Item Actions
- Webhook Actions
- Collection Actions
- File Actions
- Activity Actions
- Asset Actions
- Authentication Actions
- Extension Actions
- Field Actions
- Folder Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revision Actions
- Role Actions
- Setting Actions
- User Actions
- Utility Actions
Overview
This node allows you to create a new item in a specified collection within a Directus project. It is useful for automating the process of adding data records (such as articles, users, or any custom content type) to your Directus-managed database. Common scenarios include syncing data from other sources, batch-creating content, or integrating with forms and external APIs.
Example use cases:
- Automatically add new blog posts to a "articles" collection when a form is submitted.
- Sync product information from an e-commerce platform into a Directus collection.
- Create user profiles in bulk from another system.
Properties
| Name | Meaning |
|---|---|
| Collection Name | Unique name of the parent collection where the new item will be created. Options are loaded dynamically. |
| Data (JSON) | The partial item object in JSON format. This should contain the fields and values for the new record. |
Output
The output will be a JSON object representing the newly created item in the specified collection. The structure of this object depends on the fields defined in your Directus collection, but typically includes:
- The unique identifier of the new item (e.g.,
id) - All fields provided in the input data
- Any default or auto-generated fields set by Directus (e.g., timestamps)
Example output:
{
"id": 123,
"title": "Hello world!",
"body": "This is our first article",
"created_on": "2024-06-10T12:34:56Z"
}
Dependencies
- Requires access to a Directus instance (API endpoint).
- May require an API key or authentication credentials configured in n8n.
- The target collection must exist in Directus.
Troubleshooting
- Invalid Collection Name: If the specified collection does not exist, the node may throw an error indicating the collection was not found.
- Malformed JSON: If the "Data (JSON)" property contains invalid JSON, the node will fail to execute. Ensure your JSON is properly formatted.
- Missing Required Fields: If required fields for the collection are missing in the input data, Directus will return an error specifying which fields are missing.
- Authentication Errors: If credentials are incorrect or missing, you may see errors related to authorization or forbidden access.