---
title: "Update Postgres service state"
method: PATCH
path: "/v1/organizations/{organizationId}/postgres/{postgresId}/state"
tags: ["Postgres"]
---

# Update Postgres service state

`PATCH /v1/organizations/{organizationId}/postgres/{postgresId}/state`

## Request

- Base URL: `https://api.clickhouse.cloud`
- URL: `https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/state`
- Auth: HTTP basic

Initiate a process for a Postgres service:
* restart: Initiates a service restart
* promote: Promotes a read replica to primary
* switchover: Switch a primary over to a standby. If there is no standby, replace the primary with a newly provisioned server and switch over to it.

## Path parameters

- `organizationId` string, uuid, required
- `postgresId` string, uuid, required

## Request body

- PostgresServiceSetState
  - `command` 'restart' | 'promote' | 'switchover': Postgres status, which initiates a process.

## Response `200`

Successful response

- object
  - `status` number: HTTP status code.
  - `requestId` string, uuid: Unique id assigned to every request. UUIDv4
  - `result` PostgresService
    - `name` string: Name of the Postgres service. Alphanumerical string with whitespaces up to 50 characters.
    - `provider` 'aws' | 'gcp': The cloud provider for a Postgres service.
    - `region` string: The cloud region for a Postgres service.
    - `postgresVersion` '19' | '18' | '17'
    - `size` string: The VM size for a Postgres service. One of 'c6gd.large', 'c6gd.xlarge', 'c6gd.2xlarge', 'c6gd.4xlarge', 'c6gd.8xlarge', 'c6gd.16xlarge', 'i7i.large', 'i7i.xlarge', 'i7i.2xlarge', 'i7i.4xlarge', 'i7i.8xlarge', 'i7i.12xlarge', 'i7i.16xlarge', 'i7i.24xlarge', 'i7ie.large', 'i7ie.xlarge', 'i7ie.2xlarge', 'i7ie.3xlarge', 'i7ie.6xlarge', 'i7ie.12xlarge', 'i7ie.18xlarge', 'i7ie.24xlarge', 'i8g.large', 'i8g.xlarge', 'i8g.2xlarge', 'i8g.4xlarge', 'i8g.8xlarge', 'i8g.16xlarge', 'i8g.24xlarge', 'i8ge.large', 'i8ge.xlarge', 'i8ge.2xlarge', 'i8ge.3xlarge', 'i8ge.6xlarge', 'i8ge.12xlarge', 'i8ge.18xlarge', 'i8ge.24xlarge', 'm6gd.large', 'm6gd.xlarge', 'm6gd.2xlarge', 'm6gd.4xlarge', 'm6gd.8xlarge', 'm6gd.16xlarge', 'm6id.large', 'm6id.xlarge', 'm6id.2xlarge', 'm6id.4xlarge', 'm6id.8xlarge', 'm6id.16xlarge', 'm8gd.large', 'm8gd.xlarge', 'm8gd.2xlarge', 'm8gd.4xlarge', 'm8gd.8xlarge', 'm8gd.16xlarge', 'r6gd.medium', 'r6gd.large', 'r6gd.xlarge', 'r6gd.2xlarge', 'r6gd.4xlarge', 'r6gd.8xlarge', 'r6gd.12xlarge', 'r6gd.16xlarge', 'r6id.large', 'r6id.xlarge', 'r6id.2xlarge', 'r6id.4xlarge', 'r6id.8xlarge', 'r6id.12xlarge', 'r6id.16xlarge', 'r6id.24xlarge', 'r6id.32xlarge', 'r8gd.medium', 'r8gd.large', 'r8gd.xlarge', 'r8gd.2xlarge', 'r8gd.4xlarge', 'r8gd.8xlarge', 'r8gd.12xlarge', 'r8gd.16xlarge', 'r8gd.24xlarge', 'r8gd.48xlarge', 'c4a-highmem-lssd-4', 'c4a-highmem-lssd-8', 'c4a-highmem-lssd-16', 'c4a-highmem-lssd-32', 'c4a-highmem-lssd-48', 'c4a-highmem-lssd-64', 'c4a-highmem-lssd-72', 'c4a-standard-lssd-4', 'c4a-standard-lssd-8', 'c4a-standard-lssd-16', 'c4a-standard-lssd-32', 'c4a-standard-lssd-48', 'c4a-standard-lssd-64', 'c4a-standard-lssd-72', 'c4-highmem-lssd-4', 'c4-highmem-lssd-8', 'c4-highmem-lssd-16', 'c4-highmem-lssd-24', 'c4-highmem-lssd-32', 'c4-highmem-lssd-48', 'c4-highmem-lssd-96', 'c4-highmem-lssd-144', 'c4-highmem-lssd-192', 'c4-highmem-lssd-288', 'c4-standard-lssd-4', 'c4-standard-lssd-8', 'c4-standard-lssd-16', 'c4-standard-lssd-24', 'c4-standard-lssd-32', 'c4-standard-lssd-48', 'c4-standard-lssd-96', 'c4-standard-lssd-144', 'c4-standard-lssd-192', 'c4-standard-lssd-288', 'c4d-highmem-lssd-8', 'c4d-highmem-lssd-16', 'c4d-highmem-lssd-32', 'c4d-highmem-lssd-48', 'c4d-highmem-lssd-64', 'c4d-highmem-lssd-96', 'c4d-highmem-lssd-192', 'c4d-highmem-lssd-384', 'c4d-standard-lssd-8', 'c4d-standard-lssd-16', 'c4d-standard-lssd-32', 'c4d-standard-lssd-48', 'c4d-standard-lssd-64', 'c4d-standard-lssd-96', 'c4d-standard-lssd-192', 'c4d-standard-lssd-384', 'c3-standard-lssd-4', 'c3-standard-lssd-8', 'c3-standard-lssd-22', 'c3-standard-lssd-44', 'c3-standard-lssd-88', 'c3-standard-lssd-176', 'c3d-highmem-lssd-8', 'c3d-highmem-lssd-16', 'c3d-highmem-lssd-30', 'c3d-highmem-lssd-60', 'c3d-highmem-lssd-90', 'c3d-highmem-lssd-180', 'c3d-highmem-lssd-360', 'c3d-standard-lssd-8', 'c3d-standard-lssd-16', 'c3d-standard-lssd-30', 'c3d-standard-lssd-60', 'c3d-standard-lssd-90', 'c3d-standard-lssd-180', 'c3d-standard-lssd-360', 'z3-highmem-highlssd-8', 'z3-highmem-highlssd-16', 'z3-highmem-highlssd-22', 'z3-highmem-highlssd-32', 'z3-highmem-highlssd-44', 'z3-highmem-highlssd-88', 'z3-highmem-standardlssd-14', 'z3-highmem-standardlssd-22', 'z3-highmem-standardlssd-44', 'z3-highmem-standardlssd-88', 'z3-highmem-standardlssd-176', 'n2-highmem-2xlssd-4', 'n2-highmem-2xlssd-8', 'n2-highmem-2xlssd-16', 'n2-highmem-2xlssd-32', 'n2-highmem-2xlssd-48', 'n2-highmem-2xlssd-64', 'n2-highmem-2xlssd-96', 'n2-standard-2xlssd-4', 'n2-standard-2xlssd-8', 'n2-standard-2xlssd-16', 'n2-standard-2xlssd-32', 'n2-standard-2xlssd-48', 'n2-standard-2xlssd-64', 'n2-standard-2xlssd-96', 'n2-highmem-4xlssd-2', 'n2-highmem-4xlssd-4', 'n2-highmem-4xlssd-8', 'n2-highmem-4xlssd-16', 'n2-highmem-4xlssd-32', 'n2-highmem-4xlssd-48', 'n2-highmem-8xlssd-2', 'n2-highmem-8xlssd-4', 'n2-highmem-8xlssd-8', 'n2-highmem-8xlssd-16', 'n2-highmem-8xlssd-32', 'n2-highmem-16xlssd-2', 'n2-highmem-16xlssd-4', 'n2-highmem-16xlssd-8', 'n2-highmem-16xlssd-16', 'n2-standard-4xlssd-2', 'n2-standard-4xlssd-4', 'n2-standard-4xlssd-8', 'n2-standard-4xlssd-16', 'n2-standard-4xlssd-32', 'n2-standard-4xlssd-48'. New sizes may be added, so clients must accept unknown values.
    - `haType` 'none' | 'async' | 'sync': Type of high availability: “none” for no replication, “async” for asynchronous replication to a single standby, and “sync” for synchronous replication to the number of standbys in `standbyCount` (two by default).
    - `standbyCount` 0 | 1 | 2: Number of hot standby instances. Accepted values and defaults depend on `haType`: - “none”: 0 (default) - “async”: 1 (default) - “sync”: 1, or 2 (default) When `haType` is updated without `standbyCount`, the default for the new `haType` applies.
    - `tags` ResourceTagsV1[]: Tags associated with the Postgres service. Tag keys starting with “chc_” are reserved for internal use.
      - `key` string, required: Tag key. Must be alphanumeric with dashes, underscores and dots.
      - `value` string: Tag value. Must be alphanumeric with dashes, underscores and dots.
    - `ipAccessList` PostgresIpAccessListEntry[]: IPv4 access rules shown in the console. IPv6 rules are not included. Returned when reading or configuring access; omitted from other service updates.
      - `id` string: Rule ID returned by the service. Include it when editing an existing rule; omit it when creating a rule.
      - `source` string, required: IPv4 address or CIDR allowed to connect. Returned as a canonical CIDR.
      - `portRange` string, required: Port or inclusive range, from 1 to 65535. Use "5432" for Postgres, "6432" for PgBouncer, or a range such as "5432..6432".
      - `description` string: Optional description of the access list entry.
    - `id` string, uuid
    - `storageSize` integer: The storage size, in GiB, which must be supported by the specified `size`.
    - `state` 'creating' | 'restarting' | 'running' | 'replaying_wal' | 'restoring_backup' | 'finalizing_restore' | 'unavailable' | 'stopped' | 'deleting': Current state of the service
    - `createdAt` string, date-time
    - `isPrimary` boolean: True if this service is the primary service in the data warehouse
    - `connectionString` string: Connection string to the Postgres service. Embeds the service password, so it is only returned when the service is created or its password is reset. Omitted from every other response when Postgres credential redaction is enabled for the organization. Not guaranteed to be present — treat as optional.
    - `username` string: Username for the Postgres service
    - `password` string: Password for the Postgres service. Only returned when the service is created or its password is reset. Omitted from every other response when Postgres credential redaction is enabled for the organization. Not guaranteed to be present — treat as optional.
    - `hostname` string: Hostname for the Postgres service
    - `deletionProtection` boolean: When true, the service cannot be deleted until deletion protection is turned off. Only available for organizations with deletion protection enabled.
    - `earliestRestoreTime` string, date-time: Earliest point in time the service can be restored to with the restore endpoint. ISO-8601. Only present for a primary service once its first backup has completed.

## Other responses

- `400`: The request cannot be processed due to a client error. Please verify your request parameters and try again.
- `500`: An internal server error has occurred. If this issue persists, please contact ClickHouse Cloud support for assistance.

## Changes

- **2026-12-03** `da7ddc01509b`: 192 info
  - removed the `c3-standard-lssd-176` enum value from the `result/size` response property for the response status `200`
  - removed the `c3-standard-lssd-22` enum value from the `result/size` response property for the response status `200`
  - removed the `c3-standard-lssd-4` enum value from the `result/size` response property for the response status `200`
  - removed the `c3-standard-lssd-44` enum value from the `result/size` response property for the response status `200`
  - …188 more
- **2026-11-16** `90397f9401c1`: 1 warning
  - added the new `19` enum value to the `result/postgresVersion` response property for the response status `200`
- **2026-11-11** `244c797674bd`: 1 info
  - added the optional property `result/standbyCount` to the response with the `200` status
- **2026-11-04** `63a9108321ca`: 49 warning
  - added the new `c3-standard-lssd-176` enum value to the `result/size` response property for the response status `200`
  - added the new `c3-standard-lssd-22` enum value to the `result/size` response property for the response status `200`
  - added the new `c3-standard-lssd-4` enum value to the `result/size` response property for the response status `200`
  - added the new `c3-standard-lssd-44` enum value to the `result/size` response property for the response status `200`
  - …45 more
- **2026-11-03** `9a3acc257142`: 1 info
  - added the optional property `result/deletionProtection` to the response with the `200` status

[Operation history](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud/changes/v1/organizations/:organizationId/postgres/:postgresId/state/patch.md)

---

[API](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud.md) - [All operations](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud/llms.txt) - [OpenAPI document](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud/revisions/eac345053548?raw)
