v1

latestSwagger 2.02026-07-172964242.9 KB
Database

Restore database

Perform an in-place restore of one or more nodes using the given restore configuration.

post/v1/databases/{database_id}/restore

Path parameters

database_idstring required

A user-specified identifier. Must be 1-36 characters, contain only lower-cased letters and hyphens, start and end with a letter or number, and not contain consecutive hyphens.

Query parameters

forceboolean

Force restoration of a database even in an unmodifiable state

Request body

target_nodesstring[]

The nodes to restore. Defaults to all nodes if empty or unspecified.

Example request

{
  "restore_config": {
    "repository": {
      "base_path": "/backups",
      "type": "posix"
    },
    "source_database_id": "storefront",
    "source_database_name": "storefront",
    "source_node_name": "n1"
  },
  "target_nodes": [
    "n1"
  ]
}

Response

OK response.

Example response

{
  "database": {
    "created_at": "2025-06-18T16:52:05Z",
    "id": "storefront",
    "instances": [
      {
        "connection_info": {
          "addresses": [
            "10.24.34.2",
            "i-0123456789abcdef.ec2.internal"
          ],
          "port": 5432
        },
        "created_at": "2025-06-18T16:52:22Z",
        "host_id": "us-east-1",
        "id": "storefront-n1-689qacsi",
        "node_name": "n1",
        "postgres": {
          "patroni_state": "running",
          "role": "primary",
          "version": "18.1"
        },
        "spock": {
          "read_only": "off",
          "subscriptions": [
            {
              "name": "sub_n1n3",
              "provider_node": "n3",
              "status": "replicating"
            },
            {
              "name": "sub_n1n2",
              "provider_node": "n2",
              "status": "replicating"
            }
          ],
          "version": "4.0.10"
        },
        "state": "available",
        "status_updated_at": "2025-06-18T17:58:56Z",
        "updated_at": "2025-06-18T17:54:36Z"
      },
      {
        "connection_info": {
          "addresses": [
            "10.24.35.2",
            "i-058731542fee493f.ec2.internal"
          ],
          "port": 5432
        },
        "created_at": "2025-06-18T16:52:22Z",
        "host_id": "ap-south-1",
        "id": "storefront-n2-9ptayhma",
        "node_name": "n2",
        "postgres": {
          "patroni_state": "running",
          "role": "primary",
          "version": "18.1"
        },
        "spock": {
          "read_only": "off",
          "subscriptions": [
            {
              "name": "sub_n2n1",
              "provider_node": "n1",
              "status": "replicating"
            },
            {
              "name": "sub_n2n3",
              "provider_node": "n3",
              "status": "replicating"
            }
          ],
          "version": "4.0.10"
        },
        "state": "available",
        "status_updated_at": "2025-06-18T17:58:56Z",
        "updated_at": "2025-06-18T17:54:01Z"
      },
      {
        "connection_info": {
          "addresses": [
            "10.24.36.2",
            "i-494027b7b53f6a23.ec2.internal"
          ],
          "port": 5432
        },
        "created_at": "2025-06-18T16:52:22Z",
        "host_id": "eu-central-1",
        "id": "storefront-n3-ant97dj4",
        "node_name": "n3",
        "postgres": {
          "patroni_state": "running",
          "role": "primary",
          "version": "18.1"
        },
        "spock": {
          "read_only": "off",
          "subscriptions": [
            {
              "name": "sub_n3n1",
              "provider_node": "n1",
              "status": "replicating"
            },
            {
              "name": "sub_n3n2",
              "provider_node": "n2",
              "status": "replicating"
            }
          ],
          "version": "4.0.10"
        },
        "state": "available",
        "status_updated_at": "2025-06-18T17:58:56Z",
        "updated_at": "2025-06-18T17:54:01Z"
      }
    ],
    "spec": {
      "database_name": "storefront",
      "database_users": [
        {
          "attributes": [
            "SUPERUSER",
            "LOGIN"
          ],
          "db_owner": true,
          "username": "admin"
        }
      ],
      "nodes": [
        {
          "host_ids": [
            "us-east-1"
          ],
          "name": "n1"
        },
        {
          "host_ids": [
            "ap-south-1"
          ],
          "name": "n2"
        },
        {
          "host_ids": [
            "eu-central-1"
          ],
          "name": "n3"
        }
      ],
      "port": 5432,
      "postgres_version": "17.6",
      "spock_version": "5"
    },
    "state": "restoring",
    "updated_at": "2025-06-18T17:58:59Z"
  },
  "node_tasks": [
    {
      "created_at": "2025-06-18T17:58:59Z",
      "database_id": "storefront",
      "node_name": "n1",
      "parent_id": "01978431-b628-758a-aec6-03b331fa1a17",
      "status": "pending",
      "task_id": "01978431-b62b-723b-a09c-e4072cd64bdb",
      "type": "node_restore"
    },
    {
      "created_at": "2025-06-18T17:58:59Z",
      "database_id": "storefront",
      "node_name": "n2",
      "parent_id": "01978431-b628-758a-aec6-03b331fa1a17",
      "status": "pending",
      "task_id": "01978431-b62c-7593-aad8-43b03df2031b",
      "type": "node_restore"
    },
    {
      "created_at": "2025-06-18T17:58:59Z",
      "database_id": "storefront",
      "node_name": "n3",
      "parent_id": "01978431-b628-758a-aec6-03b331fa1a17",
      "status": "pending",
      "task_id": "01978431-b62d-7b65-ab09-272d0b2fea91",
      "type": "node_restore"
    }
  ],
  "task": {
    "created_at": "2025-06-18T17:58:59Z",
    "database_id": "storefront",
    "status": "pending",
    "task_id": "01978431-b628-758a-aec6-03b331fa1a17",
    "type": "restore"
  }
}