menuclose
Introduction

The Directus API v1.0

Connect your data with our RESTful API and SDKs

Access to your instance's data is simple. Authenticate with a user's access token and the API inherits all of their system privileges.

It is important to remember that the Directus API is dynamic based on your database schema/architecture. That means that if you change a column or table name, the respective API endpoints will also change. So if you adjust your schema it is important to update any existing endpoints in your application code.

Note: We recommend encrypting all Directus traffic over HTTPS

Note: The Directus Hosted Service encrypts all traffic over HTTPS

Other Versions

A newer version (1.1) of the Directus API is available below. This version is still in beta and requires version 6.3.6 of Directus.

http://api.getdirectus.com/1.1/

Error Responses

Not Authenticated

You must be logged in to Directus to access the API. Some high-level view permissions (ex. table-listing) are not strictly enforced by privileges, just general authentication.

Parse

Any non-JSON response: Error

Custom Endpoints

To add custom endpoints into Directus, simply create new sandboxed endpoints using Slim routes for any custom files.

Translations & Locales

@TODO

Authentication

Authentication privileges are inherited from the user-group that the key was generated from.

API Key

A single consumer-key is generated for each user which is passed as a parameter with every API resource that uses this type. Used with all GET Resources

Authentication is perform by using your private account API Key. You can generate API keys here. @TODO

Authentication can be done in three different ways:

Request API Key

Using a user credentials you can get its API token key by sending a POST request to /api/1.1/auth/request-token.

curl -d "email=user@directus.local&password=pass123" https://account-instance.directus.io/api/1.1/auth/request-token

On a successful request the API will respond with the json below:

{
  "success": true,
  "data": {
    "token": "userAPIToken"
  }
}

Otherwise with the json below:

{
  "success": false,
  "error": {
    "message": "Incorrect email or password"
  }
}

HTTP Basic Auth

curl -u Py8RumuLD7HE5juFrOR5: https://account-instance.directus.io/api/1.1/tables

Pay attention to the colon after the API key, it's not part of the API key.

Bearer Auth

Instead of using -u Py8RumuLD7HE5juFrOR5: it can be used Authentication header.

curl -H "Authorization: Bearer Py8RumuLD7HE5juFrOR5" https://account-instance.directus.io/api/1.1/tables

Query String

curl https://account-instance.directus.io/api/1.1/tables?access_token=Py8RumuLD7HE5juFrOR5

Security

All API calls pass through ACL

Passwords

Directus generates random salts when a password is hashed, encodes the hash-type, salt and stretching iteration count into the “hash encoding string”. During the comparison, it reads this string to retrieve necessary information.

Database Security

Timing Attacks

While account email probing is theoretically possible, you can dummy salt so consistent response time if desired.

Password Reset

When a new password is requested, the existing password is NULLified and a new unique password token is sent to the account's email address.

XSS

While internal XSS may be possible, successfully authenticated users are assumed to be non-malicious. This was a design decision to give full control to any connected applications. All malicious data needs to be sanitized in the web-application/data entry point, else the database and therefore Directus could become compromised.

Session Hijacking

Currently, nothing is done to minimize potential attacks via session hijacking. One possible advancement would be to validate the session with request metadata to provide partial security.

API Endpoints

Base API URL: {{DIRECTUS_ROOT}}/api/1/

Type Resource Description
GET /tables Collection of tables viewable by current user
GET /tables/[table-name]/rows Collection of rows (items) for a given table
GET /tables/[table-name]/rows/[id] Details for a specific table row (item)
GET /tables/[table-name]/columns Collection of the column details for a given table
GET /tables/[table-name]/columns/[column-name] Details for a specific column in a given table
GET /privileges/[group-id] Privileges for a given user-group
GET /groups Collection of all Directus user-groups
GET /groups/[id] Details for a specific user-group
GET /preferences/[table-name] Preferences for a specific table
GET /bookmarks Bookmarks for currently authenticated user
GET /bookmarks/[id] Bookmarks for a specific user
GET /messages/rows Collection of messages for the authenticated user
GET /messages/rows/[id] Details for a specific message
GET /activity Collection of latest Directus activity

Global Parameters

Parameter Example Description
currentPage 0, 1, 2 Current page for paginated results
perPage 100, 200, 300 Number of results per page
sort id, title, date_uploaded Column to sort results upon
sort_order ASC, DESC Order direction for sorting
status 1, 1,2, 2 Filter by a CSV of status values for tables with a status column such as active
columns_visible title, date Name of column shown in results. Can be chained such as: columns_visible=title&columns_visibile=first_name

Example API Requests

GET privileges/:groupId/

Returns JSON object of the privileges for a given group

Example Request

GET http://directus.dev/api/1/privileges/1

[
  {
    "id": "23",
    "table_name": "countries",
    "permissions": "add,edit,bigedit,delete,bigdelete,alter,view,bigview",
    "group_id": "0",
    "read_field_blacklist": null,
    "write_field_blacklist": null,
    "unlisted": null
  },
  {
    "id": "1",
    "table_name": "directus_activity",
    "permissions": "add,edit,bigedit,delete,bigdelete,alter,view,bigview",
    "group_id": "0",
    "read_field_blacklist": null,
    "write_field_blacklist": null,
    "unlisted": null
  },
  {
    "id": "18",
    "table_name": "directus_bookmarks",
    "permissions": "add,edit,bigedit,delete,bigdelete,alter,view,bigview",
    "group_id": "0",
    "read_field_blacklist": null,
    "write_field_blacklist": null,
    "unlisted": null
  }
]

GET tables/:table/rows/

Returns a collection of table entries the authenticated user has permission to view

Parameter Example Description
ids 1,2,3,5,6,7,8 Comma delimited list of ids to return

Example Request

GET http://directus.dev/api/1/tables/directus_users/rows

{
  "active": 1,
  "inactive": 0,
  "trash": 0,
  "total": 1,
  "rows": [
    {
      "id": 3,
      "active": 1,
      "first_name": "John",
      "last_name": "Smith",
      "email": "john.smith@example.com",
      "password": "asfafspojd92en1oi2n31b412ubb1n",
      "salt": "5329e597d9afa",
      "position": "",
      "email_messages": 1,
      "last_login": null,
      "last_access": null,
      "last_page": "",
      "ip": "",
      "group": {
            "id": 0,
            "name": "Administrator",
            "description": null,
            "restrict_to_ip_whitelist": 0
      },
      "avatar": null,
      "location": "",
      "phone": "",
      "address": "",
      "city": "",
      "state": "",
      "zip": ""
    }
  ]
}

PHP SDK

Creating data

