Versions

Enables users to create unpublished copies of an item, modify them independently from the main version, and promote them to become the new main version when ready.

List Content Versions

List all content versions that exist in Directus.

Query Parameters

fields
array

Control what fields are being returned in the object.

limit
integer

A limit on the number of objects that are returned.

offset
integer

How many items to skip when fetching data.

meta
string

What metadata to return in the response.

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.

filter

Select items in collection by given conditions.

search
string

Filter by items that contain the given search query in one of their fields.

Response

Successful request

data
array
meta
object
GET /versions
Response Example
{
  "data": [
    {
      "id": "63716273-0f29-4648-8a2a-2af2948f6f78",
      "key": "draft",
      "name": "My Draft",
      "collection": "articles",
      "item": "168",
      "date_created": "2022-05-11T13:14:52Z",
      "date_updated": "2022-05-11T13:14:53Z",
      "user_created": "63716273-0f29-4648-8a2a-2af2948f6f78",
      "user_updated": "63716273-0f29-4648-8a2a-2af2948f6f78",
      "delta": {}
    }
  ],
  "meta": {}
}

Create Multiple Content Versions

Create multiple new content versions.

Query Parameters

fields
array

Control what fields are being returned in the object.

limit
integer

A limit on the number of objects that are returned.

meta
string

What metadata to return in the response.

offset
integer

How many items to skip when fetching data.

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.

filter

Select items in collection by given conditions.

search
string

Filter by items that contain the given search query in one of their fields.

Request Body

data
array

Response

Successful request

data
array
meta
object
POST /versions
Response Example
{
  "data": [
    {
      "id": "63716273-0f29-4648-8a2a-2af2948f6f78",
      "key": "draft",
      "name": "My Draft",
      "collection": "articles",
      "item": "168",
      "date_created": "2022-05-11T13:14:52Z",
      "date_updated": "2022-05-11T13:14:53Z",
      "user_created": "63716273-0f29-4648-8a2a-2af2948f6f78",
      "user_updated": "63716273-0f29-4648-8a2a-2af2948f6f78",
      "delta": {}
    }
  ],
  "meta": {}
}

Delete Multiple Content Versions

Delete multiple existing content versions.

Request Body

An array of content version primary keys.

[array]
array
DELETE /versions

Update Multiple Content Versions

Update multiple content versions at the same time.

Query Parameters

fields
array

Control what fields are being returned in the object.

limit
integer

A limit on the number of objects that are returned.

meta
string

What metadata to return in the response.

offset
integer

How many items to skip when fetching data.

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.

filter

Select items in collection by given conditions.

search
string

Filter by items that contain the given search query in one of their fields.

Request Body

data
keys
array

Response

Successful request

data
array
meta
object
PATCH /versions
Response Example
{
  "data": [
    {
      "id": "63716273-0f29-4648-8a2a-2af2948f6f78",
      "key": "draft",
      "name": "My Draft",
      "collection": "articles",
      "item": "168",
      "date_created": "2022-05-11T13:14:52Z",
      "date_updated": "2022-05-11T13:14:53Z",
      "user_created": "63716273-0f29-4648-8a2a-2af2948f6f78",
      "user_updated": "63716273-0f29-4648-8a2a-2af2948f6f78",
      "delta": {}
    }
  ],
  "meta": {}
}

Create a Content Versions

Create a new content version for an item.

Query Parameters

fields
array

Control what fields are being returned in the object.

meta
string

What metadata to return in the response.

Request Body

[object]
object

Response

Successful request

data
object
POST /versions‎
Response Example
{
  "data": {
    "id": "63716273-0f29-4648-8a2a-2af2948f6f78",
    "key": "draft",
    "name": "My Draft",
    "collection": "articles",
    "item": "168",
    "date_created": "2022-05-11T13:14:52Z",
    "date_updated": "2022-05-11T13:14:53Z",
    "user_created": "63716273-0f29-4648-8a2a-2af2948f6f78",
    "user_updated": "63716273-0f29-4648-8a2a-2af2948f6f78",
    "delta": {}
  }
}

Retrieve a Content Version

Retrieve a single content version by unique identifier.

Query Parameters

id
string

Unique identifier for the object.

fields
array

Control what fields are being returned in the object.

meta
string

What metadata to return in the response.

Response

Successful request

data
object
GET /versions/{id}
Response Example
{
  "data": {
    "id": "63716273-0f29-4648-8a2a-2af2948f6f78",
    "key": "draft",
    "name": "My Draft",
    "collection": "articles",
    "item": "168",
    "date_created": "2022-05-11T13:14:52Z",
    "date_updated": "2022-05-11T13:14:53Z",
    "user_created": "63716273-0f29-4648-8a2a-2af2948f6f78",
    "user_updated": "63716273-0f29-4648-8a2a-2af2948f6f78",
    "delta": {}
  }
}

Delete a Content Version

Delete an existing content version.

Query Parameters

id
string

Unique identifier for the object.

DELETE /versions/{id}

Update a Content Version

Update an existing content version.

Query Parameters

id
string

Unique identifier for the object.

fields
array

Control what fields are being returned in the object.

meta
string

What metadata to return in the response.

Request Body

[object]
object

Response

Successful request

data
object
PATCH /versions/{id}
Response Example
{
  "data": {
    "id": "63716273-0f29-4648-8a2a-2af2948f6f78",
    "key": "draft",
    "name": "My Draft",
    "collection": "articles",
    "item": "168",
    "date_created": "2022-05-11T13:14:52Z",
    "date_updated": "2022-05-11T13:14:53Z",
    "user_created": "63716273-0f29-4648-8a2a-2af2948f6f78",
    "user_updated": "63716273-0f29-4648-8a2a-2af2948f6f78",
    "delta": {}
  }
}

Compare a Content Version

Compare an existing content version with the main version of the item.

Query Parameters

id
string

Unique identifier for the object.

Response

Successful request

data
object
GET /versions/{id}/compare
Response Example
{
  "data": {}
}

Promote a Content Version

Promote an existing content version to become the new main version of the item.

Query Parameters

id
string

Unique identifier for the object.

Request Body

mainHash
string

Hash of the main version of the item to be promoted.

fields
string

Optional array of field names of which the values are to be promoted.

Response

Successful request

[string]
string

The primary key of the promoted item.

POST /versions/{id}/promote

Save to a Content Version

Save item changes to an existing content version.

Query Parameters

id
string

Unique identifier for the object.

Response

Successful request, Returns the item object with the new state after save.

data
object
POST /versions/{id}/save
Response Example
{
  "data": {}
}