Create or replace service autoscaling schedule
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. Requires the scheduled autoscaling feature to be enabled for the organization. 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.
curl --request POST \
--url https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"entries": [
{
"name": "Business hours",
"weekdays": [
1,
2,
3,
4,
5
],
"startHourUtc": 9,
"endHourUtc": 17,
"autoscalingMode": "vertical",
"minReplicaMemoryGb": 16,
"maxReplicaMemoryGb": 16,
"numReplicas": 3,
"minReplicas": 2,
"maxReplicas": 3,
"idleScaling": true,
"idleTimeoutMinutes": 123
}
]
}
'import requests
url = "https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule"
payload = { "entries": [
{
"name": "Business hours",
"weekdays": [1, 2, 3, 4, 5],
"startHourUtc": 9,
"endHourUtc": 17,
"autoscalingMode": "vertical",
"minReplicaMemoryGb": 16,
"maxReplicaMemoryGb": 16,
"numReplicas": 3,
"minReplicas": 2,
"maxReplicas": 3,
"idleScaling": True,
"idleTimeoutMinutes": 123
}
] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entries: [
{
name: 'Business hours',
weekdays: [1, 2, 3, 4, 5],
startHourUtc: 9,
endHourUtc: 17,
autoscalingMode: 'vertical',
minReplicaMemoryGb: 16,
maxReplicaMemoryGb: 16,
numReplicas: 3,
minReplicas: 2,
maxReplicas: 3,
idleScaling: true,
idleTimeoutMinutes: 123
}
]
})
};
fetch('https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'entries' => [
[
'name' => 'Business hours',
'weekdays' => [
1,
2,
3,
4,
5
],
'startHourUtc' => 9,
'endHourUtc' => 17,
'autoscalingMode' => 'vertical',
'minReplicaMemoryGb' => 16,
'maxReplicaMemoryGb' => 16,
'numReplicas' => 3,
'minReplicas' => 2,
'maxReplicas' => 3,
'idleScaling' => true,
'idleTimeoutMinutes' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule"
payload := strings.NewReader("{\n \"entries\": [\n {\n \"name\": \"Business hours\",\n \"weekdays\": [\n 1,\n 2,\n 3,\n 4,\n 5\n ],\n \"startHourUtc\": 9,\n \"endHourUtc\": 17,\n \"autoscalingMode\": \"vertical\",\n \"minReplicaMemoryGb\": 16,\n \"maxReplicaMemoryGb\": 16,\n \"numReplicas\": 3,\n \"minReplicas\": 2,\n \"maxReplicas\": 3,\n \"idleScaling\": true,\n \"idleTimeoutMinutes\": 123\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"entries\": [\n {\n \"name\": \"Business hours\",\n \"weekdays\": [\n 1,\n 2,\n 3,\n 4,\n 5\n ],\n \"startHourUtc\": 9,\n \"endHourUtc\": 17,\n \"autoscalingMode\": \"vertical\",\n \"minReplicaMemoryGb\": 16,\n \"maxReplicaMemoryGb\": 16,\n \"numReplicas\": 3,\n \"minReplicas\": 2,\n \"maxReplicas\": 3,\n \"idleScaling\": true,\n \"idleTimeoutMinutes\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entries\": [\n {\n \"name\": \"Business hours\",\n \"weekdays\": [\n 1,\n 2,\n 3,\n 4,\n 5\n ],\n \"startHourUtc\": 9,\n \"endHourUtc\": 17,\n \"autoscalingMode\": \"vertical\",\n \"minReplicaMemoryGb\": 16,\n \"maxReplicaMemoryGb\": 16,\n \"numReplicas\": 3,\n \"minReplicas\": 2,\n \"maxReplicas\": 3,\n \"idleScaling\": true,\n \"idleTimeoutMinutes\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"result": {
"entries": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"weekdays": [
123
],
"startHourUtc": 11,
"endHourUtc": 12,
"autoscalingMode": "vertical",
"isActiveNow": true,
"minReplicaMemoryGb": 123,
"maxReplicaMemoryGb": 123,
"minReplicas": 123,
"maxReplicas": 123,
"idleScaling": true,
"idleTimeoutMinutes": 123
}
],
"baseConfig": {
"autoscalingMode": "vertical",
"minReplicaMemoryGb": 123,
"maxReplicaMemoryGb": 123,
"minReplicas": 123,
"maxReplicas": 123,
"idleScaling": true,
"idleTimeoutMinutes": 123
},
"activeEntryId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"status": 400,
"error": "<string>",
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"status": 500,
"error": "<string>",
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}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. Requires the scheduled autoscaling feature to be enabled for the organization. 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.
Authorizations
Use key ID and key secret obtained in ClickHouse Cloud console: https://clickhouse.com/docs/cloud/manage/openapi
Path Parameters
Body
Was this page helpful?
curl --request POST \
--url https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"entries": [
{
"name": "Business hours",
"weekdays": [
1,
2,
3,
4,
5
],
"startHourUtc": 9,
"endHourUtc": 17,
"autoscalingMode": "vertical",
"minReplicaMemoryGb": 16,
"maxReplicaMemoryGb": 16,
"numReplicas": 3,
"minReplicas": 2,
"maxReplicas": 3,
"idleScaling": true,
"idleTimeoutMinutes": 123
}
]
}
'import requests
url = "https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule"
payload = { "entries": [
{
"name": "Business hours",
"weekdays": [1, 2, 3, 4, 5],
"startHourUtc": 9,
"endHourUtc": 17,
"autoscalingMode": "vertical",
"minReplicaMemoryGb": 16,
"maxReplicaMemoryGb": 16,
"numReplicas": 3,
"minReplicas": 2,
"maxReplicas": 3,
"idleScaling": True,
"idleTimeoutMinutes": 123
}
] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entries: [
{
name: 'Business hours',
weekdays: [1, 2, 3, 4, 5],
startHourUtc: 9,
endHourUtc: 17,
autoscalingMode: 'vertical',
minReplicaMemoryGb: 16,
maxReplicaMemoryGb: 16,
numReplicas: 3,
minReplicas: 2,
maxReplicas: 3,
idleScaling: true,
idleTimeoutMinutes: 123
}
]
})
};
fetch('https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'entries' => [
[
'name' => 'Business hours',
'weekdays' => [
1,
2,
3,
4,
5
],
'startHourUtc' => 9,
'endHourUtc' => 17,
'autoscalingMode' => 'vertical',
'minReplicaMemoryGb' => 16,
'maxReplicaMemoryGb' => 16,
'numReplicas' => 3,
'minReplicas' => 2,
'maxReplicas' => 3,
'idleScaling' => true,
'idleTimeoutMinutes' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule"
payload := strings.NewReader("{\n \"entries\": [\n {\n \"name\": \"Business hours\",\n \"weekdays\": [\n 1,\n 2,\n 3,\n 4,\n 5\n ],\n \"startHourUtc\": 9,\n \"endHourUtc\": 17,\n \"autoscalingMode\": \"vertical\",\n \"minReplicaMemoryGb\": 16,\n \"maxReplicaMemoryGb\": 16,\n \"numReplicas\": 3,\n \"minReplicas\": 2,\n \"maxReplicas\": 3,\n \"idleScaling\": true,\n \"idleTimeoutMinutes\": 123\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"entries\": [\n {\n \"name\": \"Business hours\",\n \"weekdays\": [\n 1,\n 2,\n 3,\n 4,\n 5\n ],\n \"startHourUtc\": 9,\n \"endHourUtc\": 17,\n \"autoscalingMode\": \"vertical\",\n \"minReplicaMemoryGb\": 16,\n \"maxReplicaMemoryGb\": 16,\n \"numReplicas\": 3,\n \"minReplicas\": 2,\n \"maxReplicas\": 3,\n \"idleScaling\": true,\n \"idleTimeoutMinutes\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/scalingSchedule")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entries\": [\n {\n \"name\": \"Business hours\",\n \"weekdays\": [\n 1,\n 2,\n 3,\n 4,\n 5\n ],\n \"startHourUtc\": 9,\n \"endHourUtc\": 17,\n \"autoscalingMode\": \"vertical\",\n \"minReplicaMemoryGb\": 16,\n \"maxReplicaMemoryGb\": 16,\n \"numReplicas\": 3,\n \"minReplicas\": 2,\n \"maxReplicas\": 3,\n \"idleScaling\": true,\n \"idleTimeoutMinutes\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"result": {
"entries": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"weekdays": [
123
],
"startHourUtc": 11,
"endHourUtc": 12,
"autoscalingMode": "vertical",
"isActiveNow": true,
"minReplicaMemoryGb": 123,
"maxReplicaMemoryGb": 123,
"minReplicas": 123,
"maxReplicas": 123,
"idleScaling": true,
"idleTimeoutMinutes": 123
}
],
"baseConfig": {
"autoscalingMode": "vertical",
"minReplicaMemoryGb": 123,
"maxReplicaMemoryGb": 123,
"minReplicas": 123,
"maxReplicas": 123,
"idleScaling": true,
"idleTimeoutMinutes": 123
},
"activeEntryId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"status": 400,
"error": "<string>",
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"status": 500,
"error": "<string>",
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}