Skip to content
On this page

Directus Cloud

Everything you need to start building. Provisioned in 90 seconds. Starting at $15/month.

Get Started

Utilities

Utilities are the various helper endpoints located within the API.

Generate a Random String

Generate a random string of a given length.

Request

Query Parameters

length
Length of the string to generate.

Response

Generated string.

Example

Generate a Hash

Generate a hash for a given string.

Request

Request Body

string Required
String to hash.

Response

Hashed string.

Example

Verify a Hash

Verify a string with a hash.

Request

Request Body

string Required
Source string.

hash Required
Hash you want to verify against.

Response

Boolean.

Example

Manually Sort Items in Collection

If a collection has a sort field, this util can be used to move items in that manual order.

Request

Request Body

item Required
Primary key of the item you're moving in the collection.

to Required
Primary key of the item you're moving the source item too.

Response

Empty body.

Example

Import Data from File

Import multiple records from a JSON or CSV file into a collection.

Request

The import endpoint expects the file structure to match the export query parameter. For JSON, this is an array of objects, where every object is an item. For CSV, the first line has to be the columns header.

Request Body

Send the file in a multipart/form-data request. See Upload a File for more information.

Response

Empty body.

Export Data to a File

Export a larger data set to a file in the File Library

Request

Query Parameters

Doesn't use any query parameters.

Request Body

format Required
What file format to save the export to. One of csv, json, xml, yaml.

query Required
The query object to use for the export. Supports the global query parameters.

file File Object
Partial file object to tweak where / how the export file is saved.

Response

Empty body

Example

Clear the Internal Cache

Resets the data cache of Directus. Optionally, can also clear system cache. This endpoint is only available to admin users.

Returns

Empty body