---
title: "Back up and restore databases"
description: "Schedule database backups on OnePloy to local disk and S3-compatible storage, set retention rules and restore a backup in a few clicks."
url: https://oneploy.dev/docs/databases/database-backups/
type: op_doc
published: 2026-11-02T19:09:47+00:00
updated: 2026-11-02T19:09:47+00:00
author: "admin"
language: en-US
---

# Back up and restore databases

> Schedule database backups on OnePloy to local disk and S3-compatible storage, set retention rules and restore a backup in a few clicks.

OnePloy backs up databases on a schedule you define, keeps copies on the server and optionally in S3-compatible storage, and can restore a backup file into a running database. Configure schedules on the database’s **Backups** page and restores on its **Import backup** page.

## Step 1: Add S3 storage (recommended)

Local backups stay on the same server as the database. To keep copies elsewhere, add a bucket first:

1. Open **S3 Storage** in the sidebar and add a storage.
2. Enter the **Endpoint**, **Bucket**, **Region**, **Access key** and **Secret key**.
3. Save. OnePloy validates the connection and marks the storage as **Connected** when it works.

Any S3-compatible service works, for example AWS S3, Cloudflare R2, Backblaze B2, Wasabi or MinIO.

## Step 2: Create a backup schedule

1. Open the database and go to **Backups**.
2. Create a scheduled backup and set the **Frequency**. Use `every_minute`, `hourly`, `daily`, `weekly`, `monthly`, `yearly` or a cron expression such as `0 3 * * *`.
3. Choose which databases to include. Leave it empty to back up the default database. For MongoDB you can exclude collections.
4. Optionally pick an **S3 storage** so each backup is uploaded.
5. Save. The schedule uses the server’s timezone.

Use **Backup now** to run a backup immediately.

## How long are backups kept?

Retention is set separately for local and S3 copies on the backup’s retention page:

| Setting | Effect |
| --- | --- |
| Backups to keep | Maximum number of recent backups. |
| Days to keep | Removes backups older than this many days. |
| Maximum storage (GB) | Removes the oldest backups once the total size is reached. |

Each run appears under the backup’s executions with its status, size and log. You can download a backup file from there.

## How do I restore a backup?

1. Make sure the database is running.
2. Open the database and go to **Import backup**.
3. Choose the backup source: upload a file from your computer, give a file path on the server, or pick a file from an S3 storage.
4. Review the import command OnePloy will run, then start the import.

Not every database type supports imports. The page tells you if the current type does not.

**Warning:** Restoring writes into the live database. Take a fresh backup before you import, and test restores on a copy first. A backup you have never restored is not a proven backup.

## Can I manage backups through the API?

Yes:

- `GET /api/v1/databases/{uuid}/backups` lists backup schedules.
- `POST /api/v1/databases/{uuid}/backups` creates one.
- `PATCH /api/v1/databases/{uuid}/backups/{scheduled_backup_uuid}` updates one.
- `GET /api/v1/databases/{uuid}/backups/{scheduled_backup_uuid}/executions` lists runs.

S3 storages are managed with `/api/v1/s3-storages`. See the [API overview](https://oneploy.dev/docs/api/).

## What about databases inside services?

Databases that are part of a one-click service (for example the PostgreSQL inside an n8n stack) have their own backup and import pages under the service. See [Services](https://oneploy.dev/docs/services/).

---

Source: https://oneploy.dev/docs/databases/database-backups/ · OnePloy