Method Parameters Description
createItem table, data Creates a new item in the given table.
createActivity data Creates an activity log.
createBookmark data Creates a bookmark.
createColumn data Creates a new column.
createFile data Creates a new file.
createGroup data Creates a new group.
createMessage data Creates/Sends a new messsage.
sendMessage data createMessage alias.
createPreferences data Creates a table preferences.
createPrivileges data Creates a table privileges (Permissions).
createSettings data Creates a new setting.
createTable name, params Creates a new table.
createUIOptions data Creates a new UI options.
createUser data Creates a new user.

Create Item

Parameters Type Description
table String The Table name where the data are going to be inserted.
data Array Data to be inserted in table. All this data attributes will depend on your table columns.

Returns

An Entry object containing the new created item.

Example:

$article = $client->createItem('articles', [
  'title' => 'New Article',
  'body' => 'Some text'
]);

// echo $article->title;

Create Bookmark

Column Type Description
table_name String Bookmark Table name
title String Bookmark title
columns_visible String List of column separated by comma.
search_string String List of filters separated by comma. Format column:operator:value
sort String Sort column.
sort_order String Sort column order. (ASC or DESC)
status String List of status separated by comma.

Returns

An Entry object containing the new bookmark created.

Example:

$bookmark = $client->createBookmark([
  'title' => 'Draft Articles',
  'table_name' => 'articles',
  'status' => '2'
]);

// echo $bookmark->title;

Create Column

Column Type Description
name String Column name.
table String Table name.
type String Data type.
ui String UI name
hidden_input Boolean Whether the column will be hidden in the edit form.
hidden_list Boolean Whether the column will be hidden in the list page.
required Boolean Whether the column is required.
sort String Sort position in number.
comment String Note on the column.
relationship_type String Column relationship type, ONETOMANY, MANYTOMANY or MANYTOONE
related_table String The table name this column is related to.
junction_table String The pivot/junction table that joins the column's table with the related table
junction_key_left String The column name in junction that is related to the column's table.
junction_key_right String The column name in junction that is related to the related table.

@TODO Make most of the attributes "guessed/automated", for example single_ui should should has related_table to directus_files and junction_key_right to the same column name.

Example:

$column = $client->createColumn([
    'name' => 'title',
    'table' => 'articles',
    'type' => 'varchar',
    'ui' => 'textinput',
    'length' => 255
]);
$column = $client->createColumn([
    'name' => 'image',
    'table' => 'articles',
    'type' => 'int',
    'ui' => 'single_file',
    'related_table' => 'directus_files',
    'junction_key_right' => 'image' // same as the title
]);
$column = $client->createColumn([
    'name' => 'posts',
    'table' => 'authors',
    'type' => 'ALIAS',
    'ui' => 'one_to_many',
    'relationship_type' => 'ONETOMANY',
    'related_table' => 'articles',
    'junction_key_right' => 'author'
]);

Create Group

Column Type Description
name String Group name.
restrict_to_ip_whitelist String List of IPs allowed to authenticate, separated by comma.

Example:

$group = $client->createGroup([
    'name' => 'Editors'
]);

Create/Send Messages

Column Type Description
from Integer Sender user id.
to Array List of users id, separated by comma.
toGroup Array List of groups id, separated by comma.
subject String Message subject.
message String Message content.
attachements Array @TODO List of files to add to the message

@TODO Send/Create responses without the need to specify each recipients.

Returns

Entry object containing the new created message.

Example:

Sending message to two users.

$message = $client->createMessage([
    'from' => 1,
    'to' => [2, 5],
    'subject' => 'New Design review',
    'message' => 'I want some feedback on this new design.'
]);

Sending message to two groups.

// same as createMessage
$message = $client->sendMessage([
    'from' => 1,
    'toGroup' => [1, 3], // 1 = Administrator, 3 = Editors
    'subject' => 'Tomorrow Meeting',
    'message' => 'I want to you all know that tomorrow meeting was cancelled.'
]);

Message Item attributes

Attribute Type Description
id Integer Message ID
from Integer Sender ID
recipients String List of Recipients separated by comma. @TODO: it should be an array.
subject String Message subject
responses Array List of responses messages
response_to Integer Parent message (replied to this message id)
read Integer Whether the message was read by the authenticated user. @TODO It should be bool

Create Preferences

Column Type Description
user Integer User ID that this preferences belongs to.
table_name String Table name that this preferences belongs to.
columns_visible String List of visible column separated by comma.
sort String Sort column.
sort_order String Sort column order. ASC or DESC
status String List of status separated by comma.

Returns

An Entry object containing the new preference created.

Example:

$preference = $client->createPreferences([
  'user' => 1,
  'table_name' => 'articles',
  'columns_visible' => 'title,content,author,published_date'
  'status' => '2'
]);

// echo $preference->columns_visible;

Create Privileges (Permissions)

Column Type Description
group_id Integer Group ID
table_name String Table name that this permissions belongs to.
allow_add Integer Whether the group is allow to add/create entries in the table. (See values below)
allow_edit Integer Whether the group is allow to edit/update entries in the table. (See values below)
allow_delete Integer Whether the group is allow to delete/remove entries in the table. (See values below)
allow_view Integer Whether the group is allow to view/read entries in the table. (See values below)
allow_alter Integer Whether the group is allow to add/create entries in the table. (See values below)
nav_listed Boolean Whether the table should be visible in the sidebar.
read_field_blacklist String List of columns that the group can't view/read.
write_field_blacklist String List of columns that the group can't edit/update.
status_id String State of the record that this permissions belongs to. (Draft, Active or Soft Deleted)

Permissions: 0=Cannot, 1=Can (Your own), 2=Can (all) @TODO Adding constant for the permissions value.

Returns

An Entry object containing the new privileges created.

Example:

$privileges = $client->createPrivileges([
  'group_id' => 2,
  'table_name' => 'articles',
  'allow_edit' => 2,
  'allow_delete' => 0,
  'write_field_blacklist' => 'title,published_date'
]);

// echo $privileges->allow_edit;

Create Table

Parameters Type Description
name String New table name
data Array Not defined yet.

Returns

An Entry object containing the new table created privileges.

Example:

$privileges = $client->createTable('comments');

// echo $privileges->allow_edit;

Create Column Options

Column Type Description
column String Column name.
table String Column table name.
ui String Coolumn UI name.
options Array UI Options.

Returns

Entry object containing all the column options.

Example:

$options = $client->createColumnUIOptions([
    'column' => 'slug',
    'table' => 'articles',
    'ui' => 'textinput',
    'options' => [
        'readonly' => 1,
        'placeholder' => 'Title slug'
    ]
]);

// echo $options->placeholder;

Create User

Column Type Description
active Integer User's status. By default 1=active, 2-inactive, 3=deleted.
email Required String User's unique email address.
first_name String User first name.
last_name String User last name.
password String Plain text password.
token String User's unique API access token
group Integer User's group ID
email_messages Boolean Whether the user wants to receive email notification.
avatar String Avatar url
avatar_file_id Integer Use a file id as avatar
language String User's default language. Language Supported en (English), es (Spanish), de (German), fr (French), it (Italian), zh-hans (Simplified Chinese) and nl (Dutch).
timezone String User's default timezone.
position String User's position on the project/company.
location String User's location in the world or universe.
phone String User's phone number
address String User's address
city String User's city
state String User's state
zip String User's zip code

Returns

An Entry object containing the new created user (User Object Model).

Example:

$user = $client->createUser([
  'email' => 'user@website.local',
  'first_name' => 'John',
  'last_name' => 'Bohannon',
  'password' => 'plain-text-password',
  'token' => 'secret-token'
]);

// echo $user->email;
// @TODO: echo $user->getEmail(); (UserEntry Object)

Create File

Parameters Type Description
file File New file
File Parameters Type Description
path Required String Local path of the file.
url (TODO) String URL of the file to upload, OR a youtube/vimeo link to be embeded.
title String File's title
tags String Comma separated tags.
caption String File caption (Description).

Returns

An Entry object containing the new created file (File Object Model).

@TODO Returns a FileEntry Object.

Example:

// From a local file
$file = $client->createFile(new File('/path/to/the/file.jpg', [
  'title' => 'Company Group picture',
  'tags' => 'company, employees, team',
  'caption' => 'Whole company at Christmas party'
]);

// echo '<h1>' . $file->title . '</h1>;
// echo '<p>' . $file->caption . '</p>';
// echo '<img src="' . $client->getBaseUrl() . $file->url . '">';
// @TODO: $file->getTitle();

@TODO

File Item object attributes

Column Type Description
id Integer File ID
active Integer File's status. 1=active, 2=inactive, 3=deleted.
name String File name
title String File's title
location String Location of where the picture was taken. if any.
type String File mime type
url String File url relativity to Directus base url
tags String Comma separated tags.
caption String File caption (Description).
width Integer File width.
height Integer File height.
size Integer File size in bytes.
embed_id String ID of the embedded file. Ex Youtube ID
user Integer File owner (who uploaded the file)
date_uploaded String File uploaded date. @TODO It should be an DateTime object.
storage_adapter String Storage adapter used to upload the file

Getting Data

Method Parameters Description
getEntries table, params Collection of rows (items) for a given table.
getItem table, id, params Details for a specific table row (item).
getUsers params Collection of users.
getUser id, params Details for a specific user.
getFiles params Collection of files.
getFile id, params Details for a specific file.
getGroups params Collection of all Directus user-groups.
getGroup id, params Details for a specific user-group.
getGroupPrivileges group_id Privileges for a given user-group.
getSettings None All Directus Settings.
getSettingsByCollection collection All Directus Settings in a given collection.
getMessages userId Collection of messages for the authenticated user.
getTables params Collection of tables viewable by authenticated user.
getTable table Collection of latest Directus activity.
getColumns table, params Collection of the column details for a given table.
getColumn table, column Details for a specific column in a given table.

@TODO: More helpers

Returns

An Entry or EntryCollection object containing the fetched data.

Get Entries

Parameters Type Description
table String The Table name to fetch data from.
params Array Customiziable options.
$articles = $client->getEntries('articles');

foreach($articles as $article) {
  echo $article->title;
}

Get Item by ID

Parameters Type Description
table String The Table name to fetch data from.
id Mixed The record id.
$article = $client->getItem('articles', 1);
echo $article->title;

Get Users

Parameters Type Description
params Array Customizable options.
$users = $client->getUsers([
  'orders' => ['email' => 'ASC']
]);

foreach($users as $user) {
  echo $user->email;
}

Get User by ID

Parameters Type Description
id Integer The user id.
$user = $client->getUser(1);
echo $user->email;

@TODO

Returns

An Entry object containing the user information (User Object Model.

Get Files

Parameters Type Description
params Array Customizable options.
$files = $client->getFiles([
  'orders' => ['size' => 'DESC']
]);

foreach($files as $file) {
  echo $file->email;
}

Get File by ID

Parameters Type Description
id Integer The file.
$file = $client->getFile(1);
echo $file->name;

@TODO

Returns

A FileEntry object containing the file information.

Get Groups

Parameters Type Description
params Array Customizable options.
$groups = $client->getGroups([
  'orders' => ['name' => 'ASC']
]);

foreach($groups as $group) {
  echo $group->name;
}

Get Group by ID

Parameters Type Description
id Integer The group id.
$group = $client->getGroup(1);
echo $group->name;

@TODO

Returns

A GroupEntry object containing the group information.

Get Group Privileges

Parameters Type Description
id Integer The group id.
$privileges = $client->getGroupsPrivileges(1);

foreach($privileges as $privilege) {
  echo $privilege->table_name;
  echo $privilege->allow_view;
}

Get Settings

Parameters Type Description
None
$settings = $client->getSettings();
echo $settings->global->project_name

@TODO

Returns

A SettingEntry object containing the setting information.

Get Settings by collection

Parameters Type Description
collection String Name of the collection
$settings = $client->getSettingsByCollection('global');
echo $settings->project_name

Get Message

Parameters Type Description
user Integer The user id.

@TODO: INCORRECT: This returns a single message, and the parameters is a message id.

Get Tables

Parameters Type Description
params Array Customizable options.
$tables = $client->getTables([
  'include_system' => 1
]);

foreach($tables as $table) {
  echo $table->name;
}

Params

Parameters Type Description
include_system Boolean Include the core tables

Get Table

Parameters Type Description
table String The Table name.
params Array Customizable options.
$table = $client->getTable('directus_groups');
echo $table->name;

Get Table Columns

Parameters Type Description
table String The Table name.
params Array Customizable options.
$columns = $client->getTableColumns('articles');

foreach($columns as $column) {
  echo $column->name;
}

Get Table Column

Parameters Type Description
table String The Table name.
column String The column name.
$column = $client->getTableColumn('articles', 'title');
$isRequired = $column->required;

Returns

A Entry object containing the setting information.

Get data Parameters list

orders

Sort the result by one or more columns.

$params = [
  'orders' => [
    'id' => 'ASC',
    'title' => 'DESC'
  ]
];

orderBy

Sort by only one column.

$params = [
  'orderBy' => 'title'
];

orderDirection

Sort orderBy in this direction. ASC or DESC. Default to ASC.

$params = [
  'orderBy' => 'title',
  'orderDirection' => 'DESC'
];

Limit

Limit the numbers of records to be returned.

$params = [
  'limit' => 100
];

Offset

Skip this many rows.

$params = [
  'limit' => 100,
  'offset' => 50
];

status

Return only records that has this status. To include multiple status, it has to be separated by comma.

$params = [
  'status' => [1, 2]
];

ids

A comma-separated list of IDs.

$params = [
   'ids' => [2, 4, 11]
];

Filters

Filter the request by using any of the supported operators.

$params = [
  'filters' => [
    'column_name' => ['operator' => 'value']
  ]
];

$articles = $client->getEntries('articles, [
  'filters' => ['title' => ['like' => 'movies']]
]);

Supported Operators

Operator Description
=, eq Equal to
<>, !=, neq Not Equal to
<, lt Less than
<=, lte Less than or equal to
>, gt Greater than
>=, gte Greater than or equal to
in Match one of the value in the list
nin Not match any value in the list
null Is Null
nnull (TODO) Is Not Null
contains (TODO) Contains a string
ncontains (TODO) Not Contains a string
between (TODO) Is Between
empty (TODO) Is Emtpy
nempty (TODO) Is Not Empty
has (TODO) Has one or more related entries

Joins

Join additional tables to compare while finding data.

type is optional and defaults to INNER but may also be LEFT, RIGHT or another value, as supported by the database.

$params = [
    'joins' => [
        'authors' => [
            'on' => [
                'authors.id',
                'articles.author'
            ],
            'type' => 'INNER'
       ]
    ]
];

$articles = $client->getEntries('articles, [
    'joins' => [
        'authors' => [
            'on' => [
                'authors.id',
                'articles.author'
            ],
            'type' => 'INNER'
       ]
    ],
    'filters' => [
        'authors.name' => ['=' => 'James']
    ]
]);

