Service

Update service auto scaling settings

Changed on

Updates minimum and maximum memory limits per replica and idle mode scaling behavior for the service. Supports both vertical autoscaling (fixed replica count, variable memory) and horizontal autoscaling (variable replica count, fixed memory). The memory settings are available only for "production" services and must be a multiple of 4 starting from 8GB. For horizontal autoscaling (autoscalingMode "horizontal" with minReplicas/maxReplicas), contact support to enable the feature for your organization. An optional profile changes the custom instance profile in place. Omit it to keep the current profile. On a BYOC service, equal memory values without a profile must be one of the following sizes: 48, 116, 172, 232; send a BYOC profile to pin a size from the infrastructure's catalogue. When BYOC vertical autoscaling is enabled for the organization (contact support), a minReplicaMemoryGb lower than maxReplicaMemoryGb scales the service vertically between sizes listed by the serviceProfiles endpoint; this unpins any BYOC profile, and the service then reports 'v1-default'. Gen 2 (v2-default) services use a fixed size and cannot idle: minReplicaMemoryGb must equal maxReplicaMemoryGb, the replica count is fixed (numReplicas, or equal minReplicas and maxReplicas in either mode), and idleScaling cannot be true.

patch/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling

Request

  • Base URL
    https://api.clickhouse.cloud
  • Auth
    HTTP basic

Path parameters

organizationId, string uuid required

ID of the organization that owns the service.

serviceId, string uuid required

ID of the service to update scaling parameters.

Request body

ServiceReplicaScalingPatchRequest required
minReplicaMemoryGb, number

Minimum auto-scaling memory in Gb for a single replica. Available only for 'production' services. Must be a multiple of 4 and greater than or equal to 8. A range in vertical autoscaling; equal to maxReplicaMemoryGb in horizontal.

maxReplicaMemoryGb, number

Maximum auto-scaling memory in Gb for a single replica. Available only for 'production' services. Must be a multiple of 4 and lower than or equal to 120 for non paid services or 356 for paid services. A range in vertical autoscaling; equal to minReplicaMemoryGb in horizontal.

autoscalingMode, 'vertical' | 'horizontal'

Target autoscaling mode. Omit to keep the service on its current mode. "vertical" runs a fixed replica count while memory scales between minReplicaMemoryGb and maxReplicaMemoryGb; "horizontal" scales the replica count between minReplicas and maxReplicas at a fixed per-replica memory (minReplicaMemoryGb equal to maxReplicaMemoryGb). Switching to horizontal requires the feature to be enabled for the organization.

numReplicas, integer

Fixed replica count for vertical autoscaling (autoscalingMode "vertical"). Mutually exclusive with minReplicas/maxReplicas. When switching to vertical (autoscalingMode "vertical") with numReplicas and no memory, the service's stored baseline per-replica memory is kept as the new vertical range.

minReplicas, integer

Minimum number of replicas. A minReplicas/maxReplicas band scales the replica count in horizontal autoscaling (autoscalingMode "horizontal"). Must be provided together with maxReplicas. Mutually exclusive with numReplicas. Requires horizontal autoscaling to be enabled for the service, unless autoscalingMode is omitted or "vertical" and minReplicas equals maxReplicas (an equal band is then an accepted vertical fixed count and needs no horizontal entitlement).

maxReplicas, integer

Maximum number of replicas. A minReplicas/maxReplicas band scales the replica count in horizontal autoscaling (autoscalingMode "horizontal"). Must be provided together with minReplicas. Mutually exclusive with numReplicas. Requires horizontal autoscaling to be enabled for the service, unless autoscalingMode is omitted or "vertical" and minReplicas equals maxReplicas (an equal band is then an accepted vertical fixed count and needs no horizontal entitlement).

idleScaling, boolean

When set to true the service is allowed to scale down to zero when idle. True by default.

idleTimeoutMinutes, number

Set minimum idling timeout (in minutes). Must be >= 5 minutes.

profile, string

Custom instance profile. Omit to leave the current profile unchanged. Profiles other than v1-default and v2-default are only available for ENTERPRISE and BYOC organization tiers. Standard values: 'v1-default', 'v2-default', 'v1-highmem-xs', 'v1-highmem-s', 'v1-highmem-m', 'v1-highmem-l', 'v1-highmem-xl'. A BYOC profile (e.g. 'v1-standard-byoc-16') is a pin: minReplicaMemoryGb and maxReplicaMemoryGb must both be sent and equal that profile's memory size, and a memory range cannot be combined with it. To move a pinned BYOC service to a memory range, send the range without a profile, or with 'v1-default'. A non-BYOC custom profile other than v2-default cannot be combined with a memory change; send the profile alone to change only the name. The profile cannot switch a service between Gen 1 and Gen 2 hardware (to or from 'v2-default'): the request is rejected with a 400 error; contact support to move it. While a schedule entry is active the new profile is stored on the schedule base config and the running service keeps the entry profile until the window ends. Use the serviceProfiles endpoint to list the profiles available to the organization.

Example request

{
  "minReplicaMemoryGb": 16,
  "maxReplicaMemoryGb": 120,
  "autoscalingMode": "vertical",
  "numReplicas": 3,
  "minReplicas": 1,
  "maxReplicas": 5
}

Response

Successful response

object required
status, number

HTTP status code.

requestId, string uuid

Unique id assigned to every request. UUIDv4

result, ServiceScalingPatchResponse

Example response

{
  "status": 200,
  "result": {
    "endpoints": [
      {
        "protocol": "mysql"
      }
    ],
    "minTotalMemoryGb": 48,
    "maxTotalMemoryGb": 360,
    "minReplicaMemoryGb": 16,
    "maxReplicaMemoryGb": 120,
    "numReplicas": 3,
    "minReplicas": 1,
    "maxReplicas": 5,
    "autoscalingMode": "vertical",
    "replicaMemoryGb": 32,
    "createdAt": "2026-03-26T20:51:16Z",
    "tags": [
      {
        "key": "Environment",
        "value": "staging"
      }
    ]
  }
}

Changes