> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8c05c8a2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Update service state

> Starts or stop service



## OpenAPI

````yaml /_specs/cloud-openapi.json patch /v1/organizations/{organizationId}/services/{serviceId}/state
openapi: 3.0.1
info:
  title: OpenAPI spec for ClickHouse Cloud
  version: '1.0'
  contact:
    name: ClickHouse Support
    url: >-
      https://clickhouse.com/docs/en/cloud/manage/openapi?referrer=openapi-299828
    email: support@clickhouse.com
servers:
  - url: https://api.clickhouse.cloud
security:
  - basicAuth: []
tags:
  - name: Organization
  - name: User management
  - name: Billing
  - name: Service
  - name: Backup
  - name: OpenAPI
  - name: Prometheus
  - name: ClickPipes
paths:
  /v1/organizations/{organizationId}/services/{serviceId}/state:
    patch:
      tags:
        - Service
      summary: Update service state
      description: Starts or stop service
      parameters:
        - in: path
          name: organizationId
          description: ID of the organization that owns the service.
          required: true
          schema:
            type: string
            format: uuid
        - in: path
          name: serviceId
          description: ID of the service to update state.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceStatePatchRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: number
                    description: HTTP status code.
                    example: 200
                  requestId:
                    type: string
                    description: Unique id assigned to every request. UUIDv4
                    format: uuid
                  result:
                    $ref: '#/components/schemas/Service'
        '400':
          description: >-
            The server cannot or will not process the request due to something
            that is perceived to be a client error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: number
                    description: HTTP status code.
                    example: 400
                  error:
                    type: string
                    description: Detailed error description.
