Fields

Fields are individual pieces of content within an item. They are mapped to columns in the database.

List All Fields

Returns a list of the fields available in the project.

Query Parameters

limit
integer

A limit on the number of objects that are returned.

sort
array

How to sort the returned items. sort is a CSV of fields used to sort the fetched items. Sorting defaults to ascending (ASC) order but a minus sign (-) can be used to reverse this to descending (DESC) order. Fields are prioritized by their order in the CSV. You can also use a ? to sort randomly.

Response

Successful request

data
array
GET /fields
Response Example
{
  "data": [
    {
      "collection": "about_us",
      "field": "id",
      "special": [],
      "options": {},
      "translations": []
    }
  ]
}

List Fields in Collection

Returns a list of the fields available in the given collection.

Query Parameters

collection
string

Unique identifier of the collection the item resides in.

sort
array

How to sort the returned items. sort is a CSV of fields used to sort the fetched items. Sorting defaults to ascending (ASC) order but a minus sign (-) can be used to reverse this to descending (DESC) order. Fields are prioritized by their order in the CSV. You can also use a ? to sort randomly.

Response

Successful request

data
array
GET /fields/{collection}
Response Example
{
  "data": [
    {
      "collection": "about_us",
      "field": "id",
      "special": [],
      "options": {},
      "translations": []
    }
  ]
}

Create Field in Collection

Create a new field in a given collection.

Query Parameters

collection
string

Unique identifier of the collection the item resides in.

Request Body

type
string

Directus specific data type. Used to cast values in the API.

field
string

Unique name of the field. Field name is unique within the collection.

schema
object

The schema info.

meta
object

The meta info.

Response

Successful request

data
object
POST /fields/{collection}
Response Example
{
  "data": {
    "collection": "about_us",
    "field": "id",
    "special": [],
    "options": {},
    "translations": []
  }
}

Retrieve a Field

Retrieves the details of a single field in a given collection.

Query Parameters

collection
string

Unique identifier of the collection the item resides in.

id
string

Unique identifier of the field.

Response

Successful request

data
object
GET /fields/{collection}/{id}
Response Example
{
  "data": {
    "collection": "about_us",
    "field": "id",
    "special": [],
    "options": {},
    "translations": []
  }
}

Delete a Field

Delete an existing field. This action can't be undone.

Query Parameters

collection
string

Unique identifier of the collection the item resides in.

id
string

Unique identifier of the field.

DELETE /fields/{collection}/{id}

Update a Field

Updates the given field in the given collection.

Query Parameters

collection
string

Unique identifier of the collection the item resides in.

id
string

Unique identifier of the field.

Request Body

type
string

Directus specific data type. Used to cast values in the API.

field
string

Unique name of the field. Field name is unique within the collection.

schema
object

The schema info.

meta
object

The meta info.

Response

Successful request

data
object
PATCH /fields/{collection}/{id}
Response Example
{
  "data": {
    "collection": "about_us",
    "field": "id",
    "special": [],
    "options": {},
    "translations": []
  }
}