Skip to content

Trash API

Base URL: https://YOUR-SERVER/api. Send your API key in x-api-key where authentication is required. A key also needs the listed permission; your account's access rules still apply.

API guide · All endpoints · OpenAPI JSON

Get utility activity

GET /api/trash/activity

Your own history of moves to the trash and their undos made from a utility such as Large files, newest first, kept for a year. An item is named only while this session may still see it.

Authentication: API key. Permission: asset.read.

Parameters

NameWhereRequiredDescription
toolqueryYes
Parameter types, defaults and constraints

Field definitions: UtilityActivityTool

[
  {
    "name": "tool",
    "required": true,
    "in": "query",
    "schema": {
      "$ref": "#/components/schemas/UtilityActivityTool"
    }
  }
]

Responses

Field definitions: UtilityActivityResponseDto

{
  "200": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/UtilityActivityResponseDto"
        }
      }
    },
    "description": ""
  }
}

Apply a reviewed trash change

POST /api/trash/apply

Applies an action to exactly the reviewed set. The set is resolved again with the same ownership, Locked and privacy rules; if it differs from the review in any way the request fails with 409 and nothing changes.

Authentication: API key. Permission: asset.delete.

Request body

Required.

Field definitions: TrashApplyDto

{
  "application/json": {
    "schema": {
      "$ref": "#/components/schemas/TrashApplyDto"
    }
  }
}

Responses

Field definitions: TrashResponseDto

{
  "200": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TrashResponseDto"
        }
      }
    },
    "description": ""
  }
}

Empty trash

POST /api/trash/empty

Permanently delete all items in the trash.

Authentication: API key. Permission: asset.delete.

Responses

Field definitions: TrashResponseDto

{
  "200": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TrashResponseDto"
        }
      }
    },
    "description": ""
  }
}

List trash items

GET /api/trash/items

One page of your own trash, filtered by file name and media type and ordered by deletion time, size or name. Locked media is listed only in an unlocked session.

Authentication: API key. Permission: asset.read.

Parameters

NameWhereRequiredDescription
pagequeryNoPage number, from 1
queryqueryNoWords that must all appear in the file name
sizequeryNoItems per page
sortqueryNo
typequeryNo
Parameter types, defaults and constraints

Field definitions: TrashItemSort, AssetTypeEnum

[
  {
    "name": "page",
    "required": false,
    "in": "query",
    "description": "Page number, from 1",
    "schema": {
      "minimum": 1,
      "maximum": 9007199254740991,
      "default": 1,
      "type": "integer"
    }
  },
  {
    "name": "query",
    "required": false,
    "in": "query",
    "description": "Words that must all appear in the file name",
    "schema": {
      "maxLength": 255,
      "type": "string"
    }
  },
  {
    "name": "size",
    "required": false,
    "in": "query",
    "description": "Items per page",
    "schema": {
      "minimum": 1,
      "maximum": 1000,
      "default": 200,
      "type": "integer"
    }
  },
  {
    "name": "sort",
    "required": false,
    "in": "query",
    "schema": {
      "$ref": "#/components/schemas/TrashItemSort"
    }
  },
  {
    "name": "type",
    "required": false,
    "in": "query",
    "schema": {
      "$ref": "#/components/schemas/AssetTypeEnum"
    }
  }
]

Responses

Field definitions: TrashItemsResponseDto

{
  "200": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TrashItemsResponseDto"
        }
      }
    },
    "description": ""
  }
}

Restore trash

POST /api/trash/restore

Restore all items in the trash.

Authentication: API key. Permission: asset.delete.

Responses

Field definitions: TrashResponseDto

{
  "200": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TrashResponseDto"
        }
      }
    },
    "description": ""
  }
}

Restore assets

POST /api/trash/restore/assets

Restore specific assets from the trash.

Authentication: API key. Permission: asset.delete.

Request body

Required.

Field definitions: BulkIdsDto

{
  "application/json": {
    "schema": {
      "$ref": "#/components/schemas/BulkIdsDto"
    }
  }
}

Responses

Field definitions: TrashResponseDto

{
  "200": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TrashResponseDto"
        }
      }
    },
    "description": ""
  }
}

Review a trash change

POST /api/trash/review

Resolves exactly which items an action would change (move to trash, restore, restore all, delete or empty) and returns their count, size, shared originals and a token that fingerprints the set. Nothing is changed.

Authentication: API key. Permission: asset.delete.

Request body

Required.

Field definitions: TrashReviewDto

{
  "application/json": {
    "schema": {
      "$ref": "#/components/schemas/TrashReviewDto"
    }
  }
}

Responses

Field definitions: TrashReviewResponseDto

{
  "200": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TrashReviewResponseDto"
        }
      }
    },
    "description": ""
  }
}

Get trash summary

GET /api/trash/summary

Counts for your own trash as this session may see it: items, the combined size of their originals, and items still being removed from storage. Locked media counts only in an unlocked session.

Authentication: API key. Permission: asset.read.

Responses

Field definitions: TrashSummaryResponseDto

{
  "200": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TrashSummaryResponseDto"
        }
      }
    },
    "description": ""
  }
}