# Database Backups (admin) API

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

Use your own server and its scoped API keys.

## Delete database backup

DELETE /api/admin/database-backups

Delete a backup by its filename

```json
{
  "description": "Delete a backup by its filename",
  "operationId": "deleteDatabaseBackup",
  "parameters": [],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DatabaseBackupDeleteDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Delete database backup",
  "tags": [
    "Database Backups (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "backup.delete"
}
```

## List database backups

GET /api/admin/database-backups

Get the list of the successful and failed backups

```json
{
  "description": "Get the list of the successful and failed backups",
  "operationId": "listDatabaseBackups",
  "parameters": [],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/DatabaseBackupListResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "List database backups",
  "tags": [
    "Database Backups (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "maintenance"
}
```

## Get backup restore verification

GET /api/admin/database-backups/restore-verification

When restoring the database and the original files was last proved, and whether a test is due

```json
{
  "description": "When restoring the database and the original files was last proved, and whether a test is due",
  "operationId": "getBackupRestoreVerification",
  "parameters": [],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/BackupRestoreVerificationResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Get backup restore verification",
  "tags": [
    "Database Backups (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "maintenance"
}
```

## Record a backup restore test

POST /api/admin/database-backups/restore-verification

Records that restoring the database, the original files or both was proved just now

```json
{
  "description": "Records that restoring the database, the original files or both was proved just now",
  "operationId": "recordBackupRestoreVerification",
  "parameters": [],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/BackupRestoreVerificationRecordDto"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/BackupRestoreVerificationResponseDto"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Record a backup restore test",
  "tags": [
    "Database Backups (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "maintenance"
}
```

## Start database backup restore flow

POST /api/admin/database-backups/start-restore

Put Frameleaf into maintenance mode to restore a backup (Frameleaf must not be configured)

```json
{
  "description": "Put Frameleaf into maintenance mode to restore a backup (Frameleaf must not be configured)",
  "operationId": "startDatabaseRestoreFlow",
  "parameters": [],
  "responses": {
    "201": {
      "description": ""
    }
  },
  "summary": "Start database backup restore flow",
  "tags": [
    "Database Backups (admin)"
  ],
  "security": []
}
```

## Upload database backup

POST /api/admin/database-backups/upload

Uploads .sql/.sql.gz file to restore backup from

```json
{
  "description": "Uploads .sql/.sql.gz file to restore backup from",
  "operationId": "uploadDatabaseBackup",
  "parameters": [],
  "requestBody": {
    "content": {
      "multipart/form-data": {
        "schema": {
          "$ref": "#/components/schemas/DatabaseBackupUploadDto"
        }
      }
    },
    "description": "Backup Upload",
    "required": true
  },
  "responses": {
    "201": {
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Upload database backup",
  "tags": [
    "Database Backups (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "backup.upload"
}
```

## Download database backup

GET /api/admin/database-backups/{filename}

Downloads the database backup file

```json
{
  "description": "Downloads the database backup file",
  "operationId": "downloadDatabaseBackup",
  "parameters": [
    {
      "name": "filename",
      "required": true,
      "in": "path",
      "schema": {
        "pattern": "^[a-zA-Z0-9_\\-.]+$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/octet-stream": {
          "schema": {
            "format": "binary",
            "type": "string"
          }
        }
      },
      "description": ""
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "summary": "Download database backup",
  "tags": [
    "Database Backups (admin)"
  ],
  "x-frameleaf-admin-only": true,
  "x-frameleaf-permission": "backup.download"
}
```
