Skip to main content
CVM lifecycle methods control the creation and state transitions of your Confidential Virtual Machines. Provisioning is a two-step process (provision then commit), while other operations are single calls.

CVM Identifiers

Most lifecycle methods accept a CVM identifier. You can pass any of these fields — the SDK resolves them automatically:

provision_cvm

POST /cvms Creates a CVM provision request. This is step one of the two-step provisioning flow. Use the response’s token in commit_cvm_provision. Parameters: The request is a dictionary with the CVM configuration. The exact fields depend on your deployment, but typically include: Returns: Provision response with token, compose_hash, and app_id. Example:

commit_cvm_provision

POST /cvms Commits a provisioned CVM, creating the actual instance. Pass the token returned by provision_cvm. For the legacy flow, pass the provision response’s app_id and compose_hash instead. On-chain KMS deployments may also need a transaction hash. This endpoint is idempotent: submitting the same app_id + compose_hash again returns the existing CVM. A different compose_hash for the same app_id raises a ResourceError with error code CVM_APP_ID_CONFLICT. Parameters: Returns: Committed CVM details. Example:

start_cvm

POST /cvms/{cvmId}/start Starts a stopped CVM. Parameters: Returns: CVM action response with updated status. Example:

stop_cvm

POST /cvms/{cvmId}/stop Force-stops a CVM immediately. Parameters: Returns: CVM action response with updated status.

shutdown_cvm

POST /cvms/{cvmId}/shutdown Gracefully shuts down a CVM, allowing containers to stop cleanly. Prefer this over stop_cvm unless you need an immediate halt. Parameters: Returns: CVM action response with updated status.

restart_cvm

POST /cvms/{cvmId}/restart Restarts a CVM. Supports an optional force flag to skip graceful shutdown. Parameters: Returns: CVM action response with updated status. Example:

delete_cvm

DELETE /cvms/{cvmId} Permanently deletes a CVM and all its data. Parameters: Returns: None
This action is irreversible. All data associated with the CVM will be permanently deleted.
Example:

replicate_cvm

POST /cvms/{cvmId}/replicas Creates a copy of an existing CVM. The replica shares the same compose configuration but runs as an independent instance. Parameters: Returns: Replicated CVM details. Example:

watch_cvm_state

GET /cvms/{cvmId}/state (SSE) Watches CVM state via Server-Sent Events. Both sync and async clients support this method. Parameters: The SDK returns the complete event payload. A raw state status is not necessarily the derived status used by the server to determine completion, and a matching state alone does not complete the watch. A complete event whose status differs from target does not succeed; the SDK treats it as an interrupted attempt and reconnects within the retry budget. The server may emit an error event and continue. On a timeout event, an EOF without completion, or a transient transport error, the SDK reconnects within the retry budget. Exhausted retries raise RequestError, retaining the latest server error and transport diagnostics when available. HTTP errors use SDK error types and are not retried. The stream read timeout is timeout + interval + 5 seconds. Other HTTPX timeout settings remain in effect. Cancelling an async task closes the stream and propagates cancellation. maxRetries and retryDelay are also accepted as aliases. Example: