# Maintenance (admin) API

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

Use your own server and its scoped API keys.

## Get integrity report by type

GET /api/admin/integrity/report

Get all flagged items by integrity report type

```json
{
  "description": "Get all flagged items by integrity report type",
  "operationId": "getIntegrityReport",
  "parameters": [
    {
      "name": "cursor",
      "required": false,
      "in": "query",
      "description": "Cursor for pagination",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "limit",
      "required": false,
      "in": "query",
      "description": "Number of items per page",
      "schema": {
        "maximum": 9007199254740991,
        "exclusiveMinimum": true,
        "default": 500,
        "type": "integer",
        "minimum": 0
      }
    },
    {
      "name": "type",
      "required": true,
      "in": "query",
      "schema": {
        "$ref": "#/components/schemas/IntegrityReport"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/IntegrityReportResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Get integrity report by type",
  "tags": [
    "Maintenance (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "maintenance"
}
```

## Delete integrity report item

DELETE /api/admin/integrity/report/{id}

Delete a given report item and perform corresponding deletion (e.g. trash asset, delete file)

```json
{
  "description": "Delete a given report item and perform corresponding deletion (e.g. trash asset, delete file)",
  "operationId": "deleteIntegrityReport",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Delete integrity report item",
  "tags": [
    "Maintenance (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "maintenance"
}
```

## Download flagged file

GET /api/admin/integrity/report/{id}/file

Download the untracked/broken file if one exists

```json
{
  "description": "Download the untracked/broken file if one exists",
  "operationId": "getIntegrityReportFile",
  "parameters": [
    {
      "name": "id",
      "required": true,
      "in": "path",
      "schema": {
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/octet-stream": {
          "schema": {
            "format": "binary",
            "type": "string"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Download flagged file",
  "tags": [
    "Maintenance (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "maintenance"
}
```

## Export integrity report by type as CSV

GET /api/admin/integrity/report/{type}/csv

Get all integrity report entries for a given type as a CSV

```json
{
  "description": "Get all integrity report entries for a given type as a CSV",
  "operationId": "getIntegrityReportCsv",
  "parameters": [
    {
      "name": "type",
      "required": true,
      "in": "path",
      "schema": {
        "$ref": "#/components/schemas/IntegrityReport"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/octet-stream": {
          "schema": {
            "format": "binary",
            "type": "string"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Export integrity report by type as CSV",
  "tags": [
    "Maintenance (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "maintenance"
}
```

## Get integrity check runs

GET /api/admin/integrity/runs

Get when each integrity check last completed a full run

```json
{
  "description": "Get when each integrity check last completed a full run",
  "operationId": "getIntegrityCheckRuns",
  "parameters": [],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/IntegrityCheckRunsResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Get integrity check runs",
  "tags": [
    "Maintenance (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "maintenance"
}
```

## Get integrity report summary

GET /api/admin/integrity/summary

Get a count of the items flagged in each integrity report

```json
{
  "description": "Get a count of the items flagged in each integrity report",
  "operationId": "getIntegrityReportSummary",
  "parameters": [],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/IntegrityReportSummaryResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Get integrity report summary",
  "tags": [
    "Maintenance (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "maintenance"
}
```

## Detect existing install

GET /api/admin/maintenance/detect-install

Collect integrity checks and other heuristics about local data.

```json
{
  "description": "Collect integrity checks and other heuristics about local data.",
  "operationId": "detectPriorInstall",
  "parameters": [],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/MaintenanceDetectInstallResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Detect existing install",
  "tags": [
    "Maintenance (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "maintenance"
}
```

## Log into maintenance mode

POST /api/admin/maintenance/login

Login with maintenance token or cookie to receive current information and perform further actions.

```json
{
  "description": "Login with maintenance token or cookie to receive current information and perform further actions.",
  "operationId": "maintenanceLogin",
  "parameters": [],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/MaintenanceLoginDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/MaintenanceAuthDto"
          }
        }
      },
      "description": ""
    }
  },
  "summary": "Log into maintenance mode",
  "tags": [
    "Maintenance (admin)"
  ],
  "security": []
}
```