Updating data

Method Parameters Description
updateItem table, id, data Updates the record with the given id in table with data.
updateUser id, data Updates the given user id with the given data.
updateFile id, data Updates the give file id with the given data.

@TODO More helpers

Returns

An Entry object containing the updated data.

Update Item

Parameters Type Description
table String The Table name.
id Mixed The id of the record to update.
data Array Data to update.

Update User

Parameters Type Description
id Integer The id of the user to update.
data Array Data to update.

User data

The data that can be updated can be found in the User Object Model

Update File

Parameters Type Description
id Integer The id of the file to update.
data Array File Data to update.

Example:

$updatedFile = $client->updateFile(1, ['title' => 'New Design']);

// echo $updatedFile->title;
$updatedFile = $client->updateFile(1, new File('/path/to/file'));

// echo $updatedFile->url;

Deleting data

Method Parameters Description
deleteItem table, id Deletes the record with the given id in table.
deleteBookmark id Deletes the given bookmark id.
deleteColumn name. table Deletes the tiven column name in the given table name.
deleteFile id Deletes the give file id.
deleteGroup id Creates a new group.
deleteTable name Creates a new table.
deleteUser id Deletes the given user id.

Returns

Nothing is returned.

@TODO: Return whether or not were deleted.

Delete Item

Parameters Type Description
table String The table name
id Integer The id of the record to delete in table.

Example:

$client->deleteItem('articles', 1);

Delete Bookmark

Parameters Type Description
id Integer The id of the bookmark to delete.

Example:

$client->deleteBookmark(1);

Delete Column

Parameters Type Description
name String The column name to delete.
table String The table the colum belongs to.

Example:

$client->deleteColumn('slug', 'articles');

Delete File

Parameters Type Description
id Integer The id of the file to delete.

Example:

$client->deleteFile(1);

Delete Group

Parameters Type Description
id Integer The id of the group to delete.

Example:

$client->deleteGroup(1);

Delete Table

Parameters Type Description
name String The name of the table to delete.

Example:

$client->deleteTable('comments');

Delete User

Parameters Type Description
id Integer The id of the user to delete.

Example:

$client->deleteUser(1);

Installation & Usage

Install the package via npm npm install directus-sdk-javascript

Initialize the SDK object with your the desired api key and url

const SDK = require('directus-sdk-javascript');

const client = new SDK(
  'api-key-12345',
  'http://directus.url/api/', // Directus-hosted or own server
  1.1 // API Version
);

All methods can be used with either callbacks or promises.

client.getEntries('projects', (err, res) => {
  if(err) throw err;
  console.log(res);
});
client.getEntries('projects')
  .then(res => {
    console.log(res);
  })
  .catch(err => {
    throw err;
  });

Directus Objects

These are the Directus object models used throughout the system.

File Object

Attribute Description
id Integer File Unique Identification number.
active Integer File's status. 1=active, 2=inactive, 3=deleted.
name String File name
title String File's title
location String Location of where the picture was taken. if any.
type String File mime type
url String File url relativity to Directus base url
tags String Comma separated tags.
caption String File caption (Description).
width Integer File width.
height Integer File height.
size Integer File size in bytes.
embed_id String ID of the embeded file. Ex Youtube ID
user Integer File owner (who uploaded the file)
date_uploaded String File uploaded date. TODO It should be an DateTime object.
storage_adapter String Storage adapter used to upload the file

User Object

Attribute Description
id Integer User's Unique Identification number.
active Integer User's status. 1=active, 2=inactive, 3=deleted.
email String User's unique email address.
first_name String User first name.
last_name String User last name.
password String hashed password.
token String User's unique API access token
group Integer User's group ID
email_messages Boolean Whether the user wants to receive email notification.
avatar String Avatar url
avatar_file_id Integer File id used as avatar
language String User's default language. Language Supported en (English), es (Spanish), de (German), fr (French), it (Italian), zh-hans (Simplified Chinese) and nl (Dutch).
timezone String User's default timezone.
position String User's position on the project/company.
location String User's location in the world or universe.
phone String User's phone number
address String User's address
city String User's city
state String User's state
zip String User's zip code

Filters

Filters are a way to refine listing results based on one or more conditions.

Important: Filters are only available in API 1.1.

How to use

To add a filter you have to use the query param key filters with the following format: filters[column-name][operator]=value

Example: Fetching customers from United States

api/1.1/tables/customers/rows?filters[country][eq]=us

api/1.1/tables/customers/rows is the endpoint where all the rows are returned, limited by the default limit, which is 200.

filters[country][eq]=us filters the customers to only those with country equal to us.

Also filters[country][eq]=us can be simplified to filters[country]=us

To add another filter you have to separate each filters with the ampersand symbol (&).

Example: Fetching customers from New York, United States

api/1.1/tables/customers/rows?filters[country][eq]=us&filters[state][eq]=ny

Example: Fetching customers from New York and New Mexico, United States

api/1.1/tables/customers/rows?filters[country][eq]=us&filters[state][in]=ny,nm

By default all condition are grouped in AND logical operators, the example below will explain how to use or operator:

Example: Fetching customers from New York and New Mexico OR Oregon and Louisiana, United States

api/1.1/tables/customers/rows?filters[country][eq]=us&filters[state][in]=ny,nm&filters[state][logical]=or&filters[state][in]=or,la

Note: Directus does not support relational filtering or multiple filters for the same column (yet).

Supported Operators

Operator Description
=, eq Equal to
<>, !=, neq Not Equal to
<, lt Less than
<=, lte Less than or equal to
>, gt Greater than
>=, gte Greater than or equal to
in Match one of the value in the list
nin Not match any value in the list
null Is Null
nnull Is Not Null
contains Contains a string
ncontains Not Contains a string
between Is Between
empty Is Emtpy
nempty Is Not Empty
has Has one or more related entries
Items

Create Item

Create a new item in the given table.

Note: Table names are case-sensitive

Note: These arguments and attributes are based on the table's custom columns

Request

POST /api/1/tables/[table-name]/rows
Name Value Description
table string Required The table name within which the record will be added. The custom column arguments below must match this table's schema.
Custom Data various This data and its architecture is based on your specific project's schema.

Example Request

$ curl --data "active=1&title=School+Website" \
        https://database.account.directus.io/api/1/tables/projects/rows \
                -u usrSTeeornngkti:
$client->createItem('projects', [
    'active' => 1,
    'title' =>  'School Website'
]);
client.createItem('projects', {
  active: 1,
  title: 'School Website'
});

Response

Attribute Description
meta object The Directus system metadata object that provides useful information not contained within the dataset itself. Meta Object: View Nested Attributes
Custom Data object This data and its architecture is based on your specific project's schema.

Example Response

{
  "id": 1,
  "active": 1,
  "title": "School Website"
}

Get Items

Note: Table names are case-sensitive

Note: These arguments and attributes are based on the table's custom columns

GET /api/1/tables/[table-name]/rows

Retrieve a collection of items within a specific table. Which columns are visible is determined by the current user's privileges.

Name Value Description
perPage int Default 200 The number of items to request
currentPage int Default 1 The offset for for the items
sort string Default id The column used to sort the items
sort_order string Default ASC Order to be sorted. Available options are: ASC (Ascending) or DESC
status string Default 1 List of status values to be included. Separated by commas. 1,2
in[field] sting Optional Only list records that its field matches one of given value. Can be separated by commas. in[id]=1,2

Example Request

$ curl https://database.account.directus.io/api/1/tables/projects/rows \
        -u usrSTeeornngkti:
$items = $client->getItems('projects');
client.getItems('projects');

Response

Attribute Description
meta object The Directus system metadata object that provides useful information not contained within the dataset itself. Meta Object: View Nested Attributes
data object This data and its architecture is based on your specific project's schema.

Example Response

{
  "Delete": 0,
  "Active": 1,
  "Draft": 0,
  "total": 1,
  "rows": [
    {
      "id": 1,
      "title": "John's website"
    },
    {
      ...
    }
  ]
}

Get Item

Get the specified row id in the given table.

Note: Table names are case-sensitive

HTTP Request

GET /api/1/tables/[table-name]/rows/[row-id]

Example Request

$ curl https://database.account.directus.io/api/1/tables/projects/rows/1 \
        -u usrSTeeornngkti:
$item = $client->getItem('projects', 1);
client.getItem('projects', 1);

Response

Note: The architecture of this response is based on your schema.

{
  "id": 1,
  "title": "John's website"
}

Update Item

Update an item in the given table with the specified ID.

Note: Table names are case-sensitive

HTTP Request

PATCH /api/1/tables/[table-name]/rows/[row-id]

Example Request

$ curl --data "active=1&title=Example" \
        https://database.account.directus.io/api/1/tables/projects/rows/1 \
                -u usrSTeeornngkti:
$item = $client->updateItem('projects', 1, [
  'active': 1,
  'title': 'Example'
]);
client.updateItem('projects', 1, {
  active: 1,
  title: 'Example'
});

Parameters

Note: The parameters are based on the table's column.

Response

Note: The architecture of this response is based on your schema.

{
  "id": 1,
  "active": 1,
  "title": "Example"
}

Delete Item

Delete or Soft-delete a row in the given table with the specified ID.

Note: Table names are case-sensitive

HTTP Request

PATCH /api/1/tables/[table-name]/rows/[row-id]
DELETE /api/1/tables/[table-name]/rows/[row-id]

Example Request

$ curl -X PATCH --data "active=0" \
        https://database.account.directus.io/api/1/tables/projects/rows/1 \
                -u usrSTeeornngkti:

$ curl -X DELETE \
        https://database.account.directus.io/api/1/tables/projects/rows/1 \
                -u usrSTeeornngkti:
// Soft delete (only if it has status columm)
$client->deleteItem('projects', 1);

// Delete from DB
$client->deleteItem('projects', 1, true);
// Soft delete (only if it has status columm)
client.deleteItem('projects', 1);

// Delete from DB
client.deleteItem('projects', 1, true);

Parameters

Name Description
active Status value. delete = 0
$ curl -X DELETE \
        https://database.account.directus.io/api/1/tables/projects/rows/1 \
                -u usrSTeeornngkti:

Parameters

None.

Response

All the entries from the table.

Note: The architecture of this response is based on your schema.

{
  "Delete": 1,
  "Active": 0,
  "Draft": 0,
  "total": 1,
  "rows": [
    {
      "id": 1,
      "active": 0,
      "title": "Projects"
    }
  ]
}
Files

Create File

Add new file.

HTTP Request

POST /api/1/files

Parameters

Name Description
title File title
data Base64 File data
name Filename
size File size in bytes
type File mime type
tags File tags. Separated by commas.
height Image height
width Image width
caption File caption
active File status. Based on status configuration. default, 0=inactive/soft-delete, 1=active, 2=draft.
charset File charset
date_uploaded Format YYYY-MM-DD HH:MM:SS UTC
embed_id Embedded link id. (Supports Youtube ID and Vimeo ID)
user File owner.
storage_adapter File storage adapter name

Example Request

