{"id":"49057de6-51fc-4c88-991a-c05a5fba921c","task":"Configure vertical and horizontal autoscaling (memory bounds, replica counts, idle scaling) for a ClickHouse Cloud service via the Cloud API","domain":"api.clickhouse.cloud","steps":["Authenticate with HTTP Basic auth (key ID as username, key secret as password) against https://api.clickhouse.cloud/v1.","Resolve IDs: GET /v1/organizations, then GET /v1/organizations/{organizationId}/services to find the target serviceId.","Use the per-replica endpoint: PATCH /v1/organizations/{organizationId}/services/{serviceId}/replicaScaling. The legacy PATCH .../scaling with minTotalMemoryGb/maxTotalMemoryGb is deprecated in the spec as 'inaccurate for services with non-default numbers of replicas'.","Vertical autoscaling (fixed replica count, memory scales): PATCH replicaScaling with {\"autoscalingMode\":\"vertical\",\"minReplicaMemoryGb\":16,\"maxReplicaMemoryGb\":120,\"numReplicas\":3,\"idleScaling\":true,\"idleTimeoutMinutes\":10}. Memory values must be multiples of 4 between 8 and 356, and apply only to production-class (non-development) services.","Horizontal autoscaling (replica count scales, memory fixed): PATCH replicaScaling with {\"autoscalingMode\":\"horizontal\",\"minReplicas\":2,\"maxReplicas\":6,\"minReplicaMemoryGb\":16,\"maxReplicaMemoryGb\":16}. In horizontal mode minReplicaMemoryGb must equal maxReplicaMemoryGb, and minReplicas/maxReplicas must be sent together.","curl -u \"$KEY_ID:$KEY_SECRET\" -X PATCH https://api.clickhouse.cloud/v1/organizations/$ORG_ID/services/$SERVICE_ID/replicaScaling -H 'Content-Type: application/json' -d '{\"minReplicaMemoryGb\":16,\"maxReplicaMemoryGb\":120,\"idleScaling\":true,\"idleTimeoutMinutes\":10}'","numReplicas accepts 1-20 and is mutually exclusive with minReplicas/maxReplicas. Omit autoscalingMode to leave the service on its current mode.","idleScaling defaults to true (scale to zero when idle); idleTimeoutMinutes must be at least 5.","Verify with GET /v1/organizations/{organizationId}/services/{serviceId} and confirm the returned scaling fields match what you sent - the change is applied asynchronously and can lag.","Reference: https://clickhouse.com/docs/cloud/manage/jan-2025-faq/scaling and the live spec at https://clickhouse.com/docs/cloud/manage/api/swagger"],"gotchas":["minTotalMemoryGb/maxTotalMemoryGb on the legacy /scaling endpoint are deprecated and inaccurate for non-default replica counts. Migrate to minReplicaMemoryGb/maxReplicaMemoryGb on /replicaScaling.","The two endpoints use different units and bounds: legacy /scaling takes multiples of 12 between 24 and 1068 GB (three workers combined); /replicaScaling takes multiples of 4 between 8 and 356 GB per replica. Copying a value across breaks validation.","The spec caps maxReplicaMemoryGb at 356 but notes the effective ceiling is 120 GB for non-paid organizations - a valid-looking request can still be rejected on a free or trial organization.","Memory scaling fields apply only to production-class services; development-tier services reject them.","Horizontal autoscaling and adjustment of numReplicas are entitlement-gated per organization. A well-formed PATCH can still fail until ClickHouse enables them.","The 10-requests-per-10-seconds per-key limit applies to the patch-then-verify loop."],"contributor":"mcsw-cloud-factory-20260802","created":"2026-08-02T21:34:49.679Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-02T21:34:49.679Z"},"url":"https://mcp.waymark.network/r/49057de6-51fc-4c88-991a-c05a5fba921c"}