## Get maintenance mode status

GET /api/admin/maintenance/status

Fetch information about the currently running maintenance action.

```json
{
  "description": "Fetch information about the currently running maintenance action.",
  "operationId": "getMaintenanceStatus",
  "parameters": [],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/MaintenanceStatusResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "summary": "Get maintenance mode status",
  "tags": [
    "Maintenance (admin)"
  ],
  "security": []
}
```

## Restore a copy of an applied physical deduplication plan

POST /api/admin/physical-deduplication/applies/{id}/restore

Point one copy back at its own former file, only while that file is still on disk with the reviewed checksum and size, and answer with the plan verified again. A copy whose own file was removed cannot be restored.

```json
{
  "description": "Point one copy back at its own former file, only while that file is still on disk with the reviewed checksum and size, and answer with the plan verified again. A copy whose own file was removed cannot be restored.",
  "operationId": "restorePhysicalDeduplicationCopy",
  "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"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PhysicalDeduplicationRestoreRequestDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PhysicalDeduplicationVerificationDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Restore a copy of an applied physical deduplication plan",
  "tags": [
    "Maintenance (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "job.create"
}
```

## Verify an applied physical deduplication plan

POST /api/admin/physical-deduplication/applies/{id}/verify

Hash every retained original the applied plan shares again and check that every copy it changed still resolves to one. Reports, per copy, whether its own former file is gone (which cannot be undone) or still on disk (which can be restored). Nothing is written.

```json
{
  "description": "Hash every retained original the applied plan shares again and check that every copy it changed still resolves to one. Reports, per copy, whether its own former file is gone (which cannot be undone) or still on disk (which can be restored). Nothing is written.",
  "operationId": "verifyPhysicalDeduplicationApply",
  "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/PhysicalDeduplicationVerificationDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Verify an applied physical deduplication plan",
  "tags": [
    "Maintenance (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "job.read"
}
```

## Review a physical deduplication plan

POST /api/admin/physical-deduplication/plan/review

Check the plan on screen against the library again and bind the per-group decisions to it. Answers 409 when a newer preview replaced the plan, it was applied, or any checksum, ownership, path or reference evidence changed. Nothing is written.

```json
{
  "description": "Check the plan on screen against the library again and bind the per-group decisions to it. Answers 409 when a newer preview replaced the plan, it was applied, or any checksum, ownership, path or reference evidence changed. Nothing is written.",
  "operationId": "reviewPhysicalDeduplicationPlan",
  "parameters": [],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PhysicalDeduplicationReviewRequestDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PhysicalDeduplicationReviewResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Review a physical deduplication plan",
  "tags": [
    "Maintenance (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "job.create"
}
```

## Get physical deduplication preview

GET /api/admin/physical-deduplication/preview

Return the latest physical deduplication plan with per-copy evidence, and the plans being applied or applied recently. Thumbnail visibility is the asset access of the requesting administrator, evaluated on every read.

```json
{
  "description": "Return the latest physical deduplication plan with per-copy evidence, and the plans being applied or applied recently. Thumbnail visibility is the asset access of the requesting administrator, evaluated on every read.",
  "operationId": "getPhysicalDeduplicationPreview",
  "parameters": [],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PhysicalDeduplicationPreviewResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Get physical deduplication preview",
  "tags": [
    "Maintenance (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "job.read"
}
```

## Request physical deduplication preview

POST /api/admin/physical-deduplication/preview

Queue a dry run that may retain originals in an account chosen for the preview and may review the copies of one account. Applying needs a reviewed plan and the saved master account.

```json
{
  "description": "Queue a dry run that may retain originals in an account chosen for the preview and may review the copies of one account. Applying needs a reviewed plan and the saved master account.",
  "operationId": "requestPhysicalDeduplicationPreview",
  "parameters": [],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PhysicalDeduplicationPreviewRequestDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "204": {
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Request physical deduplication preview",
  "tags": [
    "Maintenance (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "job.create"
}
```
