Skip to content
On this page

Developer Blog

Importing Files in Directus Automate

Published May 23rd, 2024

Written By
Kevin Lewis
Kevin Lewis
Director, Developer Relations

In this quick tip, you will learn how to import files inside of Flows as part of Directus Automate.

Directus doesn’t ship with an operation to import files via URL the same way you can across the Data Studio. Thankfully, you can utilize the Directus API inside of Flows to achieve the same result.

Setting Up the Operation

In an existing Flow, create a Webhook / Request URL operation. All of the settings will match the File Import endpoint:

  • Method: POST
  • URL: your-directus-project/files/import , replacing your-directus-project your project URL
  • Request Body: { "url": "file_url" }

As noted in the API reference, you can also add a data object in the request body with any additional file object properties - like tags, description, or focal_point.


If you run a flow with the operation above, it will work if there is a public create permission on the directus_files collection. If this isn’t the case, generate a static access token for a user with the correct permission (you may need to create a ‘user’ for this purpose) and add a header:

  • Header: Authorization
  • Value: Bearer your-token , replacing your-token with the access token.

Returned Data

As we are using the API directly, this operation returns a full response body. That means the id of the new file is available at {{ }} , where step is your operation key, or $last in the following operation.


The only real limitation to this approach is that you must provide a fixed Directus Project URL - the operation does not allow relative URLs. Your project URL is unlikely to change, but updating any operations using this approach will be required.

Tell us what is missing

How helpful was this article?