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 - Field: List operation retrieves a list of fields (schema columns) for a specified collection within a Directus project. This is useful for dynamically discovering the structure of collections, automating schema documentation, or building user interfaces that adapt to the available fields in a collection.
Common scenarios:
- Generating dynamic forms based on collection fields.
- Validating data before inserting/updating items in a collection.
- Building admin panels or dashboards that need to display or interact with collection schemas.
Practical example:
Suppose you have a collection named articles
and want to fetch all its fields to build a custom content editor UI. This operation will return all field definitions for articles
, which you can then use to render appropriate input controls.
Properties
Name | Type | Meaning |
---|---|---|
Collection | options | The name of the collection whose fields you want to list. Required. |
Split Into Items | boolean | If enabled, outputs each field as a separate item; otherwise, returns an array of fields. |
Output
If Split Into Items is
false
:
The output is a single item with ajson
property containing an array of field objects, each representing a field in the specified collection.If Split Into Items is
true
:
Each field is output as a separate item, with thejson
property containing a single field object.
Field object structure:
Each field object typically includes properties such as:
field
: The field's name.type
: The data type of the field.interface
: The UI interface used for this field.options
: Additional configuration for the field.required
: Whether the field is required.- ...and other metadata as defined by Directus.
Note: The exact structure depends on your Directus instance and collection schema.
Dependencies
- Directus API: Requires access to a running Directus instance.
- API Credentials: You must configure n8n credentials for the "directusApi" credential type, including the API URL and authentication token.
Troubleshooting
Common issues:
- Invalid Collection Name: If the specified collection does not exist, you'll receive an error from the Directus API.
- Authentication Errors: Missing or invalid API credentials will result in authentication failures.
- Insufficient Permissions: The API user must have permission to read the schema/fields of the target collection.
Error messages and resolutions:
"Collection not found"
: Double-check the collection name spelling and existence in Directus."Unauthorized"
or"Forbidden"
: Ensure your API credentials are correct and have sufficient permissions."Network Error"
: Verify connectivity between n8n and your Directus server.