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

# Replicate CVM

> Create a replica of the CVM on a target node. If request body is omitted, it replicates to the source node and reuses existing env.



## OpenAPI

````yaml /openapi.json post /api/v1/cvms/{cvm_id}/replicas
openapi: 3.1.0
info:
  title: Phala Cloud API
  version: 0.1.0
servers:
  - url: https://cloud-api.phala.com
security: []
tags:
  - name: CVMs
    description: Confidential Virtual Machine (CVM) lifecycle management on Phala Network
  - name: Apps
    description: App template management and CVM deployment from app blueprints
  - name: Webhooks
    description: Manage webhook endpoints and monitor delivery history
  - name: SSH Keys
    description: SSH public key management for CVM access
  - name: KMS
    description: >-
      Key Management Service — key derivation, on-chain anchoring, and
      inspection
  - name: Instance Types
    description: Available hardware configurations for CVM deployment
  - name: Attestations
    description: Remote attestation and TEE verification endpoints
paths:
  /api/v1/cvms/{cvm_id}/replicas:
    post:
      tags:
        - CVMs
      summary: Replicate CVM
      description: >-
        Create a replica of the CVM on a target node. If request body is
        omitted, it replicates to the source node and reuses existing env.
      operationId: handle_replicate_cvm_api_v1_cvms__cvm_id__replicas_post
      parameters:
        - name: cvm_id
          in: path
          required: true
          schema:
            type: string
            title: Cvm Id
        - name: X-Prepare-Only
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Prepare-Only
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/ReplicateRequest'
                - type: 'null'
              title: Request
      responses:
        '200':
          description: Replica CVM created
          content:
            application/json:
              schema: {}
        '400':
          description: Invalid target node, image mismatch, or invalid encrypted_env
        '401':
          description: Not authenticated
        '403':
          description: CVM not in workspace
        '404':
          description: CVM or target node not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '465':
          description: KMS allowlist rejection (contract-owned KMS)
        '500':
          description: Replication failed
components:
  schemas:
    ReplicateRequest:
      properties:
        teepod_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Teepod Id
          description: Target node ID (deprecated, use node_id)
        node_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Node Id
          description: Target node ID for the replica
        encrypted_env:
          anyOf:
            - type: string
            - type: 'null'
          title: Encrypted Env
          description: New encrypted env blob (hex)
        compose_hash:
          anyOf:
            - type: string
            - type: 'null'
          title: Compose Hash
          description: >-
            Explicit compose hash to replicate. Required when the source app has
            multiple live instances.
      type: object
      title: ReplicateRequest
      description: Request model for CVM replication.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````