Actions109
- Activity Actions
- Assets Actions
- Authentication Actions
- Collections Actions
- Extensions Actions
- Fields Actions
- Files Actions
- Folders Actions
- Items Actions
- Permissions Actions
- Presets Actions
- Relations Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
- Webhooks Actions
Items → Create Multiple
AI-generatedOverview
The Directus (DrWade) - Items: Create Multiple operation allows you to create multiple new items in a specified Directus collection in a single API call. This is particularly useful for bulk data imports, batch creation of records, or automating the population of collections with structured data.
Common scenarios:
- Importing a list of articles, products, users, or any other resource into Directus.
- Automating the migration of data from another system into Directus.
- Creating multiple related records as part of a workflow.
Practical example:
Suppose you have an array of blog posts and want to add them all at once to your "articles" collection in Directus. You can use this node operation to send the entire array in one go, rather than creating each item individually.
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 representing the items to create. Each object should match the schema of the target collection. |
Output
- The output is a
jsonfield containing the result of the bulk creation operation. - The structure typically matches the response from the Directus API for a bulk create, which is usually an array of the created item objects, each including their assigned IDs and any default values set by Directus.
Example output:
{
"data": [
{
"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 may include an
errorproperty with the error message.
Dependencies
- Directus API: Requires access to a running Directus instance.
- API Credentials: The node requires valid Directus API credentials (
directusApi) configured in n8n. - n8n Configuration: No special environment variables are needed beyond standard credential setup.
Troubleshooting
Common issues:
- Invalid Collection Name: If the specified collection does not exist, the API will return an error.
- Malformed JSON Data: If the "Data (JSON)" property is not a valid JSON array or does not match the collection schema, the request will fail.
- Insufficient Permissions: The API user must have permission to create items in the target collection.
- API Connection Errors: Network or authentication issues will prevent successful requests.
Error messages and resolutions:
"Collection not found": Check that the collection name is correct and exists in Directus."Invalid payload"or"Unexpected token": Ensure the JSON data is properly formatted."Unauthorized"or"Forbidden": Verify that the API credentials are correct and have sufficient permissions."Field 'xyz' is required": Make sure all required fields for the collection are included in each item object.