# Directus

> Keep your Directus content and data up to date: add items to any collection from forms and other apps, update them or add-or-update one matched by a field such as email, find and read them, and upload files. Start a workflow when an item is added or changed.

App · 9 actions. Web page: https://docs.lodol.com/docs/integrations/directus

## Actions

### Create item

Add an item to a collection, such as a blog post, a product or a lead from a form, with a value for each field you fill in.

**Inputs**

- Collection (`collection`, text, required): The collection to work with, such as posts. Pick it from the list, or type its name or paste a link to it from the Data Studio.
- Fields (`fields`, object, required): A value for each field to fill in. Fields left blank get their default. For a file or image field, give the ID that Upload file returns; for a related item, its ID.

**Outputs**

- `collection` (text): The collection it's in, such as posts
- `id` (text): The item's ID (its primary key), as text
- `item` (object): The item's fields and values, by field name, such as {"id": 12, "title": "Hello", "status": "published"}
- `link` (text): Where to open it in the Directus Data Studio

**Example output**

```json
{
  "collection": "posts",
  "id": "12",
  "item": {
    "body": "Written by a workflow.",
    "date_created": "2026-11-05T10:00:00.000Z",
    "date_updated": null,
    "id": 12,
    "status": "published",
    "title": "Hello from Lodol"
  },
  "link": "https://example.directus.app/admin/content/posts/12"
}
```

### Create or update item

Update the item whose value in the field you match on is the one given, such as a lead with this email address, or add it if there is none, so a workflow that runs twice never adds it twice.

**Inputs**

- Collection (`collection`, text, required): The collection to work with, such as posts. Pick it from the list, or type its name or paste a link to it from the Data Studio.
- Match on (`match_field`, text, required): The field that tells items apart, such as email. Give its value in Fields; its values should be unique.
- Fields (`fields`, object, required): A value for each field to fill in, including the one to match on. An existing item keeps the fields left blank. For a file or image field, give the ID that Upload file returns; for a related item, its ID.

**Outputs**

- `collection` (text): The collection it's in, such as posts
- `created` (true/false): True if the item was added, false if an existing one was updated
- `id` (text): The item's ID (its primary key), as text
- `item` (object): The item's fields and values, by field name, such as {"id": 12, "title": "Hello", "status": "published"}
- `link` (text): Where to open it in the Directus Data Studio

**Example output**

```json
{
  "collection": "posts",
  "created": true,
  "id": "12",
  "item": {
    "body": "Written by a workflow.",
    "date_created": "2026-11-05T10:00:00.000Z",
    "date_updated": null,
    "id": 12,
    "status": "published",
    "title": "Hello from Lodol"
  },
  "link": "https://example.directus.app/admin/content/posts/12"
}
```

### Delete file

Delete a file from Directus's file library, for good.

**Inputs**

- File ID (`file_id`, text, required): The file's ID, from Upload file or an item's file field, or its link copied from the file library.

**Outputs**

- `deleted` (true/false): True once the file is deleted
- `id` (text): The deleted file's ID

**Example output**

```json
{
  "deleted": true,
  "id": "8cbb43fe-4cdf-4991-8352-c461779cec02"
}
```

### Delete item

Delete one item of a collection, for good.

**Inputs**

- Collection (`collection`, text, required): The collection to work with, such as posts. Pick it from the list, or type its name or paste a link to it from the Data Studio.
- Item ID (`item_id`, text, required): The item's ID, such as 12, from the trigger or another Directus step, or a link to the item copied from the Data Studio.

**Outputs**

- `collection` (text): The collection it was in
- `deleted` (true/false): True once the item is deleted
- `id` (text): The deleted item's ID

**Example output**

```json
{
  "collection": "posts",
  "deleted": true,
  "id": "12"
}
```

### Find items

Find the items of a collection whose field matches a value, or that contain some words, sorted the way you choose. Leave the filter blank to list them all, a page at a time.

**Inputs**

- Collection (`collection`, text, required): The collection to work with, such as posts. Pick it from the list, or type its name or paste a link to it from the Data Studio.
- Filter by field (`filter_field`, text): Only items whose value in this field passes the filter. A related item's field can be named with a dot, such as author.email.
- Filter (`filter_operator`, text): How the field's value is compared. Contains ignores upper and lower case. One of: `equals`, `not_equals` (Does not equal), `contains`, `greater_than` (Greater than), `at_least` (Greater than or equal to), `less_than` (Less than), `at_most` (Less than or equal to), `one_of` (Is one of), `empty` (Is empty), `not_empty` (Is not empty). Default: `equals`.
- Filter value (`filter_value`, text): The value to compare with. For Is one of, give the values separated by commas. Only when Filter is Equals, Does not equal, Contains, Greater than, Greater than or equal to, Less than, Less than or equal to or Is one of.
- Advanced filter (`advanced_filter`, text): A Directus filter in JSON, for several conditions at once, such as {"status": {"_eq": "published"}, "views": {"_gt": 100}}. Used together with Filter by field.
- Search (`search`, text): Only items with these words in any of their text fields.
- Sort by (`sort_field`, text): The field to sort the items by. Leave blank for the collection's own order.
- Newest or highest first (`descending`, true/false): Sort from highest to lowest (newest first, Z to A). Default: `false`.
- How many (`limit`, number): The most items to return, up to 1000. Defaults to 100. From 1 to 1000.
- Page (`page`, number): Which page of results to return, starting at 1. At least 1.
- Fields to return (`return_fields`, list): Return only these fields. Leave empty for all of them. A related item's field can be named with a dot, such as author.first_name.

