Skip to main content
POST
/
api
/
v1
/
databases
/
{id}
/
backups
/
{filename}
Restore backup
curl --request POST \
  --url https://api.example.com/api/v1/databases/{id}/backups/{filename}
Restores a database from an existing backup file. This overwrites all data in the target database with the contents of the backup.
This is a destructive operation. All current data in the database will be replaced with the backup contents. This cannot be undone.

Path parameters

ParameterTypeDescription
iduuidDatabase ID
filenamestringBackup filename (format: YYYYMMDD_HHMMSS.sql.gz)

Example

curl -X POST \
  -H "Authorization: Bearer dbh_your_api_key_here" \
  https://dbhost.app/api/v1/databases/550e8400-e29b-41d4-a716-446655440000/backups/20260326_222551.sql.gz

Response

200 OK
{
  "message": "Database 'mydb' restored from '20260326_222551.sql.gz'"
}

Errors

StatusCodeDescription
400INVALID_BACKUP_FILENAMEFilename doesn’t match the expected YYYYMMDD_HHMMSS.sql.gz format
401UNAUTHORIZEDMissing or invalid API key
404DATABASE_NOT_FOUNDDatabase doesn’t exist, isn’t owned by this user, or isn’t in scope for this key
404BACKUP_NOT_FOUNDBackup file not found
503AGENT_ROUTE_UNAVAILABLEThe VPS agent doesn’t support restore yet (needs update)
500AGENT_ERRORThe VPS agent failed to restore the backup