$ curl --data "name=image.jpg&type=image/jpeg&data=data:image/jpeg;base64,<base64-data>" \
https://instance--key.directus.io/api/1/files
$file = $client->createFile(new \Directus\SDK\File('/path/to/file'));
client.createFile({
  name: 'image.jpg',
  type: 'image/jpeg',
  data: 'data:image/jpeg;base64,<base64-data>'
});

Response

{
  "id": 1,
  "active": 1,
  "name": "00000000001.jpg",
  "url": null,
  "title": "Website screenshot",
  "location": "",
  "caption": "",
  "type": "image\/jpg",
  "charset": "binary",
  "tags": "",
  "width": 594,
  "height": 447,
  "size": 52155,
  "embed_id": null,
  "user": 1,
  "date_uploaded": "2013-11-15 04:30:52 UTC",
  "storage_adapter": "local"
}

Get Files

Get all the files entries.

HTTP Request

GET /api/1/files

Example Request

$ curl https://database.account.directus.io/api/1/files
$files = $client->getFiles();
client.getFiles();

Response

{
  "Active": 1,
  "Delete": 0,
  "Draft": 0,
  "total": 1,
  "rows": [{
    "id": 1,
    "active": 1,
    "name": "00000000001.jpg",
    "url": null,
    "title": "Website screenshot",
    "location": "",
    "caption": "",
    "type": "image\/jpg",
    "charset": "binary",
    "tags": "",
    "width": 594,
    "height": 447,
    "size": 52155,
    "embed_id": null,
    "user": 1,
    "date_uploaded": "2013-11-15 04:30:52 UTC",
    "storage_adapter": "local"
  }]
}

Get File

Get information of the specified file.

HTTP Request

GET /api/1/files/[id]

Example Request

$ curl https://database.account.directus.io/api/1/files/1
$file = $client->getFile(1);
client.getFile(1);

Response

{
  "id": 1,
  "active": 1,
  "name": "00000000001.jpg",
  "url": null,
  "title": "Website screenshot",
  "location": "",
  "caption": "",
  "type": "image\/jpg",
  "charset": "binary",
  "tags": "",
  "width": 594,
  "height": 447,
  "size": 52155,
  "embed_id": null,
  "user": 1,
  "date_uploaded": "2013-11-15 04:30:52 UTC",
  "storage_adapter": "local"
}

Update File

Get information of the specified file. @TODO

HTTP Request

GET /api/1/files/[id]

Parameters

Name Description
title File title
data Base64 File data
name Filename
size File size in bytes
type File mime type
tags File tags. Separated by commas.
height Image height
width Image width
caption File caption
active File status. Based on status configuration. default, 0=inactive/soft-delete, 1=active, 2=draft.
charset File charset
date_uploaded Format YYYY-MM-DD HH:MM:SS UTC
embed_id Embedded link id. (Supports Youtube ID and Vimeo ID)
user File owner.
storage_adapter File storage adapter name

Example Request

$ curl --data "title=My+New+File+Title" \
        https://database.account.directus.io/api/1/files/2 \
                -u usrSTeeornngkti:
$file = $client->updateFile(2, [
    'title' => 'My New File Title'
]);
client.updateFile(2, {
  title: 'My New File Title'
});

Response

{
  "id": 1,
  "active": 1,
  "name": "00000000001.jpg",
  "url": null,
  "title": "Website screenshot",
  "location": "",
  "caption": "",
  "type": "image\/jpg",
  "charset": "binary",
  "tags": "",
  "width": 594,
  "height": 447,
  "size": 52155,
  "embed_id": null,
  "user": 1,
  "date_uploaded": "2013-11-15 04:30:52 UTC",
  "storage_adapter": "local"
}
Tables

Create Table

The Create Table endpoint adds a new table to your database. Table names must be unique within each database and are limited to letters, numbers, and the following characters: -_. When creating a new table you must assign permissions to at least one Directus user-group.

HTTP Request

GET https://database.account.directus.io/api/1/privileges/[group-id]
Authentication:

Example Request

$ curl -d "table_name=Projects&group_id=1&addTable=true&allow_add=1&allow_alter=1&allow_delete=1&allow_edit=1&allow_view=1" https://database.account.directus.io/api/1/privileges/1 \
        -u usrSTeeornngkti:

Parameters

Name Description
table_name A unique name for the new table
group_id The id of a user-group that will have access to this table
addTable Set to true to add a new table
allow_add Allow group_id to add entries to this table (1=yes, 0=no)
allow_alter Allow group_id to alter this table (1=yes, 0=no)
allow_delete Allow group_id to delete entries within this table (0=no, 1=yes (your own), 2=yes (all))
allow_edit Allow group_id to edit entries within this table (0=no, 1=yes (your own), 2=yes (all))
allow_view Allow group_id to view entries within this table (0=no, 1=yes (your own), 2=yes (all))

Response

{
   "id":"1",
   "table_name":"projects",
   "group_id":"1",
   "read_field_blacklist":null,
   "write_field_blacklist":null,
   "nav_listed":"1",
   "status_id":"0",
   "allow_view":"2",
   "allow_add":"1",
   "allow_edit":"2",
   "allow_delete":"2",
   "allow_alter":"1"
}

Get Tables

Get the list of tables viewable by current user

Note: Table names are case-sensitive

HTTP Request

GET https://database.account.directus.io/api/1/tables

Example Request

$ curl https://database.account.directus.io/api/1/tables \
        -u [user-token]:
client.getTables();

Response

[
  {
    "table_name":"projects"
  },
  {
    "table_name":"articles"
  },
  {
    "table_name":"clients"
  }
]

Get Table

Get the information from the given table name.

Note: Table names are case-sensitive

HTTP Request

GET https://database.account.directus.io/api/1/tables/[table-name]

Example Request

$ curl https://database.account.directus.io/api/1/tables/projects \
        -u [user-token]:
client.getTable('projects');

Response

{
 "id":"projects",
 "table_name":"projects",
 "date_created":"2016-01-15 02:20:45",
 "comment":"",
 "hidden":false,
 "single":false,
 "is_junction_table":false,
 "user_create_column":null,
 "user_update_column":null,
 "date_create_column":null,
 "date_update_column":null,
 "footer":false,
 "count":"0",
 "active":0,
 "inactive":0,
 "trash":0,
 "columns":[
    {
       "id":"id",
       "column_name":"id",
       "type":"INT",
       "is_nullable":"NO",
       "comment":"",
       "sort":1,
       "system":true,
       "master":false,
       "hidden_list":false,
       "hidden_input":false,
       "required":true,
       "column_type":"int(11) unsigned",
       "is_writable":true,
       "ui":"numeric",
       "hidden":true,
       "options":[

       ]
    },
    {
       "id":"active",
       "column_name":"active",
       "type":"TINYINT",
       "is_nullable":"YES",
       "default_value":"2",
       "comment":"",
       "sort":2,
       "system":true,
       "master":false,
       "hidden_list":false,
       "hidden_input":false,
       "required":false,
       "column_type":"tinyint(1) unsigned",
       "is_writable":true,
       "ui":"checkbox",
       "hidden":true,
       "options":[

       ]
    }
 ],
 "preferences":{
    "user":"1",
    "columns_visible":"",
    "table_name":"projects",
    "title":null,
    "sort":"id",
    "sort_order":"ASC",
    "status":"1,2"
 }
}
Columns

