---
title: "Create or replace service autoscaling schedule"
method: POST
path: "/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule"
tags: ["Service"]
---

# Create or replace service autoscaling schedule

`POST /v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule`

## Request

- Base URL: `https://api.clickhouse.cloud`
- URL: `https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule`
- Auth: HTTP basic

Creates or fully replaces the autoscaling schedule for a service. Pass an empty `entries` array to clear the schedule — a subsequent GET will return 404, and the response will contain an empty `baseConfig` (all fields absent). The base scaling config (applied when no entry is active) is managed separately via the `replicaScaling` endpoint. Gen 2 (v2-default) services use a fixed size and cannot idle. An entry may leave out fields it takes from the base config, but each entry combined with those fields must have equal minReplicaMemoryGb and maxReplicaMemoryGb, a fixed replica count (numReplicas, or equal minReplicas and maxReplicas), and idling off; otherwise the request is rejected. Available on the Scale and Enterprise plans; Basic organizations get a 403.

## Path parameters

- `organizationId` string, uuid, required
- `serviceId` string, uuid, required

## Request body

- ScalingSchedulePostRequest
  - `entries` ScalingScheduleEntryRequest[], required: List of schedule entries. Pass an empty array to clear the schedule.
    - `name` string, required: Human-readable label for this schedule entry.
    - `weekdays` integer[], required: Days of the week this entry applies to. 0 = Sunday, 1 = Monday, …, 6 = Saturday.
    - `startHourUtc` integer, required: UTC hour (0–23) when this entry becomes active (inclusive).
    - `endHourUtc` integer, required: UTC hour (1–24) when this entry deactivates (exclusive). Must differ from startHourUtc. Set to 24 to end at midnight. Values less than startHourUtc create an overnight window spanning midnight.
    - `autoscalingMode` 'vertical' | 'horizontal': Autoscaling mode for this entry. "vertical" (the default when omitted) 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). Horizontal requires the feature to be enabled for the organization.
    - `minReplicaMemoryGb` number: Minimum memory per replica (Gb). Optional for vertical entries — provide both bounds for a memory range, or omit both to inherit memory from the base scaling config. Required for horizontal (both bounds, equal to maxReplicaMemoryGb — memory is fixed while the replica count scales). The upper bound is tier-dependent (lower for non-paid organizations) and enforced when the entry is applied.
    - `maxReplicaMemoryGb` number: Maximum memory per replica (Gb). Optional for vertical entries — provide both bounds for a memory range, or omit both to inherit memory from the base scaling config. Required for horizontal (both bounds, equal to minReplicaMemoryGb — memory is fixed while the replica count scales). The upper bound is tier-dependent (lower for non-paid organizations) and enforced when the entry is applied.
    - `numReplicas` integer: Fixed replica count for a vertical entry (autoscalingMode "vertical" or omitted). Mutually exclusive with minReplicas/maxReplicas. The per-service replica maximum is variable (tier-dependent, configurable per service) and enforced when the entry is applied, not at request time.
    - `minReplicas` integer: Minimum number of replicas. A minReplicas/maxReplicas band scales the replica count in a horizontal entry (autoscalingMode "horizontal"); when autoscalingMode is omitted or "vertical", an equal band (minReplicas === maxReplicas) is instead an accepted vertical fixed count and needs no horizontal entitlement. Must be provided together with maxReplicas. The per-service replica maximum is variable (tier-dependent, configurable per service) and enforced when the entry is applied, not at request time.
    - `maxReplicas` integer: Maximum number of replicas. A minReplicas/maxReplicas band scales the replica count in a horizontal entry (autoscalingMode "horizontal"); when autoscalingMode is omitted or "vertical", an equal band (minReplicas === maxReplicas) is instead an accepted vertical fixed count and needs no horizontal entitlement. Must be provided together with minReplicas. The per-service replica maximum is variable (tier-dependent, configurable per service) and enforced when the entry is applied, not at request time.
    - `idleScaling` boolean: Whether idle scaling is enabled during this window. Cannot be true on a Gen 2 (v2-default) service.
    - `idleTimeoutMinutes` integer: Idle timeout in minutes during this window.

## Response `200`

Successful response

- object
  - `status` number: HTTP status code.
  - `requestId` string, uuid: Unique id assigned to every request. UUIDv4
  - `result` ScalingSchedule
    - `entries` ScalingScheduleEntry[], required: List of schedule entries.
      - `id` string, uuid, required: Unique identifier for this schedule entry.
      - `name` string, required: Human-readable label for this schedule entry.
      - `weekdays` integer[], required: Days of the week this entry applies to. 0 = Sunday, 1 = Monday, …, 6 = Saturday.
      - `startHourUtc` integer, required: UTC hour (0–23) when this entry becomes active (inclusive).
      - `endHourUtc` integer, required: UTC hour (1–24) when this entry deactivates (exclusive). Must differ from startHourUtc. Set to 24 to end at midnight. Values less than startHourUtc create an overnight window spanning midnight.
      - `autoscalingMode` 'vertical' | 'horizontal', required: Autoscaling mode for this entry. "vertical" runs a fixed replica count while memory scales; "horizontal" scales the replica count at a fixed per-replica memory. Defaults to "vertical" for entries persisted before the mode was exposed.
      - `minReplicaMemoryGb` number: Minimum memory per replica (Gb) during this window. A range in vertical; in horizontal it equals maxReplicaMemoryGb (memory is fixed while the replica count scales).
      - `maxReplicaMemoryGb` number: Maximum memory per replica (Gb) during this window. A range in vertical; in horizontal it equals minReplicaMemoryGb (memory is fixed while the replica count scales).
      - `minReplicas` integer: Minimum number of replicas during this window. For a horizontal entry the replica count scales between minReplicas and maxReplicas; for a vertical entry minReplicas and maxReplicas are equal and report the fixed replica count (both omitted when the entry stored no count).
      - `maxReplicas` integer: Maximum number of replicas during this window. For a horizontal entry the replica count scales between minReplicas and maxReplicas; for a vertical entry minReplicas and maxReplicas are equal and report the fixed replica count (both omitted when the entry stored no count).
      - `idleScaling` boolean: Whether idle scaling is enabled during this window. Never true on a Gen 2 (v2-default) service.
      - `idleTimeoutMinutes` integer: Idle timeout in minutes during this window.
      - `isActiveNow` boolean, required: Whether this entry is currently active. Scheduled times are indicative — actions are applied on a best-effort basis and may be delayed by a few minutes.
    - `baseConfig` ScalingScheduleBaseConfig, required
      - `autoscalingMode` 'vertical' | 'horizontal': Autoscaling mode applied when no schedule entry is active. "vertical" runs a fixed replica count while memory scales; "horizontal" scales the replica count at a fixed per-replica memory.
      - `minReplicaMemoryGb` number: Minimum memory per replica (Gb) when no schedule entry is active. Absent for services that do not autoscale memory.
      - `maxReplicaMemoryGb` number: Maximum memory per replica (Gb) when no schedule entry is active. Absent for services that do not autoscale memory.
      - `minReplicas` integer: Minimum number of replicas when no schedule entry is active.
      - `maxReplicas` integer: Maximum number of replicas when no schedule entry is active.
      - `idleScaling` boolean: Whether idle scaling is enabled when no schedule entry is active.
      - `idleTimeoutMinutes` integer: Idle timeout in minutes when no schedule entry is active.
    - `activeEntryId` string, uuid: ID of the currently-active schedule entry. Absent when no entry is active and the base config is in effect.

## 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.

---

[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)
