Skip to main content
CVM configuration methods let you modify a running or stopped CVM without recreating it.
Every configuration update triggers a CVM restart. The CVM will be stopped, updated, and restarted automatically. Plan updates accordingly to minimize downtime.
Each UpdateXxxx method targets a single aspect of the CVM (compose file, resources, visibility, etc.) and calls a dedicated API endpoint. PatchCVM is the unified method that can update multiple fields in a single request — internally it calls PATCH /cvms/{cvmId}. Use PatchCVM when you need to change several settings atomically; use the individual UpdateXxxx methods when you only need to change one thing. For CVMs using on-chain KMS, updates that affect the compose hash require an additional on-chain confirmation step.

UpdateDockerCompose

PATCH /cvms/{cvmId}/docker-compose Replaces the Docker Compose YAML for a CVM. The compose content is sent as text/yaml. For on-chain KMS CVMs, pass compose hash and transaction hash via the options parameter.
Parameters: ComposeUpdateOptions fields: Returns: *UpdateResult which may indicate that on-chain confirmation is needed.

UpdatePreLaunchScript

PATCH /cvms/{cvmId}/pre-launch-script Updates the shell script that runs before CVM containers start. Sent as text/plain.
Parameters: Returns: *UpdateResult

UpdateCVMResources

PATCH /cvms/{cvmId}/resources Updates the resource allocation (vCPUs, memory, disk) for a CVM. All fields are optional; only the fields you include will be changed.
UpdateResourcesRequest fields: Returns: error (no response body on success)
Resource changes may require a CVM restart. Set AllowRestart to true if you want the restart to happen automatically.

UpdateCVMVisibility

PATCH /cvms/{cvmId}/visibility Controls which information about a CVM is publicly accessible. All fields are optional.
UpdateVisibilityRequest fields: Returns: *CVMVisibility with the updated visibility settings.

UpdateCVMEnvs

PATCH /cvms/{cvmId}/envs Updates the encrypted environment variables for a CVM. Environment variables are encrypted client-side before being sent to the API.
UpdateEnvsRequest fields: Returns: *UpdateResult

UpdateOSImage

PATCH /cvms/{cvmId}/os-image Updates the OS image for a CVM. The CVM will need a restart to apply the new image.
UpdateOSImageRequest fields: Returns: error (no response body on success)

PatchCVM

PATCH /cvms/{cvmId} Applies a multi-field update to a CVM in a single request. This is the most flexible update method — you can change compose, resources, visibility, and more in one call.
PatchCVMRequest fields: Returns: *PatchCVMResponse — check RequiresOnChainHash to see if on-chain confirmation is needed.

ConfirmCVMPatch

PATCH /cvms/{cvmId} Confirms a CVM patch that requires on-chain verification. Call this after PatchCVM returns RequiresOnChainHash: true and you have submitted the transaction on-chain.
ConfirmCVMPatchRequest fields: Returns: *CVMActionResponse

Compose File Operations

These methods let you provision and commit compose file updates using the two-phase flow, similar to initial CVM provisioning.

ProvisionCVMComposeFileUpdate

POST /cvms/{cvmId}/compose_file/provision Provisions a compose file update without applying it yet. Returns a compose hash for the commit step.

CommitCVMComposeFileUpdate

PATCH /cvms/{cvmId}/compose_file Commits a previously provisioned compose file update.
Example — two-phase compose update: