> ## 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.

# Replace CVM annotations

> Replaces every annotation of this CVM; an empty object clears them. The VMM applies the change at once, without a restart and without a compose change. Host tools that read annotations only when QEMU launches (for example memory tiers or vCPU pinning) see the new values after the CVM restarts. Other CVM updates never change annotations. Annotations are opaque key/value metadata for host-side tooling, such as a QEMU wrapper that reads the VM manifest. The dstack VMM stores them with the VM. They are not passed to the guest, not measured, and not part of the compose hash, so attestation does not cover them: tenants must not rely on them for security. Phala Cloud keeps no copy of annotations as CVM state: only the node's VMM holds them, and Cloud never copies or restores them. A replica starts without annotations; a relocated CVM keeps whatever its VMM manifest carries. A create request that carries annotations is recorded in the audit log. Requires the `cvm_annotations` feature flag (ERR-03-049) and dstack VMM 0.6.1 or newer on the node (ERR-03-050).



## OpenAPI

````yaml /openapi.json put /api/v1/cvms/{cvm_id}/annotations
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
    x-mint:
      href: https://cloud.phala.network/api-reference/cvms
  - name: Apps
    description: App template management and CVM deployment from app blueprints
    x-mint:
      href: https://cloud.phala.network/api-reference/apps
  - name: Webhooks
    description: Manage webhook endpoints and monitor delivery history
    x-mint:
      href: https://cloud.phala.network/api-reference/webhooks
  - name: SSH Keys
    description: SSH public key management for CVM access
    x-mint:
      href: https://cloud.phala.network/api-reference/ssh-keys
  - name: KMS
    description: >-
      Key Management Service — key derivation, on-chain anchoring, and
      inspection
    x-mint:
      href: https://cloud.phala.network/api-reference/kms
  - name: Instance Types
    description: Available hardware configurations for CVM deployment
    x-mint:
      href: https://cloud.phala.network/api-reference/instance-types
  - name: Attestations
    description: Remote attestation and TEE verification endpoints
    x-mint:
      href: https://cloud.phala.network/api-reference/attestations
paths:
  /api/v1/cvms/{cvm_id}/annotations:
    put:
      tags:
        - CVMs
        - cvms-annotations
      summary: Replace CVM annotations
      description: >-
        Replaces every annotation of this CVM; an empty object clears them. The
        VMM applies the change at once, without a restart and without a compose
        change. Host tools that read annotations only when QEMU launches (for
        example memory tiers or vCPU pinning) see the new values after the CVM
        restarts. Other CVM updates never change annotations. Annotations are
        opaque key/value metadata for host-side tooling, such as a QEMU wrapper
        that reads the VM manifest. The dstack VMM stores them with the VM. They
        are not passed to the guest, not measured, and not part of the compose
        hash, so attestation does not cover them: tenants must not rely on them
        for security. Phala Cloud keeps no copy of annotations as CVM state:
        only the node's VMM holds them, and Cloud never copies or restores them.
        A replica starts without annotations; a relocated CVM keeps whatever its
        VMM manifest carries. A create request that carries annotations is
        recorded in the audit log. Requires the `cvm_annotations` feature flag
        (ERR-03-049) and dstack VMM 0.6.1 or newer on the node (ERR-03-050).
      operationId: handle_replace_annotations_api_v1_cvms__cvm_id__annotations_put
      parameters:
        - name: cvm_id
          in: path
          required: true
          schema:
            type: string
            title: Cvm Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCvmAnnotationsRequest'
      responses:
        '200':
          description: The annotations now stored
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CvmAnnotationsResponse'
        '403':
          description: 'ERR-03-049: the cvm_annotations feature flag is off'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
        '404':
          description: CVM not found
        '409':
          description: 'ERR-03-050: the node''s dstack VMM is older than 0.6.1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
        '422':
          description: An empty key or a non-string value
        '502':
          description: 'ERR-03-051: the node''s VMM failed to read or write the annotations'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
        '503':
          description: The node is offline or in maintenance
components:
  schemas:
    UpdateCvmAnnotationsRequest:
      properties:
        annotations:
          additionalProperties:
            type: string
          type: object
          title: Annotations
          description: >-
            Opaque key/value metadata for host-side tooling. The dstack VMM
            stores it with the VM; it is not passed to the guest, not measured,
            and not part of the compose hash, so it is host configuration that
            attestation does not cover. Do not rely on it for security. Replaces
            every annotation; an empty object clears them. Keys must not be
            empty.
          examples:
            - memory_tier: fast
      type: object
      required:
        - annotations
      title: UpdateCvmAnnotationsRequest
      description: Full replacement of a CVM's annotations.
    CvmAnnotationsResponse:
      properties:
        annotations:
          additionalProperties:
            type: string
          type: object
          title: Annotations
          description: >-
            Opaque key/value metadata for host-side tooling. The dstack VMM
            stores it with the VM; it is not passed to the guest, not measured,
            and not part of the compose hash, so it is host configuration that
            attestation does not cover. Do not rely on it for security.
      type: object
      required:
        - annotations
      title: CvmAnnotationsResponse
      description: The annotations the node's VMM currently stores for one CVM.
    StructuredErrorResponse:
      properties:
        error_code:
          type: string
          title: Error Code
        message:
          type: string
          title: Message
        details:
          anyOf:
            - items:
                $ref: '#/components/schemas/ErrorDetail'
              type: array
            - type: 'null'
          title: Details
        suggestions:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Suggestions
        links:
          anyOf:
            - items:
                $ref: '#/components/schemas/ErrorLink'
              type: array
            - type: 'null'
          title: Links
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Request Id
      type: object
      required:
        - error_code
        - message
      title: StructuredErrorResponse
      description: OpenAPI shape for the global structured-error HTTP envelope.
    ErrorDetail:
      properties:
        field:
          anyOf:
            - type: string
            - type: 'null'
          title: Field
        value:
          anyOf:
            - {}
            - type: 'null'
          title: Value
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
      type: object
      title: ErrorDetail
      description: Detailed information about a specific aspect of the error.
    ErrorLink:
      properties:
        url:
          type: string
          title: Url
        label:
          type: string
          title: Label
      type: object
      required:
        - url
        - label
      title: ErrorLink
      description: A helpful link related to the error.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.