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

# Handle Get Cvm State

> Get CVM state. Supports two modes:

1. Immediate mode (no target): Returns current state immediately
2. SSE mode (with target): Streams state updates until status matches target or timeout

Example:
    GET /cvms/{cvm_id}/state - Returns current state
    GET /cvms/{cvm_id}/state?target=running - Streams until status becomes 'running'

SSE connection limit: 5 concurrent connections per user



## OpenAPI

````yaml /openapi.json get /api/v1/cvms/{cvm_id}/state
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}/state:
    get:
      tags:
        - CVMs
      summary: Handle Get Cvm State
      description: >-
        Get CVM state. Supports two modes:


        1. Immediate mode (no target): Returns current state immediately

        2. SSE mode (with target): Streams state updates until status matches
        target or timeout


        Example:
            GET /cvms/{cvm_id}/state - Returns current state
            GET /cvms/{cvm_id}/state?target=running - Streams until status becomes 'running'

        SSE connection limit: 5 concurrent connections per user
      operationId: handle_get_cvm_state_api_v1_cvms__cvm_id__state_get
      parameters:
        - name: cvm_id
          in: path
          required: true
          schema:
            type: string
            title: Cvm Id
        - name: target
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Target status to wait for. If specified, returns SSE stream.
            title: Target
          description: Target status to wait for. If specified, returns SSE stream.
        - name: interval
          in: query
          required: false
          schema:
            type: integer
            maximum: 30
            minimum: 5
            description: Polling interval in seconds (5-30)
            default: 5
            title: Interval
          description: Polling interval in seconds (5-30)
        - name: timeout
          in: query
          required: false
          schema:
            type: integer
            maximum: 600
            minimum: 10
            description: Maximum wait time in seconds (10-600)
            default: 300
            title: Timeout
          description: Maximum wait time in seconds (10-600)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    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

````