Create Column

Create/Add a column to the given table.

Note: Table names are case-sensitive

HTTP Request

POST /api/1/tables/[table-name]/columns
$ curl -X POST -d "column_name=year&data_type=int&char_length=4&ui=numeric&comment=Year+build" \       
        https://database.account.directus.io/api/1/tables/projects/columns \
        -u usrSTeeornngkti:
client.createColumn('projects', {
  column_name: 'year',
  data_type: 'int',
  char_length: 4,
  ui: 'numeric',
  comment: 'Year Build'
});

Parameters

Name Description
column_name Column's name
data_type Column's Data type
char_length Column's Data type length
ui Column's UI type
comment Column's comments

Response

{
    "id": "title",
    "column_name": "title",
    "type": "VARCHAR",
    "char_length": "100",
    "is_nullable": "YES",
    "comment": "Project's title",
    "sort": 3,
    "system": false,
    "master": false,
    "hidden_list": false,
    "hidden_input": false,
    "required": false,
    "column_type": "varchar(100)",
    "is_writable": true,
    "ui": "textinput",
    "options": []
}

Get Columns

Get all the given table columns information.

Note: Table names are case-sensitive

HTTP Request

GET /api/1/tables/[table-name]/columns

Example Request

$ curl https://database.account.directus.io/api/1/tables/projects/columns \
        -u usrSTeeornngkti:
client.getColumns('projects');

Parameters

None.

Response

[{
    "id": "id",
    "column_name": "id",
    "type": "INT",
    "is_nullable": "NO",
    "comment": "",
    "sort": 1,
    "system": true,
    "master": false,
    "hidden_list": false,
    "hidden_input": false,
    "required": true,
    "column_type": "int(11) unsigned",
    "is_writable": true,
    "ui": "numeric",
    "hidden": true,
    "options": []
}, {
    "id": "title",
    "column_name": "title",
    "type": "VARCHAR",
    "char_length": "100",
    "is_nullable": "YES",
    "comment": "",
    "sort": 2,
    "system": false,
    "master": false,
    "hidden_list": false,
    "hidden_input": false,
    "required": false,
    "column_type": "varchar(100)",
    "is_writable": true,
    "ui": "textinput",
    "options": []
}]

Get Column

Get Information on a given column information from the specified table.

Note: Table names are case-sensitive

HTTP Request

GET /api/1/tables/[table-name]/columns/[column-name]

Example Request

$ curl https://database.account.directus.io/api/1/tables/projects/columns/title \
        -u usrSTeeornngkti:
client.getColumn('projects', 'title');

Parameters

None.

Response

{
    "id": "title",
    "column_name": "title",
    "type": "VARCHAR",
    "char_length": "100",
    "is_nullable": "YES",
    "comment": "",
    "sort": 2,
    "system": false,
    "master": false,
    "hidden_list": false,
    "hidden_input": false,
    "required": false,
    "column_type": "varchar(100)",
    "is_writable": true,
    "ui": "textinput",
    "options": []
}

Update Column

Update column information. Note: Does not update the table column-type.

Note: Table and column names are case-sensitive

Work in Progress.

HTTP Request

POST /api/1/tables/[table-name]/columns/[column-name]

Example Request

$ curl --data "comment=Project+name" https://database.account.directus.io/api/1/tables/projects/title \
        -u usrSTeeornngkti:
client.updateColumn('projects', 'title', {
  comment: 'Project name'
});

Parameters

Name Description
column_name Column's name
data_type Column's Data type
char_length Column's Data type length
ui Column's UI type
comment Column's comments

Response

{
    "id": "title",
    "column_name": "title",
    "type": "VARCHAR",
    "char_length": "100",
    "is_nullable": "YES",
    "comment": "Project's title",
    "sort": 3,
    "system": false,
    "master": false,
    "hidden_list": false,
    "hidden_input": false,
    "required": false,
    "column_type": "varchar(100)",
    "is_writable": true,
    "ui": "textinput",
    "options": []
}

Delete Column

Deleting column through Directus is not available.

Groups

Create Group

Create a new user group.

HTTP Request

GET /api/1/groups

Parameters

Name Description
name The name of the group

Example Request

$ curl --data "name='Manager'" https://database.account.directus.io/api/1/groups
client.createGroup('Manager');

Response

{
  "id": "2",
  "name": "Manager",
  "description": null,
  "restrict_to_ip_whitelist": "0",
  "nav_override": null,
  "show_activity": "1",
  "show_messages": "1",
  "show_users": "1",
  "show_files": "1",
  "nav_blacklist": null
}

Get Groups

Get all the user groups.

HTTP Request

GET /api/1/groups

Example Request

$ curl https://database.account.directus.io/api/1/groups
client.getGroups();

Response

{
  "total": 1,
  "rows": [{
    "id": 1,
    "name": "Administrator",
    "description": null,
    "restrict_to_ip_whitelist": 0,
    "nav_override": null,
    "show_activity": 1,
    "show_messages": 1,
    "show_users": 1,
    "show_files": 1,
    "nav_blacklist": null
  }]
}

Get Group

Get the information of the specified user group.

HTTP Request

GET /api/1/groups/[id]

Example Request

$ curl https://database.account.directus.io/api/1/groups/1
client.getGroup(1);

Response

{
  "id": "1",
  "name": "Administrator",
  "description": null,
  "restrict_to_ip_whitelist": "0",
  "nav_override": null,
  "show_activity": "1",
  "show_messages": "1",
  "show_users": "1",
  "show_files": "1",
  "nav_blacklist": null
}
Group Privileges

Create Privileges

Creating permissions/privileges to a table for the specified user-group ID.

HTTP Request

GET https://database.account.directus.io/api/1/privileges/[group-id]

Example Request

$ curl https://database.account.directus.io/api/1/privileges/1
client.createPrivileges({
  table_name: 'projects',
  group_id: 1,
  allow_add: 2
});

## Parameters

