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

# Get resource usage for a Devbox.

> Get resource usage metrics for a specific Devbox. Returns CPU, memory, and disk consumption calculated from the Devbox's lifecycle, excluding any suspended periods for CPU and memory. Disk usage includes the full elapsed time since storage is consumed even when suspended.



## OpenAPI

````yaml /openapi-specs/stainless-processed-openapi.json get /v1/devboxes/{id}/usage
openapi: 3.1.0
info:
  title: RunLoop API
  version: '0.1'
  description: >-
    The RunLoop API spec that allows you to host lambda functions and Devboxes
    to enable scaled long running ai workflows.
  contact:
    name: Runloop AI Support
    url: https://runloop.ai
    email: support@runloop.ai
servers:
  - url: https://api.runloop.ai
    description: Runloop API
    variables: {}
security:
  - bearerAuth: []
tags:
  - name: Benchmark
  - name: Blueprint
  - name: Blueprint-Lifecycle
  - name: Blueprint-ObservabilityTools
  - name: Devbox
  - name: Devbox-FileTools
  - name: Devbox-Lifecycle
  - name: Devbox-NetworkTools
  - name: Devbox-ObservabilityTools
  - name: Devbox-PersistenceTools
  - name: Devbox-ShellTools
  - name: Scenario
  - name: ScenarioScorer
  - name: accounts
  - name: agents
  - name: apikeys
  - name: axons
  - name: executions
  - name: gateway-configs
  - name: mcp-configs
  - name: network-policies
  - name: objects
  - name: restricted_keys
  - name: secrets
  - name: streaming
paths:
  /v1/devboxes/{id}/usage:
    get:
      tags:
        - Devbox
        - Devbox-ObservabilityTools
      summary: Get resource usage for a Devbox.
      description: >-
        Get resource usage metrics for a specific Devbox. Returns CPU, memory,
        and disk consumption calculated from the Devbox's lifecycle, excluding
        any suspended periods for CPU and memory. Disk usage includes the full
        elapsed time since storage is consumed even when suspended.
      operationId: getDevboxResourceUsage
      parameters:
        - name: id
          in: path
          description: The Devbox ID.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DevboxResourceUsageView'
        '404':
          description: Devbox not found.
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Runloop from '@runloop/api-client';


            const client = new Runloop({
              bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
            });


            const devboxResourceUsageView = await
            client.devboxes.retrieveResourceUsage('id');


            console.log(devboxResourceUsageView.id);
        - lang: Python
          source: >-
            import os

            from runloop_api_client import Runloop


            client = Runloop(
                bearer_token=os.environ.get("RUNLOOP_API_KEY"),  # This is the default and can be omitted
            )

            devbox_resource_usage_view =
            client.devboxes.retrieve_resource_usage(
                "id",
            )

            print(devbox_resource_usage_view.id)
components:
  schemas:
    DevboxResourceUsageView:
      type: object
      properties:
        id:
          type: string
          description: The devbox ID.
        total_active_seconds:
          type: integer
          format: int64
          description: >-
            Total time in seconds the devbox was actively running (excludes time
            spent suspended).
        total_elapsed_seconds:
          type: integer
          format: int64
          description: >-
            Total elapsed time in seconds from devbox creation to now (or end
            time if terminated). Includes all time regardless of devbox state.
        vcpu_seconds:
          type: integer
          format: int64
          description: >-
            vCPU usage in vCPU-seconds (total_active_seconds multiplied by the
            number of vCPUs).
        memory_gb_seconds:
          type: integer
          format: int64
          description: >-
            Memory usage in GB-seconds (total_active_seconds multiplied by
            memory in GB).
        disk_gb_seconds:
          type: integer
          format: int64
          description: >-
            Disk usage in GB-seconds (total_elapsed_seconds multiplied by disk
            size in GB). Disk is billed for elapsed time since storage is
            consumed even when suspended.
        start_time_ms:
          type: integer
          format: int64
          description: The devbox creation time in milliseconds since epoch.
        end_time_ms:
          format: int64
          description: >-
            The devbox end time in milliseconds since epoch, or null if still
            running.
          type:
            - integer
            - 'null'
        status:
          type: string
          description: The current status of the devbox.
      required:
        - id
        - total_active_seconds
        - total_elapsed_seconds
        - vcpu_seconds
        - memory_gb_seconds
        - disk_gb_seconds
        - start_time_ms
        - status
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````