Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

On this pageOverview

Restore database (destructive)

POST/v1/databases/{targetDatabaseId}/restore

⚠️ 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.

AuthorizationBearer <token>

OAuth2 authentication

In: header

Scope: workspace:admin, offline_access

targetDatabaseId*string

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

application/json

TypeScript Definitions

Use the request body type in TypeScript.

curl -X POST "https://example.com/v1/databases/string/restore" \
  -H "Content-Type: application/json" \
  -d '{
    "source": {
      "type": "backup",
      "databaseId": "string",
      "backupId": "string"
    }
  }'
{
  "data": {
    "id": "string",
    "type": "database",
    "url": "http://example.com",
    "name": "string",
    "status": "failure",
    "createdAt": "2019-08-24T14:15:22Z",
    "isDefault": true,
    "defaultConnectionId": "string",
    "connections": [
      {
        "id": "string",
        "type": "connection",
        "url": "http://example.com",
        "name": "string",
        "createdAt": "2019-08-24T14:15:22Z",
        "kind": "postgres",
        "endpoints": {
          "direct": {
            "host": "string",
            "port": 0
          },
          "pooled": {
            "host": "string",
            "port": 0
          },
          "accelerate": {
            "host": "string",
            "port": 0
          }
        },
        "directConnection": {
          "host": "string",
          "pass": "string",
          "user": "string"
        },
        "database": {
          "id": "string",
          "url": "http://example.com",
          "name": "string"
        }
      }
    ],
    "project": {
      "id": "string",
      "url": "http://example.com",
      "name": "string"
    },
    "region": {
      "id": "string",
      "name": "string"
    },
    "source": {
      "type": "backup",
      "databaseId": "string",
      "backupId": "string"
    },
    "branchId": "string",
    "logicalId": "string"
  }
}
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu