Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

Restore database (destructive)

POST/v1/databases/{targetDatabaseId}/restoreRestore database (destructive)

⚠️ Destructive operation — this immediately and irreversibly overwrites all data in the target database with the contents of the specified backup. Any data written since the backup was taken will be lost. Ensure you have a recent backup of the target database before proceeding.

Replaces the data in an existing database from a backup. Connections and credentials are preserved — only the data layer is replaced.

Parameters

targetDatabaseIdstringpathrequired

pattern ^(db_)?([cC][^\s-]{8,}|[a-z0-9]+)$

Request body

application/json
object
sourceobjectrequired
Show child attributes
backupIdstringrequired

ID of the backup to restore from

databaseIdstringrequired

ID of the database the backup belongs to

pattern ^(db_)?([cC][^\s-]{8,}|[a-z0-9]+)$

typestringrequired

const "backup"

Example request
{
  "source": {
    "backupId": "string",
    "databaseId": "string",
    "type": "backup"
  }
}

Responses

200Database restore initiated. The database status will be "recovering" until the restore completes.application/json
object
dataobjectrequired
Show child attributes
branchIdnull | stringrequired
connectionsarray of objectrequired
Show child attributes
Show array items
createdAtstring · date-timerequired
databaseobjectrequired
Show child attributes
idstringrequired
namestringrequired
urlstring · urirequired
directConnectionnull | object

Deprecated: use `endpoints.direct` instead.

Show child attributes
hoststringrequired
passstringrequired
userstringrequired
endpointsobjectrequired
Show child attributes
accelerateobject
Show child attributes
hoststringrequired
portnumberrequired
directobject
Show child attributes
hoststringrequired
portnumberrequired
pooledobject
Show child attributes
hoststringrequired
portnumberrequired
idstringrequired

pattern ^(con_)([cC][^\s-]{8,}|[a-z0-9]+)$

kindstringrequired

one of "postgres", "accelerate"

namestringrequired
typestringrequired

const "connection"

urlstring · urirequired
createdAtstring · date-timerequired
defaultConnectionIdnull | stringrequired

pattern ^(con_)([cC][^\s-]{8,}|[a-z0-9]+)$

idstringrequired
isDefaultbooleanrequired
logicalIdnull | stringrequired
namestringrequired
projectobjectrequired
Show child attributes
idstringrequired
namestringrequired
urlstring · urirequired
regionnull | objectrequired
Show child attributes
idstringrequired
namestringrequired
sourceobjectrequired
Show child attributes
backupIdstringrequired
databaseIdstringrequired
typestringrequired

const "backup"

statusstringrequired

one of "failure", "provisioning", "ready", "recovering"

typestringrequired

const "database"

urlstring · urirequired
Example response
{
  "data": {
    "branchId": "string",
    "connections": [
      {
        "createdAt": "2026-06-09T00:00:00Z",
        "database": {
          "id": "string",
          "name": "string",
          "url": "https://example.com"
        },
        "directConnection": {
          "host": "string",
          "pass": "string",
          "user": "string"
        },
        "endpoints": {
          "accelerate": {
            "host": "string",
            "port": 0
          },
          "direct": {
            "host": "string",
            "port": 0
          },
          "pooled": {
            "host": "string",
            "port": 0
          }
        },
        "id": "string",
        "kind": "accelerate",
        "name": "string",
        "type": "connection",
        "url": "https://example.com"
      }
    ],
    "createdAt": "2026-06-09T00:00:00Z",
    "defaultConnectionId": "string",
    "id": "string",
    "isDefault": true,
    "logicalId": "string",
    "name": "string",
    "project": {
      "id": "string",
      "name": "string",
      "url": "https://example.com"
    },
    "region": {
      "id": "string",
      "name": "string"
    },
    "source": {
      "backupId": "string",
      "databaseId": "string",
      "type": "backup"
    },
    "status": "failure",
    "type": "database",
    "url": "https://example.com"
  }
}
401Missing or invalid authorization token.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
404Target database, source database, or backup not found.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
409Target database is currently provisioning or recovering and cannot be restored.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
422Invalid source type or backup not usable.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
Documentation menu