v1

latestSwagger 2.02026-07-172964242.9 KB
Database

Update database

Updates a database with the given specification.

post/v1/databases/{database_id}

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

force_updateboolean

Force update the database even if the spec is the same.

remove_hoststring[]

Host IDs to treat as removed during this update. Events targeting these hosts will be skipped.

Request body

tenant_idstring

Unique identifier for the database's owner.

Example request

{
  "spec": {
    "database_name": "storefront",
    "database_users": [
      {
        "attributes": [
          "LOGIN",
          "SUPERUSER"
        ],
        "db_owner": true,
        "username": "admin"
      }
    ],
    "nodes": [
      {
        "backup_config": {
          "repositories": [
            {
              "s3_bucket": "storefront-db-backups-us-east-1",
              "type": "s3"
            }
          ]
        },
        "host_ids": [
          "us-east-1"
        ],
        "name": "n1"
      },
      {
        "backup_config": {
          "repositories": [
            {
              "s3_bucket": "storefront-db-backups-ap-south-1",
              "type": "s3"
            }
          ]
        },
        "host_ids": [
          "ap-south-1"
        ],
        "name": "n2"
      },
      {
        "backup_config": {
          "repositories": [
            {
              "s3_bucket": "storefront-db-backups-eu-central-1",
              "type": "s3"
            }
          ]
        },
        "host_ids": [
          "eu-central-1"
        ],
        "name": "n3",
        "restore_config": {
          "repository": {
            "s3_bucket": "storefront-db-backups-us-east-1",
            "type": "s3"
          },
          "source_database_id": "storefront",
          "source_database_name": "storefront",
          "source_node_name": "n1"
        }
      }
    ],
    "port": 5432
  }
}

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"
  },
  "task": {
    "created_at": "2025-06-18T17:23:14Z",
    "database_id": "storefront",
    "status": "pending",
    "task_id": "01978410-fb5d-7cd2-bbd2-66c0bf929dc0",
    "type": "update"
  }
}