components:
  schemas:
    ServiceStatePatchRequest:
      properties:
        command:
          description: 'Command to change the state: ''start'', ''stop''.'
          type: string
          enum:
            - start
            - stop
    Service:
      properties:
        id:
          description: Unique service ID.
          type: string
          format: uuid
        name:
          description: >-
            Name of the service. Alphanumerical string with whitespaces up to 50
            characters.
          type: string
        provider:
          description: Cloud provider
          type: string
          enum:
            - aws
            - gcp
            - azure
        region:
          description: Service region.
          type: string
          enum:
            - ap-northeast-1
            - ap-south-1
            - ap-southeast-1
            - ap-southeast-2
            - eu-central-1
            - eu-west-1
            - eu-west-2
            - me-central-1
            - us-east-1
            - us-east-2
            - us-west-2
            - us-east1
            - us-central1
            - europe-west4
            - asia-southeast1
            - eastus
            - eastus2
            - westus3
            - germanywestcentral
        state:
          description: Current state of the service.
          type: string
          enum:
            - starting
            - stopping
            - terminating
            - awaking
            - partially_running
            - provisioning
            - running
            - stopped
            - terminated
            - degraded
            - failed
            - idle
        clickhouseVersion:
          description: ClickHouse version of the service.
          type: string
        endpoints:
          type: array
          description: List of all service endpoints.
          items:
            $ref: '#/components/schemas/ServiceEndpoint'
        tier:
          description: >-
            DEPRECATED for BASIC, SCALE and ENTERPRISE organization tiers. Tier
            of the service: 'development', 'production', 'dedicated_high_mem',
            'dedicated_high_cpu', 'dedicated_standard',
            'dedicated_standard_n2d_standard_4',
            'dedicated_standard_n2d_standard_8',
            'dedicated_standard_n2d_standard_32',
            'dedicated_standard_n2d_standard_128',
            'dedicated_standard_n2d_standard_32_16SSD',
            'dedicated_standard_n2d_standard_64_24SSD'. Production services
            scale, Development are fixed size. Azure services don't support
            Development tier
          type: string
          enum:
            - development
            - production
            - dedicated_high_mem
            - dedicated_high_cpu
            - dedicated_standard
            - dedicated_standard_n2d_standard_4
            - dedicated_standard_n2d_standard_8
            - dedicated_standard_n2d_standard_32
            - dedicated_standard_n2d_standard_128
            - dedicated_standard_n2d_standard_32_16SSD
            - dedicated_standard_n2d_standard_64_24SSD
          deprecated: true
        minTotalMemoryGb:
          description: >-
            DEPRECATED - inaccurate for services with non-default numbers of
            replicas. Minimum memory of three workers during auto-scaling in Gb.
            Available only for 'production' services. Must be a multiple of 12
            and greater than or equal to 24.
          type: number
          minimum: 24
          maximum: 1068
          multipleOf: 12
          example: 48
          deprecated: true
        maxTotalMemoryGb:
          description: >-
            DEPRECATED - inaccurate for services with non-default numbers of
            replicas. Maximum memory of three workers during auto-scaling in Gb.
            Available only for 'production' services. Must be a multiple of 12
            and lower than or equal to 360 for non paid services or 1068 for
            paid services.
          type: number
          minimum: 24
          maximum: 1068
          multipleOf: 12
          example: 360
          deprecated: true
        minReplicaMemoryGb:
          description: >-
            Minimum total memory of each replica during auto-scaling in Gb. Must
            be a multiple of 4 and greater than or equal to 8.
          type: number
          minimum: 8
          maximum: 356
          multipleOf: 4
          example: 16
        maxReplicaMemoryGb:
          description: >-
            Maximum total memory of each replica during auto-scaling in Gb. 
            Must be a multiple of 4 and lower than or equal to 120* for non paid
            services or 356* for paid services.* - maximum replica size subject
            to cloud provider hardware availability in your selected region. 
          type: number
          minimum: 8
          maximum: 356
          multipleOf: 4
          example: 120
        numReplicas:
          description: >-
            Number of replicas for the service. The number of replicas must be
            between 2 and 20 for the first service in a warehouse. Services that
            are created in an existing warehouse can have a number of replicas
            as low as 1. Further restrictions may apply based on your
            organization's tier. It defaults to 1 for the BASIC tier and 3 for
            the SCALE and ENTERPRISE tiers.
          type: number
          minimum: 1
          maximum: 20
          example: 3
        idleScaling:
          description: >-
            When set to true the service is allowed to scale down to zero when
            idle. True by default.
          type: boolean
        idleTimeoutMinutes:
          description: Set minimum idling timeout (in minutes). Must be >= 5 minutes.
          type: number
        ipAccessList:
          type: array
          description: List of IP addresses allowed to access the service
          items:
            $ref: '#/components/schemas/IpAccessListEntry'
        createdAt:
          description: Service creation timestamp. ISO-8601.
          type: string
          format: date-time
        encryptionKey:
          description: Optional customer provided disk encryption key
          type: string
        encryptionAssumedRoleIdentifier:
          description: Optional role to use for disk encryption
          type: string
        iamRole:
          description: IAM role used for accessing objects in s3
          type: string
        privateEndpointIds:
          type: array
          description: List of private endpoints
          items:
            type: string
        availablePrivateEndpointIds:
          type: array
          description: >-
            List of available private endpoints ids that can be attached to the
            service
          items:
            type: string
        dataWarehouseId:
          description: Data warehouse containing this service
          type: string
        isPrimary:
          description: True if this service is the primary service in the data warehouse
          type: boolean
        isReadonly:
          description: >-
            True if this service is read-only. It can only be read-only if a
            dataWarehouseId is provided.
          type: boolean
        releaseChannel:
          description: >-
            Select fast if you want to get new ClickHouse releases as soon as
            they are available. You'll get new features faster, but with a
            higher risk of bugs. Select slow if you would like to defer releases
            to give yourself more time to test. This feature is only available
            for production services. default is the regular release channel.
          type: string
          enum:
            - slow
            - default
            - fast
        byocId:
          description: >-
            This is the ID returned after setting up a region for Bring Your Own
            Cloud (BYOC). When the byocId parameter is specified, the
            minReplicaMemoryGb and the maxReplicaGb parameters are required too,
            with values included among the following sizes: 48, 116, 172, 232.
          type: string
        hasTransparentDataEncryption:
          description: >-
            True if the service should have the Transparent Data Encryption
            (TDE) enabled. TDE is only available for ENTERPRISE organizations
            tiers and can only be enabled at service creation.
          type: boolean
        profile:
          description: >-
            Custom instance profile. Only available for ENTERPRISE organization
            tiers.
          type: string
          enum:
            - v1-default
            - v1-highmem-xs
            - v1-highmem-s
            - v1-highmem-m
            - v1-highmem-l
            - v1-highmem-xl
            - v1-highcpu-s
            - v1-highcpu-m
            - v1-highcpu-l
            - v1-highcpu-xl
        transparentDataEncryptionKeyId:
          description: >-
            The ID of the Transparent Data Encryption key used for the service.
            This is only available if hasTransparentDataEncryption is true.
          type: string
        encryptionRoleId:
          description: >-
            The ID of the IAM role used for encryption. This is only available
            if hasTransparentDataEncryption is true.
          type: string
        complianceType:
          description: Type of regulatory compliance for service.
          type: string
          enum:
            - hipaa
            - pci
    ServiceEndpoint:
      properties:
        protocol:
          description: 'Endpoint protocol: ''https'', ''nativesecure'', ''mysql''.'
          type: string
          enum:
            - https
            - nativesecure
            - mysql
          example: mysql
        host:
          description: Service host name
          type: string
        port:
          description: Numeric port
          type: number
        username:
          description: Optional username for the endpoint
          nullable: true
          type: string
    IpAccessListEntry:
      properties:
        source:
          description: IP or CIDR
          type: string
        description:
          description: >-
            Optional description of IPv4 address or IPv4 CIDR to allow access
            from
          type: string
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >-
        Use key ID and key secret obtained in ClickHouse Cloud console:
        https://clickhouse.com/docs/cloud/manage/openapi

````