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

# List CVM operations

> Returns operation records grouped by correlation_id. Only includes events with correlation_id (new format since 2024-01). Error messages are sanitized for non-admin users.



## OpenAPI

````yaml /openapi.json get /api/v1/cvms/{cvm_id}/operations
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}/operations:
    get:
      tags:
        - CVMs
      summary: List CVM operations
      description: >-
        Returns operation records grouped by correlation_id. Only includes
        events with correlation_id (new format since 2024-01). Error messages
        are sanitized for non-admin users.
      operationId: get_cvm_operations_api_v1_cvms__cvm_id__operations_get
      parameters:
        - name: cvm_id
          in: path
          required: true
          schema:
            type: string
            title: Cvm Id
        - name: cursor
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Opaque cursor from previous response
            title: Cursor
          description: Opaque cursor from previous response
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 500
            minimum: 1
            description: Page size
            default: 50
            title: Limit
          description: Page size
        - name: start_time
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: Include operations started after this UTC time
            title: Start Time
          description: Include operations started after this UTC time
        - name: end_time
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: Include operations started before this UTC time
            title: End Time
          description: Include operations started before this UTC time
        - name: operation_types
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            description: Filter by operation types (e.g. compose_update, power_on)
            title: Operation Types
          description: Filter by operation types (e.g. compose_update, power_on)
      responses:
        '200':
          description: Paginated operation records
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedCvmOperationsResponse'
        '401':
          description: Authentication required
        '403':
          description: CVM not in workspace
        '404':
          description: CVM not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    PaginatedCvmOperationsResponse:
      properties:
        items:
          items:
            $ref: '#/components/schemas/CvmOperationResponse'
          type: array
          title: Items
          description: Operations ordered by started_at DESC
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Cursor
          description: Opaque cursor for next page, null if last page
        total:
          type: integer
          title: Total
          description: Approximate total count (not exact for performance)
      type: object
      required:
        - items
        - total
      title: PaginatedCvmOperationsResponse
      description: Cursor-paginated list of CVM operations.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CvmOperationResponse:
      properties:
        correlation_id:
          type: string
          title: Correlation Id
          description: Unique ID linking all events in this operation
        operation_type:
          type: string
          title: Operation Type
          description: 'Type: compose_update, power_on, resize, etc.'
        target_state:
          type: string
          title: Target State
          description: Expected CVM state after completion
        triggered_by:
          type: integer
          title: Triggered By
          description: User ID who initiated the operation
        triggered_by_username:
          anyOf:
            - type: string
            - type: 'null'
          title: Triggered By Username
          description: Username if available
        triggered_by_email:
          anyOf:
            - type: string
            - type: 'null'
          title: Triggered By Email
          description: Email if available
        started_at:
          type: string
          format: date-time
          title: Started At
          description: UTC timestamp of first event
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
          description: UTC timestamp of last event
        duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ms
          description: Total duration from start to completion
        status:
          type: string
          title: Status
          description: 'Current status: completed, in_progress, or failed'
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
          description: Failure reason (sanitized for non-admins)
        sub_operations:
          items:
            type: string
          type: array
          title: Sub Operations
          description: Ordered list of sub-operation types
        events:
          items:
            $ref: '#/components/schemas/OperationEventDetail'
          type: array
          title: Events
          description: Chronological event timeline
        instance_name:
          type: string
          title: Instance Name
          description: CVM name at operation time
        compose_hash:
          anyOf:
            - type: string
            - type: 'null'
          title: Compose Hash
          description: Hash identifying compose configuration
      type: object
      required:
        - correlation_id
        - operation_type
        - target_state
        - triggered_by
        - started_at
        - status
        - sub_operations
        - events
        - instance_name
      title: CvmOperationResponse
      description: Aggregated operation record grouped by correlation_id.
    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
    OperationEventDetail:
      properties:
        event_type:
          type: string
          title: Event Type
          description: Event type identifier (e.g. instance.power_on.start)
        timestamp:
          type: string
          format: date-time
          title: Timestamp
          description: UTC timestamp when event occurred
        state:
          type: string
          title: State
          description: CVM state at event time (e.g. running, stopped)
      type: object
      required:
        - event_type
        - timestamp
        - state
      title: OperationEventDetail
      description: Single atomic event within an operation.

````