Name         | Description
------------ | ----------------------------------------------------------------------------------------------
table_name   | A unique name for the new table
group_id     | The id of a user-group that will have access to this table
addTable     | Set to **true** to add a new table
allow_add    | Allow **group_id** to add entries to this table (1=yes, 0=no)
allow_alter  | Allow **group_id** to alter this table (1=yes, 0=no)
allow_delete | Allow **group_id** to _delete_ entries within this table (0=no, 1=yes (your own), 2=yes (all))
allow_edit   | Allow **group_id** to _edit_ entries within this table (0=no, 1=yes (your own), 2=yes (all))
allow_view   | Allow **group_id** to _view_ entries within this table (0=no, 1=yes (your own), 2=yes (all))

## Response

```json
{
   "id":"1",
   "table_name":"projects",
   "group_id":"1",
   "read_field_blacklist":null,
   "write_field_blacklist":null,
   "nav_listed":"1",
   "status_id":"0",
   "allow_view":"2",
   "allow_add":"1",
   "allow_edit":"2",
   "allow_delete":"2",
   "allow_alter":"1"
}

Get Privileges

Get the privileges of the specified user-group.

HTTP Request

GET /api/1/privileges/[group-id]

Example Request

$ curl https://database.account.directus.io/api/1/privileges/1
client.getGroupPrivileges(1);

Response

List of all the tables with their privileges for the specified user-group.

[{
  "id": "1",
  "table_name": "projects",
  "group_id": "1",
  "read_field_blacklist": null,
  "write_field_blacklist": null,
  "nav_listed": "1",
  "status_id": "0",
  "allow_view": "2",
  "allow_add": "1",
  "allow_edit": "2",
  "allow_delete": "2",
  "allow_alter": "1"
}]

Get Table Privileges

Get the table privilege of the specified user-group.

HTTP Request

GET /api/1/privileges/[group-id]/[table-name]

Example Request

$ curl https://database.account.directus.io/api/1/privileges/1/projects
client.getTablePrivileges(1, 'projects');

Response

Table privilege for the specified table and user-group.

{
  "id": "1",
  "table_name": "projects",
  "group_id": "1",
  "read_field_blacklist": null,
  "write_field_blacklist": null,
  "nav_listed": "1",
  "status_id": "0",
  "allow_view": "2",
  "allow_add": "1",
  "allow_edit": "2",
  "allow_delete": "2",
  "allow_alter": "1"
}

Update Privileges

Update the specified group privileges/permission on the specified table.

HTTP Request

GET /api/1/privileges/[group-id]/[privileges-id]

Parameters

Name Description
table_name The name of the table
group_id The id of a user-group that will have access to this table
allow_add Allow group_id to add entries to this table (1=yes, 0=no)
allow_alter Allow group_id to alter this table (1=yes, 0=no)
allow_delete Allow group_id to delete entries within this table (0=no, 1=yes (your own), 2=yes (all))
allow_edit Allow group_id to edit entries within this table (0=no, 1=yes (your own), 2=yes (all))
allow_view Allow group_id to view entries within this table (0=no, 1=yes (your own), 2=yes (all))
nav_listed Allow group_id to view this table in the navigation.

Example Request

$ curl --data "name='Manager'" https://database.account.directus.io/api/1/groups

Response

{
  "id": "21",
  "table_name": "directus_activity",
  "group_id": "2",
  "read_field_blacklist": null,
  "write_field_blacklist": null,
  "nav_listed": "1",
  "status_id": "0",
  "allow_view": "1",
  "allow_add": "1",
  "allow_edit": "1",
  "allow_delete": "1",
  "allow_alter": "1"
}
Preferences

Get Preferences

Get table preferences.

Note: Table names are case-sensitive

HTTP Request

GET /api/1/tables/[table-name]/preferences

Example Request

$ curl https://database.account.directus.io/api/1/tables/projects/preferences \
        -u usrSTeeornngkti:
client.getPreferences('projects');

Response

{
  "id": "1",
  "user": "1",
  "table_name": "projects",
  "title": null,
  "columns_visible": "title",
  "sort": "id",
  "sort_order": "ASC",
  "status": "1,2",
  "search_string": null
}

Update Preference

Get the specified row id in the given table.

Note: Table names are case-sensitive

HTTP Request

POST /api/1/tables/[table-name]/preferences

Parameters

Name Description
table_name Name of the table.
columns_visible List of visible columns, separated by commas.
sort Result will be sorted by this column
sort_order Sort Order. (ASC=Ascending or DESC=Descending)
status List of status values. separated by comma.

Example Request

$ curl -d sort_order=DESC https://database.account.directus.io/api/1/tables/projects/preferences \
        -u usrSTeeornngkti:
client.updatePreferences('projects', {
  sort_order: 'DESC'
});

Response

{
  "id": 1,
  "table_name": "projects",
  "title": null,
  "columns_visible": "title",
  "sort": "id",
  "sort_order": "ASC",
  "status": "1,2",
  "search_string": null
}
Settings

Get Settings

Get all Directus settings.

HTTP Request

GET /api/1/settings

Example Request

$ curl https://database.account.directus.io/api/1/settings
client.getSettings();

Response

{
  "global": {
    "cms_user_auto_sign_out": "60",
    "project_name": "Directus Demo",
    "project_url": "http:\/\/examplesite.dev\/",
    "cms_color": "#7ac943",
    "rows_per_page": "200",
    "cms_thumbnail_url": ""
  },
  "files": {
    "allowed_thumbnails": "",
    "thumbnail_quality": "100",
    "thumbnail_size": "200",
    "file_naming": "file_id",
    "thumbnail_crop_enabled": "1",
    "youtube_api_key": ""
  }
}

Get Settings By Type

Read all Directus settings by the specified collection.

HTTP Request

GET /api/1/settings/[collectionName]

Example Request

$ curl https://database.account.directus.io/api/1/settings/global
client.getSettingsByCollection('global');

Response

{
  "cms_user_auto_sign_out": "60",
  "project_name": "Directus Demo",
  "project_url": "http:\/\/examplesite.dev\/",
  "cms_color": "#7ac943",
  "rows_per_page": "200",
  "cms_thumbnail_url": ""
}

Update Settings

Update Directus settings by the specified collection.

HTTP Request

GET /api/1/settings/[id]

Parameters

Name | Description data | the data to be update

Example Request

$ curl --data "rows_per_page=100" https://database.account.directus.io/api/1/settings/global
client.updateSettings('global', {
  rows_per_page: 100
});

Response

{
  "cms_user_auto_sign_out": "60",
  "project_name": "Directus Demo",
  "project_url": "http:\/\/examplesite.dev\/",
  "cms_color": "#7ac943",
  "rows_per_page": "100",
  "cms_thumbnail_url": ""
}