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

# Get virtual machine

> Returns virtual machine details for the tenant selected by the X-CostGraph-Tenant-ID header



## OpenAPI

````yaml /api-reference/costgraph/openapi.json get /api/v1/tenant/virtual-machines/{id}
openapi: 3.0.0
info:
  description: Read and manage your CostGraph organization, spend, alerts, and settings.
  title: CostGraph API
  contact: {}
  version: '1.0'
servers:
  - url: https://api.costgraph.ai
security: []
tags:
  - name: ai
    x-group: AI
  - name: ai-serving
    x-group: AI serving
  - name: anomalies
    x-group: Anomalies
  - name: auth
    x-group: Auth
  - name: billing
    x-group: Billing
  - name: billing-export
    x-group: Billing export
  - name: budgets
    x-group: Budgets
  - name: ci
    x-group: CI
  - name: compute-recommendations
    x-group: Compute recommendations
  - name: config
    x-group: Config
  - name: cost
    x-group: Cost
  - name: gpus
    x-group: GPUs
  - name: graphai
    x-group: Graph AI
  - name: infracost
    x-group: Infracost
  - name: integrations
    x-group: Integrations
  - name: invitations
    x-group: Invitations
  - name: kubernetes-clusters
    x-group: Kubernetes clusters
  - name: marketplace
    x-group: Marketplace
  - name: network-requests
    x-group: Network requests
  - name: notifications
    x-group: Notifications
  - name: oauth
    x-group: OAuth
  - name: oauth-clients
    x-group: OAuth clients
  - name: opencost
    x-group: OpenCost
  - name: organization
    x-group: Audit log
  - name: organizations
    x-group: Organizations
  - name: placement-alternatives
    x-group: Placement alternatives
  - name: reports
    x-group: Reports
  - name: service-map
    x-group: Service map
  - name: settings
    x-group: Settings
  - name: sso
    x-group: Single sign-on
  - name: tenants
    x-group: Tenants
  - name: user
    x-group: Users
  - name: virtual-machines
    x-group: Virtual machines
  - name: virtual-tags
    x-group: Virtual tags
  - name: workflows
    x-group: Workflows
