Skip to main content
CVM configuration methods let you modify a running or stopped CVM without recreating it.
Some configuration updates restart a running CVM. A change applied through PATCH /cvms/{cvmId} or the compose, environment and OS image endpoints stops the CVM, applies the change and starts it again. A stopped CVM stays stopped and runs the new configuration at its next start. A compose change that matches what the CVM already runs does not restart it: the API answers no_change and does nothing. UpdateCVMListed and annotations (UpdateCVMAnnotations) never restart the CVM, and SSH key changes without ApplyNow stay pending until the next power-on.
PatchCVM sends any set of changes in one request to PATCH /cvms/{cvmId}. UpdateCVMResources and UpdateCVMVisibility send a subset of fields to the same endpoint. The other UpdateXxxx methods call their own endpoints. See Update CVM Configuration for what each field does and which settings cannot change after create. 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 when the update is accepted. For an on-chain KMS CVM whose new compose hash is not registered yet, the API answers HTTP 465 and the method returns an *APIError. Call ComposePrecondition() on it to read the compose hash to register, then call again with opts.

UpdatePreLaunchScript

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

CommitCVMUpdate

POST /cvms/{cvmId}/commit-update Commit a prepared on-chain update with its token, compose hash, and transaction hash. The response contains CorrelationID and Status.

UpdateCVMResources

PATCH /cvms/{cvmId} 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: *UpdateResourcesResponse, an alias of CVMUpdateResponse (Message, CorrelationID, Status).

UpdateCVMVisibility

PATCH /cvms/{cvmId} Controls which information about a CVM is publicly accessible. All fields are optional.
UpdateVisibilityRequest fields: Returns: *CVMUpdateResponse (Message, CorrelationID, Status). Status is "no_change" with an empty CorrelationID when the settings already match. These settings are part of the compose hash. For a CVM on Onchain KMS, the API answers HTTP 465 until the new hash is registered on-chain. Use PatchCVM, which returns the hash to register.

UpdateCVMListed

PATCH /cvms/{cvmId}/listed Sets whether the app is listed on the public Trust Center. The listing applies to every CVM of the app. It only changes a record in Phala Cloud: no compose change and no restart.

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. ProvisionComposeUpdateRequest.EncryptedEnv has been removed; use UpdateCVMEnvs for environment changes instead.
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. The API answers with {message, correlation_id, status}, but UpdateOSImage discards it.

PatchCVM

PATCH /cvms/{cvmId} Applies a multi-field update to a CVM in a single request. You can change compose, resources, visibility, and more in one call. Compose is a JSON Merge Patch of the app compose. Each ComposePatch key is a Patch[T]: leave it zero to keep the value, use phala.PatchValue(v) to set it, or phala.PatchNull[T]() to remove it. See How does the compose patch work? for the keys. To change a bash runner’s script, set ComposePatch.BashScript. To change the Trust Center listing, use UpdateCVMListed.
PatchCVMRequest fields: A nil AllowedEnvs slice omits the field; an explicitly empty slice sends [] to clear it. Returns: *PatchCVMResponse. A 465 answer is not an error: RequiresOnChainHash is true and the response carries ComposeHash, AppID, DeviceID and KMSInfo, plus CommitToken, CommitURL, APICommitURL and OnchainStatus with PrepareOnly. Otherwise it carries CorrelationID and Status; Status is "no_change" with an empty CorrelationID when nothing had to change.

GetCVMInitScripts

GET /cvms/{cvmId}/init-scripts Lists the platform init scripts, in run order, and for each one whether the CVM runs it (Selected), whether you can pick it for this CVM (Selectable) and, if not, why (Reason). Change the selection with PatchCVM’s InitScripts. See Init scripts.

GetCVMAnnotations / UpdateCVMAnnotations

GET /cvms/{cvmId}/annotations / PUT /cvms/{cvmId}/annotations Reads or replaces the CVM’s annotations: key/value settings for tools on the host. They are not measured and attestation does not cover them. UpdateCVMAnnotations replaces every annotation, and an empty map clears them. It does not restart the CVM. Annotations sit behind a feature flag; without it, both calls fail with ERR-03-049. See Annotations.
Returns: *CVMAnnotationsResponse with Annotations, the annotations the node now stores.

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: The request sends an empty JSON object and supplies the hashes in the X-Compose-Hash and X-Transaction-Hash headers. The response retains the action fields and includes CorrelationID. ConfirmCVMPatchV20260121 returns the earlier ID shape. 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: