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

# Get container metrics

> Returns CPU, GPU and memory utilization over a time window.



## OpenAPI

````yaml https://api.tinfoil.sh/openapi.yaml get /api/containers/{id}/metrics
openapi: 3.2.0
info:
  title: Tinfoil Controlplane API
  version: 0.1.0
  description: >-
    Manage inference API keys, read usage and invoices, and manage Tinfoil
    confidential containers, their configuration, and the organization resources
    they use. Authenticate with an admin API key sent as a bearer token.
servers:
  - url: https://api.tinfoil.sh
security:
  - apiKey: []
tags:
  - name: Account
    description: >-
      The identity and organization behind the API key, and the token usage and
      invoices of the personal account or organization.
  - name: API keys
    parent: Account
    description: Inference API keys of the personal account or organization.
  - name: Containers
    description: Create, deploy, and stop confidential containers.
  - name: Container updates
    description: >-
      Move a container to a new release, and promote or cancel an update that is
      held for review.
  - name: Projects
    description: Groups of containers deployed from the same config source.
  - name: Volumes
    description: Encrypted persistent volumes that attach to containers.
  - name: Secrets
    description: >-
      Organization secrets available to containers, and secrets scoped to a
      single GitHub repository.
  - name: Access
    description: >-
      SSH public keys for attested SSH access to containers, custom domains that
      route to containers, and credentials for pulling images from private
      registries. An organization can store one ecr and one custom registry
      connection, each identified by its hostname.
  - name: GitHub & models
    description: >-
      Repository config and image builds through the Tinfoil GitHub app, and
      packaging Hugging Face models for use in containers. Packaging models
      requires a GPU entitlement or model access for the organization.
  - name: Config registry
    description: >-
      Publish tinfoil-config.yml revisions, read published configs, and resolve
      the endorsements that let clients verify them.
  - name: Bunkers
    description: Bunker owner keys and owner attestation.
paths:
  /api/containers/{id}/metrics:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - Containers
      summary: Get container metrics
      description: Returns CPU, GPU and memory utilization over a time window.
      operationId: getContainerMetrics
      parameters:
        - name: time
          in: query
          required: false
          description: Time window to report.
          schema:
            type: string
            enum:
              - 5m
              - 15m
              - 30m
              - 1h
              - 24h
              - today
              - 7d
              - 30d
              - 60d
              - 90d
              - 180d
              - 365d
              - 3mo
              - 6mo
              - 12mo
              - all
            default: 24h
      responses:
        '200':
          description: Metrics series
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContainerMetrics'
        '400':
          $ref: '#/components/responses/Error'
          description: Invalid request
        '401':
          $ref: '#/components/responses/Error'
          description: Missing or invalid credentials
        '403':
          $ref: '#/components/responses/Error'
          description: Not permitted
        '404':
          $ref: '#/components/responses/Error'
          description: Not found
        '500':
          $ref: '#/components/responses/Error'
          description: Server error
      security:
        - apiKey:
            - containers.metrics.read
components:
  schemas:
    ContainerMetrics:
      type: object
      required:
        - data_points
        - interval
      properties:
        data_points:
          type: array
          items:
            $ref: '#/components/schemas/ContainerMetricsDataPoint'
        interval:
          type: string
          description: Bucket width as a Go duration string, for example 15m0s.
    ContainerMetricsDataPoint:
      type: object
      description: >-
        Utilization fields are integer percentages averaged or maximized over
        the bucket; cpu_mem_total and gpu_mem_total report CPU and GPU memory
        capacity.
      required:
        - time
        - avg_cpu_util
        - max_cpu_util
        - avg_gpu_util
        - max_gpu_util
        - avg_cpu_mem_util
        - max_cpu_mem_util
        - avg_gpu_mem_util
        - max_gpu_mem_util
        - cpu_mem_total
        - gpu_mem_total
      properties:
        time:
          type: string
          format: date-time
          description: Bucket start.
        avg_cpu_util:
          type: integer
        max_cpu_util:
          type: integer
        avg_gpu_util:
          type: integer
        max_gpu_util:
          type: integer
        avg_cpu_mem_util:
          type: integer
        max_cpu_mem_util:
          type: integer
        avg_gpu_mem_util:
          type: integer
        max_gpu_mem_util:
          type: integer
        cpu_mem_total:
          type: integer
        gpu_mem_total:
          type: integer
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
        code:
          type: string
          description: Stable machine-readable error code.
      additionalProperties: true
  responses:
    Error:
      description: The request failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        An admin API key. Personal admin keys reach the API key, billing and
        Account endpoints for the creator's personal account; the other
        endpoints need an organization admin key. Security requirement entries
        list the permission a scoped key needs for the operation.

````

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