List Shares

List all shares 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.

page
integer

Cursor for use in pagination. Often used in combination with limit.

Response

Successful request

data
array
meta
object
GET /shares
Response Example
{
  "data": [
    {
      "id": "3a606c3e-9d4d-4556-b7bb-f00860613da3",
      "name": "My Share",
      "collection": "articles",
      "item": "1",
      "role": "2b34fba4-a6cb-49f4-a070-2daee7ac44f0",
      "password": "**********",
      "user_created": "b13072b7-73e9-4904-89e0-34aaf4403766",
      "date_created": "2023-01-25T19:16:49.009Z",
      "date_start": "2023-01-26T17:00:00.000Z",
      "date_end": "2023-01-28T17:00:00.000Z",
      "times_used": 0,
      "max_uses": 15
    }
  ],
  "meta": {}
}

Create Multiple Shares

Create multiple new shares.

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 /shares
Response Example
{
  "data": [
    {
      "id": "3a606c3e-9d4d-4556-b7bb-f00860613da3",
      "name": "My Share",
      "collection": "articles",
      "item": "1",
      "role": "2b34fba4-a6cb-49f4-a070-2daee7ac44f0",
      "password": "**********",
      "user_created": "b13072b7-73e9-4904-89e0-34aaf4403766",
      "date_created": "2023-01-25T19:16:49.009Z",
      "date_start": "2023-01-26T17:00:00.000Z",
      "date_end": "2023-01-28T17:00:00.000Z",
      "times_used": 0,
      "max_uses": 15
    }
  ],
  "meta": {}
}

Delete Multiple Shares

Delete multiple existing shares.

Request Body

An array of share primary keys.

[array]
array
DELETE /shares

Update Multiple Shares

Update multiple shares 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
object
keys
array

Response

Successful request

data
array
meta
object
PATCH /shares
Response Example
{
  "data": [
    {
      "id": "3a606c3e-9d4d-4556-b7bb-f00860613da3",
      "name": "My Share",
      "collection": "articles",
      "item": "1",
      "role": "2b34fba4-a6cb-49f4-a070-2daee7ac44f0",
      "password": "**********",
      "user_created": "b13072b7-73e9-4904-89e0-34aaf4403766",
      "date_created": "2023-01-25T19:16:49.009Z",
      "date_start": "2023-01-26T17:00:00.000Z",
      "date_end": "2023-01-28T17:00:00.000Z",
      "times_used": 0,
      "max_uses": 15
    }
  ],
  "meta": {}
}

Create a Share

Create a new share.

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 /shares‎
Response Example
{
  "data": {
    "id": "3a606c3e-9d4d-4556-b7bb-f00860613da3",
    "name": "My Share",
    "collection": "articles",
    "item": "1",
    "role": "2b34fba4-a6cb-49f4-a070-2daee7ac44f0",
    "password": "**********",
    "user_created": "b13072b7-73e9-4904-89e0-34aaf4403766",
    "date_created": "2023-01-25T19:16:49.009Z",
    "date_start": "2023-01-26T17:00:00.000Z",
    "date_end": "2023-01-28T17:00:00.000Z",
    "times_used": 0,
    "max_uses": 15
  }
}

Retrieve a Share

List an existing share by primary key.

Query Parameters

id
string

Unique identifier of the share.

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 /shares/{id}
Response Example
{
  "data": {
    "id": "3a606c3e-9d4d-4556-b7bb-f00860613da3",
    "name": "My Share",
    "collection": "articles",
    "item": "1",
    "role": "2b34fba4-a6cb-49f4-a070-2daee7ac44f0",
    "password": "**********",
    "user_created": "b13072b7-73e9-4904-89e0-34aaf4403766",
    "date_created": "2023-01-25T19:16:49.009Z",
    "date_start": "2023-01-26T17:00:00.000Z",
    "date_end": "2023-01-28T17:00:00.000Z",
    "times_used": 0,
    "max_uses": 15
  }
}

Delete a Share

Delete an existing share.

Query Parameters

id
string

Unique identifier of the share.

DELETE /shares/{id}

Update a Share

Update an existing share.

Query Parameters

id
string

Unique identifier of the share.

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 /shares/{id}
Response Example
{
  "data": {
    "id": "3a606c3e-9d4d-4556-b7bb-f00860613da3",
    "name": "My Share",
    "collection": "articles",
    "item": "1",
    "role": "2b34fba4-a6cb-49f4-a070-2daee7ac44f0",
    "password": "**********",
    "user_created": "b13072b7-73e9-4904-89e0-34aaf4403766",
    "date_created": "2023-01-25T19:16:49.009Z",
    "date_start": "2023-01-26T17:00:00.000Z",
    "date_end": "2023-01-28T17:00:00.000Z",
    "times_used": 0,
    "max_uses": 15
  }
}

Authenticate a Share

Authenticate as a share user. Shares work by returning a token, as it is the case with the regular login endpoint. These tokens are limited to a permissions set that only allows access to the item that was shared, and any relationally linked items that that associated role has access to. This means that all regular endpoints can be used with the token returned by this endpoint.

Request Body

share
string

Primary key of the share you're authenticating against.

password
string

Password for the share, if one is configured.

mode
string

Whether to retrieve the refresh token in the JSON response, or in a httpOnly cookie.

Response

Successful request

data
object
POST /shares/auth
Response Example
{
  "data": {
    "access_token": "eyJhbGciOiJI...",
    "expires": 900,
    "refresh_token": "yuOJkjdPXMd..."
  }
}

Get Share Public Info

Allows unauthenticated users to retrieve information about the share.

Query Parameters

id
string

Unique identifier of the share.

Response

Successful request

data
object
GET /shares/info/{id}
Response Example
{
  "data": {
    "id": "3a606c3e-9d4d-4556-b7bb-f00860613da3",
    "name": "My Share",
    "collection": "articles",
    "item": "1",
    "role": "2b34fba4-a6cb-49f4-a070-2daee7ac44f0",
    "password": "**********",
    "user_created": "b13072b7-73e9-4904-89e0-34aaf4403766",
    "date_created": "2023-01-25T19:16:49.009Z",
    "date_start": "2023-01-26T17:00:00.000Z",
    "date_end": "2023-01-28T17:00:00.000Z",
    "times_used": 0,
    "max_uses": 15
  }
}