> ## Documentation Index
> Fetch the complete documentation index at: https://www.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Scale or edit a cluster.



## OpenAPI

````yaml /openapi/cloud/2022-03-31.json patch /api/v1/clusters/{cluster_id}
openapi: 3.0.0
info:
  title: CockroachDB Cloud API
  description: >-
    This is an early access, experimental version of the Cloud API. The
    interface and output is subject to change, and there may be bugs.


    # Authentication


    <!-- ReDoc-Inject: <security-definitions> -->
  version: '2022-03-31'
  contact:
    name: Cockroach Labs Support
    url: https://support.cockroachlabs.com
    email: support@cockroachlabs.com
servers:
  - url: https://cockroachlabs.cloud
security:
  - Bearer: []
tags:
  - name: CockroachCloud
externalDocs:
  description: Use the CockroachDB Cloud API
  url: https://www.cockroachlabs.com/docs/cockroachcloud/cloud-api
paths:
  /api/v1/clusters/{cluster_id}:
    patch:
      tags:
        - CockroachCloud
      summary: Scale or edit a cluster.
      operationId: CockroachCloud_UpdateCluster
      parameters:
        - name: cluster_id
          in: path
          required: true
          schema:
            type: string
        - name: field_mask
          in: query
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateClusterSpecification'
        required: true
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Cluster'
        '400':
          description: Returned when a request field is invalid.
          content:
            application/json:
              schema: {}
        '401':
          description: Returned when the token bearer cannot be authenticated.
          content:
            application/json:
              schema: {}
        '403':
          description: >-
            Returned when the user does not have permission to access the
            resource.
          content:
            application/json:
              schema: {}
        '404':
          description: Returned when the resource does not exist.
          content:
            application/json:
              schema: {}
        5XX:
          description: Server error
          content:
            application/json:
              schema: {}
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Status'
      x-codeSamples:
        - lang: curl
          source: |-
            curl --request PATCH \
              --url 'https://cockroachlabs.cloud/api/v1/clusters/{cluster_id}?field_mask=SOME_STRING_VALUE' \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"dedicated":{"region_nodes":{"us-west1":3,"us-central1":5},"hardware":{"machine_type":"n2-standard-8"}}}'
components:
  schemas:
    UpdateClusterSpecification:
      type: object
      example:
        dedicated:
          region_nodes:
            us-west1: 3
            us-central1: 5
          hardware:
            machine_type: n2-standard-8
      properties:
        dedicated:
          $ref: '#/components/schemas/DedicatedClusterUpdateSpecification'
        serverless:
          $ref: '#/components/schemas/ServerlessClusterUpdateSpecification'
    Cluster:
      type: object
      example:
        id: 35c4abb2-bb66-46d7-afed-25ebef5ed2aa
        name: example-cluster
        cockroach_version: v21.2.4
        plan: SERVERLESS
        cloud_provider: GCP
        account_id: ''
        state: CREATED
        creator_id: 7cde0cd9-0d8a-4008-8f90-45092ce8afc1
        operation_status: CLUSTER_STATUS_UNSPECIFIED
        config:
          serverless:
            spend_limit: 0
            routing_id: example-cluster-1533
        regions:
          - name: us-central1
            sql_dns: free-tier7.gcp-us-central1.crdb.io
            ui_dns: ''
            node_count: 0
        created_at: '2022-03-22T20:23:11.285067Z'
        updated_at: '2022-03-22T20:23:11.879593Z'
        deleted_at: null
      properties:
        id:
          type: string
        name:
          type: string
        cockroach_version:
          type: string
        plan:
          $ref: '#/components/schemas/Plan'
        cloud_provider:
          $ref: '#/components/schemas/api.CloudProvider'
        account_id:
          type: string
        state:
          $ref: '#/components/schemas/ClusterStateType'
        creator_id:
          type: string
        operation_status:
          $ref: '#/components/schemas/ClusterStatusType'
        config:
          $ref: '#/components/schemas/ClusterConfig'
        regions:
          type: array
          items:
            $ref: '#/components/schemas/Region'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        deleted_at:
          type: string
          format: date-time
      required:
        - id
        - name
        - cockroach_version
        - plan
        - cloud_provider
        - state
        - creator_id
        - operation_status
        - config
        - regions
    Status:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/Any'
    DedicatedClusterUpdateSpecification:
      type: object
      properties:
        region_nodes:
          type: object
          additionalProperties:
            type: integer
            format: int32
          description: |-
            Region keys should match the cloud provider's zone code.
            For example, for Oregon, set region_name to "us-west2" for
            GCP and "us-west-2" for AWS. Values represent the node count.
        hardware:
          $ref: '#/components/schemas/DedicatedHardwareUpdateSpecification'
    ServerlessClusterUpdateSpecification:
      type: object
      properties:
        spend_limit:
          type: integer
          format: int32
          title: Spend limit in US cents
      required:
        - spend_limit
    Plan:
      type: string
      enum:
        - PLAN_UNSPECIFIED
        - DEDICATED
        - CUSTOM
        - SERVERLESS
      default: PLAN_UNSPECIFIED
      description: >2-
         - DEDICATED: A paid plan that offers dedicated hardware in any location.
         - CUSTOM: A plan option that is used for clusters whose machine configs are not 
        supported in self-service. All INVOICE clusters are under this plan
        option.
         - SERVERLESS: A paid plan that runs on shared hardware and caps the users'
        maximum monthly spending to a user-specified (possibly 0) amount.
    api.CloudProvider:
      type: string
      enum:
        - CLOUD_PROVIDER_UNSPECIFIED
        - GCP
        - AWS
      default: CLOUD_PROVIDER_UNSPECIFIED
      description: |2-
         - GCP: The Google Cloud Platform cloud provider.
         - AWS: The Amazon Web Services cloud provider.
    ClusterStateType:
      type: string
      enum:
        - CLUSTER_STATE_UNSPECIFIED
        - CREATING
        - CREATED
        - CREATION_FAILED
        - DELETED
        - LOCKED
      default: CLUSTER_STATE_UNSPECIFIED
      description: >2-
         - LOCKED: An exclusive operation is being performed on this cluster.
        Other operations should not proceed if they did not set a cluster into
        the LOCKED state.
    ClusterStatusType:
      type: string
      enum:
        - CLUSTER_STATUS_UNSPECIFIED
        - CRDB_MAJOR_UPGRADE_RUNNING
        - CRDB_MAJOR_UPGRADE_FAILED
        - CRDB_MAJOR_ROLLBACK_RUNNING
        - CRDB_MAJOR_ROLLBACK_FAILED
        - CRDB_PATCH_RUNNING
        - CRDB_PATCH_FAILED
        - CRDB_SCALE_RUNNING
        - CRDB_SCALE_FAILED
        - MAINTENANCE_RUNNING
        - CRDB_INSTANCE_UPDATE_RUNNING
        - CRDB_INSTANCE_UPDATE_FAILED
        - CRDB_EDIT_CLUSTER_RUNNING
        - CRDB_EDIT_CLUSTER_FAILED
        - CRDB_CMEK_OPERATION_RUNNING
        - CRDB_CMEK_OPERATION_FAILED
        - TENANT_RESTORE_RUNNING
        - TENANT_RESTORE_FAILED
      default: CLUSTER_STATUS_UNSPECIFIED
    ClusterConfig:
      type: object
      properties:
        dedicated:
          $ref: '#/components/schemas/DedicatedHardwareConfig'
        serverless:
          $ref: '#/components/schemas/ServerlessClusterConfig'
    Region:
      type: object
      properties:
        name:
          type: string
        sql_dns:
          type: string
        ui_dns:
          type: string
        node_count:
          type: integer
          format: int32
          description: NodeCount will be 0 for serverless clusters.
      required:
        - name
        - sql_dns
        - ui_dns
        - node_count
    Any:
      type: object
      properties:
        '@type':
          type: string
      additionalProperties: {}
    DedicatedHardwareUpdateSpecification:
      type: object
      properties:
        machine_spec:
          $ref: '#/components/schemas/DedicatedMachineTypeSpecification'
        storage_gib:
          type: integer
          format: int32
          description: StorageGiB is the number of storage GiB per node in the cluster.
        disk_iops:
          type: integer
          format: int32
          description: |-
            DiskIOPs is the number of disk I/O operations per second that are
            permitted on each node in the cluster. Zero indicates the cloud
            provider-specific default. Only available for AWS clusters.
    DedicatedHardwareConfig:
      type: object
      properties:
        machine_type:
          type: string
          description: |-
            MachineType is the machine type identifier within the given cloud
            provider, ex. m5.xlarge, n2-standard-4.
        num_virtual_cpus:
          type: integer
          format: int32
          description: >-
            NumVirtualCPUs is the number of virtual CPUs per node in the
            cluster.
        storage_gib:
          type: integer
          format: int32
          description: StorageGiB is the number of storage GiB per node in the cluster.
        memory_gib:
          type: number
          format: float
          description: MemoryGiB is the memory GiB per node in the cluster.
        disk_iops:
          type: integer
          format: int32
          description: |-
            DiskIOPs is the number of disk I/O operations per second that are
            permitted on each node in the cluster. Zero indicates the cloud
            provider-specific default.
      required:
        - machine_type
        - num_virtual_cpus
        - storage_gib
        - memory_gib
        - disk_iops
    ServerlessClusterConfig:
      type: object
      properties:
        spend_limit:
          type: integer
          format: int32
          description: Spend limit in US cents.
        routing_id:
          type: string
          description: Used to build a connection string.
      required:
        - spend_limit
        - routing_id
    DedicatedMachineTypeSpecification:
      type: object
      properties:
        machine_type:
          type: string
          description: |-
            MachineType is the machine type identifier within the given cloud
            provider, ex. m5.xlarge, n2-standard-4.
        num_virtual_cpus:
          type: integer
          format: int32
          description: |-
            NumVirtualCPUs may be used to automatically select a machine type
            according to the desired number of vCPUs.
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````