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

# Update deployment

> Update mutable fields on a deployment. Uses deep-merge semantics on `configuration` so omitted fields are left unchanged. `name` and `model_id` cannot be changed.



## OpenAPI

````yaml /reference/openapi-deployments.json patch /v1/deployments/{name}
openapi: 3.1.0
info:
  title: Modular Cloud Deployments API
  version: 0.1.0
  description: >-
    REST API for Modular Cloud deployments. All endpoints are served at
    `https://api.modular.com`.


    Create and manage dedicated inference endpoints on Modular Cloud
    infrastructure.


    > **Not yet available.** Self-serve deployment is coming soon. [Sign up for
    private preview access](https://console.modular.com/signup) to be notified
    when it launches.
servers:
  - url: https://api.modular.com
security:
  - BearerAuth: []
tags:
  - name: Deployments
    description: >-
      Create and manage dedicated inference endpoints on Modular Cloud
      infrastructure.


      > **Not yet available.** Self-serve deployment is coming soon. [Sign up
      for private preview access](https://console.modular.com/signup) to be
      notified when it launches.
paths:
  /v1/deployments/{name}:
    parameters:
      - name: name
        in: path
        required: true
        description: Deployment name (the URL-safe slug set at creation).
        schema:
          type: string
    patch:
      tags:
        - Deployments
      summary: Update deployment
      description: >-
        Update mutable fields on a deployment. Uses deep-merge semantics on
        `configuration` so omitted fields are left unchanged. `name` and
        `model_id` cannot be changed.
      operationId: updateDeployment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDeploymentRequest'
            example:
              scaling:
                min_replicas: 2
                max_replicas: 5
      responses:
        '200':
          description: Updated deployment.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeploymentResponse'
      x-codeSamples:
        - lang: Python
          label: Python
          source: |-
            import os
            import requests

            response = requests.patch(
                "https://api.modular.com/v1/deployments/my-gemma-deployment",
                headers={
                    "Authorization": f"Bearer {os.environ['MODULAR_API_KEY']}",
                    "Content-Type": "application/json",
                },
                json={
                    "scaling": {"min_replicas": 2, "max_replicas": 5},
                },
            )

            deployment = response.json()
            print(deployment["scaling"])
        - lang: Shell
          label: curl
          source: >-
            curl -X PATCH
            https://api.modular.com/v1/deployments/my-gemma-deployment \
              -H "Authorization: Bearer $MODULAR_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "scaling": {"min_replicas": 2, "max_replicas": 5}
              }'
components:
  schemas:
    UpdateDeploymentRequest:
      type: object
      properties:
        display_name:
          type: string
        region_group:
          type: string
          enum:
            - us
            - eu
            - global
        scaling:
          $ref: '#/components/schemas/UpdateDeploymentScaling'
        configuration:
          $ref: '#/components/schemas/UpdateDeploymentConfiguration'
    DeploymentResponse:
      type: object
      properties:
        name:
          type: string
          description: Deployment name (the URL-safe slug).
        display_name:
          type: string
        deployment_id:
          type: string
          description: Unique deployment identifier.
        model_id:
          type: string
          description: Model identifier.
        status:
          $ref: '#/components/schemas/DeploymentStatus'
        endpoint_url:
          type: string
          nullable: true
          description: Inference endpoint URL. Null until the deployment is running.
        region_group:
          type: string
        scaling:
          $ref: '#/components/schemas/DeploymentScaling'
        configuration:
          $ref: '#/components/schemas/DeploymentConfiguration'
        replicas:
          $ref: '#/components/schemas/ReplicaStatus'
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        updated_at:
          type: string
          format: date-time
        updated_by:
          type: string
      required:
        - name
        - deployment_id
        - model_id
        - status
        - scaling
        - configuration
        - created_at
        - created_by
        - updated_at
        - updated_by
    UpdateDeploymentScaling:
      type: object
      properties:
        min_replicas:
          type: integer
        max_replicas:
          type: integer
        behavior:
          $ref: '#/components/schemas/ScalingBehavior'
    UpdateDeploymentConfiguration:
      type: object
      properties:
        model_path:
          type: string
        engine:
          type: string
        mode:
          type: string
    DeploymentStatus:
      type: string
      enum:
        - unknown
        - non-deployed
        - deploying
        - running
        - unhealthy
        - failed
        - updating
        - scaling
        - terminating
        - terminated
        - image-building
        - image-build-failed
        - model-seed-failed
        - image-build-succeeded
        - scaled-to-zero
        - scaling-up
        - scaling-down
      description: Current lifecycle status of a deployment.
    DeploymentScaling:
      type: object
      properties:
        min_replicas:
          type: integer
          description: Minimum number of running replicas.
        max_replicas:
          type: integer
          description: Maximum number of running replicas.
        behavior:
          $ref: '#/components/schemas/ScalingBehavior'
      required:
        - min_replicas
        - max_replicas
    DeploymentConfiguration:
      type: object
      properties:
        model_path:
          type: string
          description: >-
            Model identifier passed to the inference engine (typically the same
            as `model_id`).
        engine:
          type: string
          description: Inference engine. Use `"max"` for the MAX engine.
          example: max
        mode:
          type: string
          description: Optional deployment mode override.
      required:
        - model_path
    ReplicaStatus:
      type: object
      properties:
        current:
          type: integer
          description: Number of currently running replicas.
        desired:
          type: integer
          description: Number of desired replicas.
      required:
        - current
        - desired
    ScalingBehavior:
      type: object
      properties:
        scale_up:
          $ref: '#/components/schemas/ScalingWindowConfig'
        scale_down:
          $ref: '#/components/schemas/ScalingWindowConfig'
    ScalingWindowConfig:
      type: object
      properties:
        stabilization_window_seconds:
          type: integer
          description: Seconds to wait before acting on scale signals.
      required:
        - stabilization_window_seconds
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Modular Cloud API token. Obtain from the [API Tokens
        page](https://console.modular.com/api_tokens).

````