Actions100
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Item Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
Overview
The Directus - Item: Create Multiple operation allows you to create multiple items (records) in a specified collection within your Directus instance in a single API call. This is particularly useful for batch importing data, migrating content, or automating the creation of several records at once.
Common scenarios:
- Bulk import of articles, products, users, or any custom data type managed by Directus.
- Migrating data from another system into Directus.
- Automating workflows where multiple related records need to be created together.
Example use case:
You have a list of new blog posts to add to your "articles" collection. Instead of creating each post individually, you can send them all at once using this node.
Properties
Name | Type | Meaning |
---|---|---|
Collection | options | Unique name of the parent collection where the items will be created. |
Data (JSON) | json | An array of partial item objects to create. Each object represents a record to insert. |
Output
- The output is an object with a
json
field containing the response from the Directus API. - On success, the
json
field contains the created item(s) as returned by Directus. The structure matches the fields of the collection and may include system fields likeid
,created_at
, etc. - Example output:
{ "json": [ { "id": 1, "title": "Hello world!", "body": "This is our first article" }, { "id": 2, "title": "Hello again, world!", "body": "This is our second article" } ] }
- If an error occurs and "Continue On Fail" is enabled, the output will contain an
error
property with the error message.
Dependencies
- Directus API: Requires access to a running Directus instance.
- API Credentials: You must configure the
directusApi
credentials in n8n with appropriate permissions to create items in the target collection.
Troubleshooting
Common issues:
- Invalid Collection Name: If the collection does not exist, you'll receive an error from Directus.
- Malformed JSON: If the "Data (JSON)" input is not valid JSON or not an array of objects, the node will throw a parsing error.
- Missing Required Fields: If required fields for the collection are missing in one or more item objects, Directus will reject those items.
- Permission Denied: If the API credentials lack permission to create items in the specified collection, the request will fail.
Error messages and resolutions:
"Cannot read property 'data' of undefined"
: Check that your Directus instance is reachable and the API credentials are correct."Request failed with status code 400"
: Usually indicates invalid input data; check your JSON structure and required fields."Collection not found"
: Verify the collection name is correct and exists in Directus.