**Outputs**

- `collection` (text): The collection searched
- `count` (number): How many items are listed
- `ids` (list): The IDs of the items listed, as text
- `items` (list): The items that match, each with its fields by name
- `total` (number): How many items match in all, across every page

**Example output**

```json
{
  "collection": "posts",
  "count": 1,
  "ids": [
    "12"
  ],
  "items": [
    {
      "body": "Written by a workflow.",
      "date_created": "2026-11-05T10:00:00.000Z",
      "date_updated": null,
      "id": 12,
      "status": "published",
      "title": "Hello from Lodol"
    }
  ],
  "total": 1
}
```

### Get item

Read one item of a collection by its ID, with its fields.

**Inputs**

- Collection (`collection`, text, required): The collection to work with, such as posts. Pick it from the list, or type its name or paste a link to it from the Data Studio.
- Item ID (`item_id`, text, required): The item's ID, such as 12, from the trigger or another Directus step, or a link to the item copied from the Data Studio.
- Fields to return (`return_fields`, list): Return only these fields. Leave empty for all of them. A related item's field can be named with a dot, such as author.first_name.

**Outputs**

- `collection` (text): The collection it's in, such as posts
- `id` (text): The item's ID (its primary key), as text
- `item` (object): The item's fields and values, by field name, such as {"id": 12, "title": "Hello", "status": "published"}
- `link` (text): Where to open it in the Directus Data Studio

**Example output**

```json
{
  "collection": "posts",
  "id": "12",
  "item": {
    "body": "Written by a workflow.",
    "date_created": "2026-11-05T10:00:00.000Z",
    "date_updated": null,
    "id": 12,
    "status": "published",
    "title": "Hello from Lodol"
  },
  "link": "https://example.directus.app/admin/content/posts/12"
}
```

### List collections

List the collections the token can see, with each one's fields, their types and the ones a new item must be given.

**Inputs**: None.

**Outputs**

- `collections` (list): The collections the token can see
- `count` (number): How many collections there are

**Example output**

```json
{
  "collections": [
    {
      "collection": "posts",
      "created_field": "date_created",
      "fields": [
        {
          "field": "id",
          "required": false,
          "type": "integer",
          "writable": false
        },
        {
          "field": "title",
          "required": true,
          "type": "string",
          "writable": true
        },
        {
          "field": "date_created",
          "required": false,
          "type": "timestamp",
          "writable": false
        }
      ],
      "name": "Posts",
      "note": "Blog posts",
      "primary_key": "id",
      "required_fields": [
        "title"
      ],
      "singleton": false,
      "updated_field": ""
    }
  ],
  "count": 1
}
```

### Update item

Change some fields of an item. Fields left blank keep their value.

**Inputs**

- Collection (`collection`, text, required): The collection to work with, such as posts. Pick it from the list, or type its name or paste a link to it from the Data Studio.
- Item ID (`item_id`, text, required): The item's ID, such as 12, from the trigger or another Directus step, or a link to the item copied from the Data Studio.
- Fields (`fields`, object, required): The new value for each field to change. Fields left blank keep their value. For a file or image field, give the ID that Upload file returns; for a related item, its ID.

**Outputs**

- `collection` (text): The collection it's in, such as posts
- `id` (text): The item's ID (its primary key), as text
- `item` (object): The item's fields and values, by field name, such as {"id": 12, "title": "Hello", "status": "published"}
- `link` (text): Where to open it in the Directus Data Studio

**Example output**

```json
{
  "collection": "posts",
  "id": "12",
  "item": {
    "body": "Written by a workflow.",
    "date_created": "2026-11-05T10:00:00.000Z",
    "date_updated": null,
    "id": 12,
    "status": "published",
    "title": "Hello from Lodol"
  },
  "link": "https://example.directus.app/admin/content/posts/12"
}
```

### Upload file

Add a file to Directus's file library, such as an image or a PDF, to put in an item's file or image field with its ID.

**Inputs**

- File (`file`, text, required): The file: upload one, pick one from an earlier step, or give a public https link to download.
- Title (`title`, text): What the file is called in the library. Defaults to one made from its name.
- Folder (`folder`, text): The library folder to put it in. Leave blank for the top of the library.

**Outputs**

- `asset_url` (text): Its address for download; needs a token unless the Public role may read files
- `filename` (text): The name it downloads as
- `folder` (text): The ID of the folder it's in; empty for the top of the library
- `height` (number): An image's height in pixels; 0 for other files
- `id` (text): The file's ID; put it in a file or image field to attach it
- `link` (text): Where to open it in the Data Studio's file library
- `size` (number): Its size in bytes
- `title` (text): The file's title
- `type` (text): Its type, such as image/png or application/pdf
- `uploaded_on` (text): When it was uploaded (ISO 8601)
- `width` (number): An image's width in pixels; 0 for other files

**Example output**

```json
{
  "asset_url": "https://example.directus.app/assets/8cbb43fe-4cdf-4991-8352-c461779cec02",
  "filename": "invoice-1042.pdf",
  "folder": "",
  "height": 0,
  "id": "8cbb43fe-4cdf-4991-8352-c461779cec02",
  "link": "https://example.directus.app/admin/files/8cbb43fe-4cdf-4991-8352-c461779cec02",
  "size": 48213,
  "title": "Invoice 1042",
  "type": "application/pdf",
  "uploaded_on": "2026-11-05T10:00:00.000Z",
  "width": 0
}
```
