curl --request POST \
--url https://api.example.com/api/v1/databases/{id}/backups/restoreUpload a pg_dump file and restore it into a database.
curl --request POST \
--url https://api.example.com/api/v1/databases/{id}/backups/restorepg_dump file and restores it into the target database. Use this when migrating from another host or restoring from a locally stored backup.
| Parameter | Type | Description |
|---|---|---|
id | uuid | Database ID |
multipart/form-data with a single file field.
| Extension | Description |
|---|---|
.sql.gz | Compressed SQL dump (what DBHost produces) |
.sql | Plain SQL text dump |
.dump | pg_dump custom format (pg_dump --format=custom) |
.backup | pg_dump custom format (alternate extension) |
curl -X POST \
-H "Authorization: Bearer dbh_your_api_key_here" \
-F "file=@./mybackup.sql.gz" \
https://dbhost.app/api/v1/databases/550e8400-e29b-41d4-a716-446655440000/backups/restore
{
"message": "Database 'mydb' restored from 'mybackup.sql.gz'"
}
| Status | Code | Description |
|---|---|---|
| 400 | INVALID_REQUEST | Request is not multipart/form-data |
| 400 | MISSING_FILE | No file field in form data |
| 400 | INVALID_FILENAME | Filename doesn’t match a supported format |
| 401 | UNAUTHORIZED | Missing or invalid API key |
| 404 | DATABASE_NOT_FOUND | Database doesn’t exist, isn’t owned by this user, or isn’t in scope for this key |
| 413 | PAYLOAD_TOO_LARGE | File exceeds the 512 MB size limit |
| 503 | AGENT_ROUTE_UNAVAILABLE | The VPS agent doesn’t support restore yet (needs update) |
| 500 | AGENT_ERROR | The VPS agent failed to restore from the uploaded file |