paths:
  /api/v1/tenant/virtual-machines/{id}:
    get:
      tags:
        - virtual-machines
      summary: Get virtual machine
      description: >-
        Returns virtual machine details for the tenant selected by the
        X-CostGraph-Tenant-ID header
      parameters:
        - description: Tenant ID
          name: X-CostGraph-Tenant-ID
          in: header
          required: true
          schema:
            type: string
        - description: Virtual machine ID
          name: id
          in: path
          required: true
          schema:
            type: string
        - description: >-
            Cost period: month_to_date, last_7d, last_30d, calendar_month, or
            custom
          name: period
          in: query
          schema:
            type: string
        - description: >-
            Closed calendar month in YYYY-MM format; required when
            period=calendar_month
          name: month
          in: query
          schema:
            type: string
        - description: >-
            Custom period start timestamp in RFC3339 format; required when
            period=custom
          name: start
          in: query
          schema:
            type: string
        - description: >-
            Custom period end timestamp in RFC3339 format; required when
            period=custom
          name: end
          in: query
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/responses.SuccessResponse'
                  - type: object
                    properties:
                      data:
                        $ref: >-
                          #/components/schemas/costgraph_agent.VirtualMachineDetail
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    responses.SuccessResponse:
      type: object
      required:
        - message
        - status
      properties:
        data: {}
        message:
          type: string
          example: some message
        status:
          type: string
          example: success
    costgraph_agent.VirtualMachineDetail:
      type: object
      required:
        - active
        - agent_installed_at
        - availability_zone
        - capacity
        - cost_summary
        - created_at
        - disks
        - id
        - instance_id
        - last_heartbeat_at
        - machine_info
        - name
        - provider
        - region
        - service
        - system_details
      properties:
        active:
          type: boolean
        agent_installed_at:
          type: string
        assigned_price:
          $ref: '#/components/schemas/costgraph_agent.ComputePrice'
        availability_zone:
          type: string
        capacity:
          $ref: '#/components/schemas/costgraph_agent.VirtualMachineCapacity'
        cost_summary:
          $ref: '#/components/schemas/costgraph_agent.VirtualMachineCostSummary'
        created_at:
          type: string
        disk_cost_per_month:
          type: number
          x-semantic: costAmount
          nullable: true
        disks:
          type: array
          items:
            $ref: '#/components/schemas/costgraph_agent.VirtualMachineDisk'
        id:
          type: string
          x-semantic: resourceId
        instance_id:
          type: string
          x-semantic: resourceId
        last_heartbeat_at:
          type: string
        machine_info:
          $ref: '#/components/schemas/costgraph_agent.VirtualMachineMachineInfo'
        name:
          type: string
        provider:
          type: string
        region:
          type: string
        service:
          type: string
        system_details:
          $ref: '#/components/schemas/costgraph_agent.VirtualMachineSystemDetails'
    responses.ErrorResponse:
      type: object
      required:
        - message
        - status
      properties:
        message:
          type: string
          example: some message
        status:
          type: string
          example: error
    costgraph_agent.ComputePrice:
      type: object
      required:
        - assigned_resources
        - cost_per_hour
        - cpu_cores
        - currency
        - id
        - instance_type
        - ram_gb
        - region
        - usage_type
      properties:
        assigned_resources:
          type: integer
        cost_per_hour:
          type: number
        cpu_cores:
          type: number
        currency:
          type: string
        gpu_count:
          type: number
        gpu_type:
          type: string
        id:
          type: string
          x-semantic: resourceId
        instance_type:
          type: string
        ram_gb:
          type: number
        region:
          type: string
        usage_type:
          type: string
    costgraph_agent.VirtualMachineCapacity:
      type: object
      required:
        - cpu_cores
        - ram_gb
        - volumes_attached
      properties:
        cpu_cores:
          type: number
        ram_gb:
          type: number
        volumes_attached:
          type: integer
    costgraph_agent.VirtualMachineCostSummary:
      type: object
      required:
        - cost_data_available
        - currency
        - current_period_cost
        - period
        - period_end
        - period_start
        - previous_period_end
        - previous_period_start
      properties:
        change_amount:
          type: number
          x-semantic: costAmount
          nullable: true
        change_percent:
          type: number
          x-semantic: percentage
          nullable: true
        cost_data_available:
          type: boolean
        cpu_cost:
          type: number
          x-semantic: costAmount
          nullable: true
        currency:
          type: string
          x-semantic: currencyCode
        current_period_cost:
          type: number
          x-semantic: costAmount
        gpu_cost:
          type: number
          x-semantic: costAmount
          nullable: true
        memory_cost:
          type: number
          x-semantic: costAmount
          nullable: true
        period:
          type: string
        period_end:
          type: string
        period_start:
          type: string
        potential_savings_monthly_usd:
          type: number
          x-semantic: costAmount
          nullable: true
        previous_period_cost:
          type: number
          x-semantic: costAmount
          nullable: true
        previous_period_end:
          type: string
        previous_period_start:
          type: string
        projected_monthly_spend:
          type: number
          x-semantic: costAmount
          nullable: true
        storage_cost:
          type: number
          x-semantic: costAmount
          nullable: true
    costgraph_agent.VirtualMachineDisk:
      type: object
      required:
        - boot
        - capacity_gb
        - id
        - iops
        - name
        - pinned
        - throughput_mbps
        - type
      properties:
        boot:
          type: boolean
        capacity_gb:
          type: number
        cheaper_type:
          type: string
          nullable: true
        cheaper_type_cost_per_month:
          type: number
          x-semantic: costAmount
          nullable: true
        cheaper_type_iops:
          type: number
          nullable: true
        cheaper_type_throughput_mbps:
          type: number
          nullable: true
        cost_per_month:
          type: number
          x-semantic: costAmount
          nullable: true
        id:
          type: string
          x-semantic: resourceId
        iops:
          type: number
        name:
          type: string
        pinned:
          type: boolean
        pinned_by:
          type: string
          enum:
            - api
            - label
          nullable: true
        pricing_id:
          type: string
          nullable: true
        savings_per_month:
          type: number
          x-semantic: costAmount
          nullable: true
        throughput_mbps:
          type: number
        type:
          type: string
    costgraph_agent.VirtualMachineMachineInfo:
      type: object
      required:
        - architecture
        - hostname
        - instance_type
        - usage_type
      properties:
        architecture:
          type: string
        cost_per_hour:
          type: number
        hostname:
          type: string
        instance_type:
          type: string
        storage_cost_per_hour:
          type: number
        usage_type:
          type: string
    costgraph_agent.VirtualMachineSystemDetails:
      type: object
      required:
        - agent_version
        - container_runtimes
        - ip_addresses
        - kernel_version
        - operating_system
        - workload_running_containers
        - workload_total_containers
      properties:
        agent_version:
          type: string
        container_runtimes:
          type: array
          items:
            $ref: '#/components/schemas/costgraph_agent.ContainerRuntime'
        ip_addresses:
          type: array
          items:
            type: string
        kernel_version:
          type: string
        operating_system:
          type: string
        workload_running_containers:
          type: integer
        workload_total_containers:
          type: integer
    costgraph_agent.ContainerRuntime:
      type: string
      enum:
        - unknown
        - containerd
        - docker
      x-enum-varnames:
        - ContainerRuntimeUnknown
        - ContainerRuntimeContainerd
        - ContainerRuntimeDocker
  securitySchemes:
    BearerAuth:
      description: Enter "Bearer {token}"
      type: apiKey
      name: Authorization
      in: header

````

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