# File trash (admin) API

Source: https://frameleaf.app/docs/api/reference/file-trash-admin/

Use your own server and its scoped API keys.

## List the file trash

GET /api/admin/file-trash

Originals no library references any more, newest first, with the total disk space the file trash holds. Nothing here is deleted automatically.

```json
{
  "description": "Originals no library references any more, newest first, with the total disk space the file trash holds. Nothing here is deleted automatically.",
  "operationId": "getFileTrash",
  "parameters": [
    {
      "name": "page",
      "required": false,
      "in": "query",
      "description": "Page number, from 1",
      "schema": {
        "minimum": 1,
        "maximum": 9007199254740991,
        "default": 1,
        "type": "integer"
      }
    },
    {
      "name": "size",
      "required": false,
      "in": "query",
      "description": "Entries per page",
      "schema": {
        "minimum": 1,
        "maximum": 500,
        "default": 100,
        "type": "integer"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/FileTrashResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "List the file trash",
  "tags": [
    "File trash (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "maintenance"
}
```

## Delete a file permanently

DELETE /api/admin/file-trash/{id}

Delete the file from disk for good. This cannot be undone.

```json
{
  "description": "Delete the file from disk for good. This cannot be undone.",
  "operationId": "deleteFileTrashItem",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "204": {
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Delete a file permanently",
  "tags": [
    "File trash (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "maintenance"
}
```

## Restore a file from the file trash

POST /api/admin/file-trash/{id}/restore

Re-import the file as a new asset in the library it was last in, reading its metadata again. Answers 400 when that account is unknown or gone and 409 when its library already holds the file.

```json
{
  "description": "Re-import the file as a new asset in the library it was last in, reading its metadata again. Answers 400 when that account is unknown or gone and 409 when its library already holds the file.",
  "operationId": "restoreFileTrashItem",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/FileTrashRestoreResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Restore a file from the file trash",
  "tags": [
    "File trash (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "maintenance"
}
```
