# Trash API

Source: https://frameleaf.app/docs/api/reference/trash/

Use your own server and its scoped API keys.

## 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.

```json
{
  "description": "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.",
  "operationId": "getUtilityActivity",
  "parameters": [
    {
      "name": "tool",
      "required": true,
      "in": "query",
      "schema": {
        "$ref": "#/components/schemas/UtilityActivityTool"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/UtilityActivityResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Get utility activity",
  "tags": [
    "Trash"
  ],
  "x-frameleaf-permission": "asset.read"
}
```

## 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.

```json
{
  "description": "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.",
  "operationId": "applyTrashReview",
  "parameters": [],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TrashApplyDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/TrashResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Apply a reviewed trash change",
  "tags": [
    "Trash"
  ],
  "x-frameleaf-permission": "asset.delete"
}
```

## Empty trash

POST /api/trash/empty

Permanently delete all items in the trash.

```json
{
  "description": "Permanently delete all items in the trash.",
  "operationId": "emptyTrash",
  "parameters": [],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/TrashResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Empty trash",
  "tags": [
    "Trash"
  ],
  "x-frameleaf-permission": "asset.delete"
}
```

## 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.

```json
{
  "description": "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.",
  "operationId": "getTrashItems",
  "parameters": [
    {
      "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": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/TrashItemsResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "List trash items",
  "tags": [
    "Trash"
  ],
  "x-frameleaf-permission": "asset.read"
}
```

## Restore trash

POST /api/trash/restore

Restore all items in the trash.

```json
{
  "description": "Restore all items in the trash.",
  "operationId": "restoreTrash",
  "parameters": [],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/TrashResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Restore trash",
  "tags": [
    "Trash"
  ],
  "x-frameleaf-permission": "asset.delete"
}
```

## Restore assets

POST /api/trash/restore/assets

Restore specific assets from the trash.

```json
{
  "description": "Restore specific assets from the trash.",
  "operationId": "restoreAssets",
  "parameters": [],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/BulkIdsDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/TrashResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Restore assets",
  "tags": [
    "Trash"
  ],
  "x-frameleaf-permission": "asset.delete"
}
```

## 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.

```json
{
  "description": "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.",
  "operationId": "reviewTrash",
  "parameters": [],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TrashReviewDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/TrashReviewResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Review a trash change",
  "tags": [
    "Trash"
  ],
  "x-frameleaf-permission": "asset.delete"
}
```

## 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.

```json
{
  "description": "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.",
  "operationId": "getTrashSummary",
  "parameters": [],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/TrashSummaryResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Get trash summary",
  "tags": [
    "Trash"
  ],
  "x-frameleaf-permission": "asset.read"
}
```
