Restore a database
Open a running database's Import Backup page to restore a backup from your computer, the database server, or S3 storage. Imports are also available for supported database components inside a service stack.
Stop application writes and take a separate backup of the target before importing. Review the selected database, backup format, generated script, and replacement options. An import can overwrite data and credentials.
Supported backups
| Database | Supported restore inputs and options |
|---|---|
| PostgreSQL | SQL dumps, custom archives, tar archives, and all-database dumps. |
| MySQL and MariaDB | SQL dumps, including all-database backups; optional user and privilege restoration. |
| MongoDB | Archives and dump directories. |
| SQLite | Database files; choose the target file under Restore into. |
| Redis, Dragonfly, KeyDB, ClickHouse | No built-in Import Backup workflow; use an engine-specific restore process. |
Coolify detects formats before changing data and supports gzip, bz2, xz, and zip compression as well as supported archives. Ensure the backup matches the target engine and version, and that the server has enough free space.
Review restore options
The Import command shows the exact generated restore script and is read-only. Choose Backup contents for a selected-database or all-database dump as appropriate.
- Replace objects that already exist is off by default for single-database PostgreSQL imports. Enable it to request the previous clean/replace behavior. Existing objects can otherwise make an import fail.
- Keep owners and privileges is off by default for PostgreSQL archives. Enable it only when the destination has the required roles and you intend to restore ownership and grants.
- Restore users and privileges (mysql system database) applies to all-database MySQL/MariaDB imports. It can replace users and passwords, including administrative credentials. Coolify's saved credentials and health checks may then need updating.
- Restore into selects a configured SQLite file. Coolify preselects the file identified by the backup name when possible.
- MongoDB offers Replace collections that already exist for replacing existing collections.
PostgreSQL restores run in one transaction. Replace restores of SQL backups swap in the new database only after success. Format detection occurs before destructive changes; keep a verified backup for recovery regardless of these safeguards.
Select and import a backup
- Open Import Backup on the running target database.
- Select a source:
- Upload a backup from your computer.
- Enter the backup's absolute server path and select Check file.
- Select available team S3 storage, enter the file path within the bucket, and check the file.
- Review file information, backup contents, restore options, and the generated import command.
- Start the restore and complete its confirmation.
- Follow Database Restore Output until the operation finishes.
Coolify uses the selected source; an earlier unused upload does not replace a checked server path. A second start, restart, or import is rejected while an import runs. Interrupted or stale imports are stopped and cleaned up so they do not indefinitely block later operations.
Import through the API
For a standalone database, use:
| Endpoint | Purpose |
|---|---|
POST /databases/{uuid}/imports/uploads | Upload a backup. |
POST /databases/{uuid}/imports | Start an import from the selected source. |
GET /databases/{uuid}/imports/{activity_id} | Read import progress and result. |
For a service database, the same suffixes are under /services/{uuid}/databases/{database_uuid}/imports.
Uploading and starting an import require write. A server-path import also requires deploy. Options include replace_existing, keep_owners, restore_mysql_users, and sqlite_database. Concurrent database operations return 409; invalid requests return 422. Use the API reference for source fields and upload formats.
Example: import a server file
After stopping application writes and backing up the target, start an import using the backup's absolute path on the database server:
curl --request POST "https://coolify.example.com/api/v1/databases/<database-uuid>/imports" \
--header "Authorization: Bearer $COOLIFY_TOKEN" \
--header "Content-Type: application/json" \
--data '{"source":"server","path":"/var/backups/database.sql.gz","dump_all":false,"replace_existing":false}'Use a token with the required write and deploy abilities. Poll the activity endpoint with the returned activity ID and verify the result before resuming writes. Upload imports use source: "upload" and upload_id; S3 imports use source: "s3", s3_storage_uuid, and path.
Verify the result
- Confirm the database is running and healthy and review its logs.
- Connect with a database client and check schemas, tables or collections, and representative records.
- For SQLite, verify the application reads the intended mounted file.
- Update credentials if the import restored users or passwords.
- Reconnect application writes after validation and create a new backup.
