> ## 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 compute recommendation

> Returns the latest compute recommendation for a resource owned by the tenant selected by the X-CostGraph-Tenant-ID header



## OpenAPI

````yaml /api-reference/costgraph/openapi.json get /api/v1/tenant/compute/recommendations/{resource_type}/{resource_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/compute/recommendations/{resource_type}/{resource_id}:
    get:
      tags:
        - compute-recommendations
      summary: Get compute recommendation
      description: >-
        Returns the latest compute recommendation for a resource owned by 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: Resource type, currently virtual_machine
          name: resource_type
          in: path
          required: true
          schema:
            type: string
        - description: Resource ID
          name: resource_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/responses.SuccessResponse'
                  - type: object
                    properties:
                      data:
                        $ref: >-
                          #/components/schemas/recommendations.ComputeRecommendationDetail
        '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
    recommendations.ComputeRecommendationDetail:
      type: object
      required:
        - capabilities
        - cross_cloud_alternatives
        - diagnostics
        - lifecycle
        - recommendation
        - resource
        - resource_id
        - resource_type
        - state
      properties:
        action:
          type: string
          enum:
            - UPSIZE
            - DOWNSIZE
            - TERMINATE
            - NOOP
            - NO_RECOMMENDATION
        algorithm_version:
          type: string
        apply_plan:
          $ref: '#/components/schemas/recommendations.ComputeRecommendationApplyPlan'
        capabilities:
          $ref: >-
            #/components/schemas/recommendations.ComputeRecommendationCapabilities
        confidence:
          type: string
          enum:
            - low
            - medium
            - high
        coverage:
          type: number
          nullable: true
        coverage_threshold:
          type: number
          nullable: true
        cross_cloud_alternatives:
          type: array
          items:
            $ref: >-
              #/components/schemas/github_com_baselinehq_backend_types_recommendations.CrossCloudOpportunity
        cross_cloud_opportunity:
          $ref: >-
            #/components/schemas/github_com_baselinehq_backend_types_recommendations.CrossCloudOpportunity
        current_monthly_cost:
          type: number
          x-semantic: costAmount
          nullable: true
        diagnostics:
          $ref: >-
            #/components/schemas/recommendations.ComputeRecommendationDiagnostics
        generated_at:
          type: string
          nullable: true
        lifecycle:
          $ref: '#/components/schemas/recommendations.ComputeRecommendationLifecycle'
        reason:
          type: string
        recommendation:
          type: object
          additionalProperties: {}
        recommended_instance_type:
          type: string
        recommended_monthly_cost:
          type: number
          x-semantic: costAmount
          nullable: true
        recommended_ram_gb:
          type: number
          nullable: true
        recommended_vcpu:
          type: number
          nullable: true
        resource:
          $ref: '#/components/schemas/recommendations.ComputeRecommendationResource'
        resource_id:
          type: string
          x-semantic: resourceId
        resource_type:
          type: string
        savings_annual_usd:
          type: number
          x-semantic: costAmount
          nullable: true
        savings_monthly_usd:
          type: number
          x-semantic: costAmount
          nullable: true
        state:
          type: string
          enum:
            - pending_first_run
            - insufficient_signal
            - right_sized
            - actionable
            - unavailable
    responses.ErrorResponse:
      type: object
      required:
        - message
        - status
      properties:
        message:
          type: string
          example: some message
        status:
          type: string
          example: error
    recommendations.ComputeRecommendationApplyPlan:
      type: object
      required:
        - current_instance_type
        - modes
        - provider
        - provider_resource_id
        - region
        - requires_stop
        - resource_name
        - target_instance_type
      properties:
        availability_zone:
          type: string
        current_instance_type:
          type: string
        modes:
          type: array
          items:
            $ref: >-
              #/components/schemas/recommendations.ComputeRecommendationApplyMode
        operating_system:
          type: string
        provider:
          type: string
        provider_resource_id:
          type: string
          x-semantic: resourceId
        region:
          type: string
        requires_stop:
          type: boolean
        resource_name:
          type: string
        target_instance_type:
          type: string
    recommendations.ComputeRecommendationCapabilities:
      type: object
      required:
        - check_agent_status
      properties:
        check_agent_status:
          type: boolean
    github_com_baselinehq_backend_types_recommendations.CrossCloudOpportunity:
      type: object
      required:
        - instance_type
        - monthly_cost_usd
        - provider
        - ram_gb
        - reason
        - region
        - risk
        - savings_monthly_usd
        - savings_percent
        - vcpu
      properties:
        distance_km:
          type: number
        instance_type:
          type: string
        latency_p95_ms:
          type: number
        monthly_cost_usd:
          type: number
        provider:
          type: string
        ram_gb:
          type: number
        reason:
          type: string
        region:
          type: string
        risk:
          type: string
        savings_monthly_usd:
          type: number
        savings_percent:
          type: number
        vcpu:
          type: number
    recommendations.ComputeRecommendationDiagnostics:
      type: object
      properties:
        coverage_by_signal:
          type: object
          additionalProperties:
            type: number
            format: float64
        missing_metrics:
          type: array
          items:
            type: string
        projected_threshold_at:
          type: string
          nullable: true
        reason_codes:
          type: array
          items:
            type: string
        summary_metrics:
          $ref: >-
            #/components/schemas/recommendations.ComputeRecommendationSummaryMetrics
    recommendations.ComputeRecommendationLifecycle:
      type: object
      required:
        - agent_last_seen_at
        - agent_reporting
        - metric_warmup_status
        - registered_at
      properties:
        agent_last_seen_at:
          type: string
        agent_reporting:
          type: boolean
        metric_warmup_complete_at:
          type: string
          nullable: true
        metric_warmup_status:
          enum:
            - ready
            - agent_not_reporting
            - pending_first_run
            - insufficient_coverage
            - missing_metrics
            - unreliable_metrics
          allOf:
            - $ref: '#/components/schemas/recommendations.MetricWarmupStatus'
        next_cycle_at:
          type: string
          nullable: true
        registered_at:
          type: string
    recommendations.ComputeRecommendationResource:
      type: object
      required:
        - active
        - architecture
        - availability_zone
        - instance_type
        - name
        - operating_system
        - provider
        - ram_gb
        - region
        - usage_type
        - vcpu
      properties:
        active:
          type: boolean
        architecture:
          type: string
        availability_zone:
          type: string
        instance_type:
          type: string
        name:
          type: string
        operating_system:
          type: string
        provider:
          type: string
        ram_gb:
          type: number
        region:
          type: string
        usage_type:
          type: string
        vcpu:
          type: number
    recommendations.ComputeRecommendationApplyMode:
      type: object
      required:
        - kind
        - label
      properties:
        kind:
          type: string
          enum:
            - console
            - cli
            - terraform_template
            - agent
        label:
          type: string
    recommendations.ComputeRecommendationSummaryMetrics:
      type: object
      required:
        - cpu_util_p95
        - cpu_util_p99
        - disk_utilization_p95
        - mem_used_p99_bytes
        - mem_used_p99_gb
        - network_bytes_per_second_p95
        - oom_kills_increase
      properties:
        cpu_util_p95:
          type: number
        cpu_util_p99:
          type: number
        disk_utilization_p95:
          type: number
        mem_used_p99_bytes:
          type: number
        mem_used_p99_gb:
          type: number
        network_bytes_per_second_p95:
          type: number
        observation_window_seconds:
          type: integer
        oom_kills_increase:
          type: number
    recommendations.MetricWarmupStatus:
      type: string
      enum:
        - ready
        - agent_not_reporting
        - pending_first_run
        - insufficient_coverage
        - missing_metrics
        - unreliable_metrics
      x-enum-varnames:
        - MetricWarmupStatusReady
        - MetricWarmupStatusAgentNotReporting
        - MetricWarmupStatusPendingFirstRun
        - MetricWarmupStatusInsufficientCoverage
        - MetricWarmupStatusMissingMetrics
        - MetricWarmupStatusUnreliableMetrics
  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.