---
updatedAt: 2026-10-28T15:16:17.000Z
agentTools:
  projectIndex: https://docs.cast.ai/llms.txt
---

# GetAggregatedWorkloadCustomMetrics returns aggregated custom metrics time-series data.
Pods are aggregated across the workload, grouped by metric name and container.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "servers": [
    {
      "url": "https://api.cast.ai/",
      "description": "US endpoint"
    },
    {
      "url": "https://api.eu.cast.ai/",
      "description": "EU endpoint"
    },
    {
      "url": "https://api.india.cast.ai/",
      "description": "India endpoint"
    }
  ],
  "info": {
    "title": "CAST.AI API documentation",
    "version": "1.0.0",
    "description": "### Feature maturity indicators (may appear on resources, operations and request/response fields)\n - **(BETA)** - new or experimental features, subject to change\n - **(Deprecated)** - outdated or replaced features (a reason and removal date will be provided in the description)\n"
  },
  "tags": [
    {
      "name": "WorkloadOptimizationAPI"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    },
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/v1beta/workload-autoscaling/clusters/{clusterId}/workloads/{workloadId}/custom-metrics:aggregate": {
      "get": {
        "operationId": "WorkloadOptimizationAPI_GetAggregatedWorkloadCustomMetricsV1Beta",
        "parameters": [
          {
            "in": "path",
            "name": "clusterId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "workloadId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "containerName",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "fromTime",
            "required": true,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "toTime",
            "required": true,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Sampling interval for metrics. The server may enforce a step even when one is not provided, or change it\nif it's too short. The actual step used is returned in the response.",
            "in": "query",
            "name": "step",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Sliding window duration for aggregation (e.g. 30 minutes).",
            "in": "query",
            "name": "aggregationSlidingWindow",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "aggregation.type",
            "required": true,
            "schema": {
              "default": "CUSTOM_METRIC_AGGREGATION_TYPE_UNSPECIFIED",
              "enum": [
                "CUSTOM_METRIC_AGGREGATION_TYPE_UNSPECIFIED",
                "AVERAGE",
                "MAX",
                "MIN",
                "PERCENTILE"
              ],
              "type": "string"
            }
          },
          {
            "description": "Only used when type is PERCENTILE (e.g. 95 for p95).",
            "in": "query",
            "name": "aggregation.percentile",
            "schema": {
              "format": "double",
              "type": "number"
            }
          },
          {
            "description": "When true, missing data points in the time range are backfilled with null values at each step interval.",
            "in": "query",
            "name": "backfillDataPoints",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/workloadoptimization.v1.GetAggregatedWorkloadCustomMetricsV1BetaResponse"
                }
              }
            },
            "description": "A successful response."
          }
        },
        "summary": "GetAggregatedWorkloadCustomMetrics returns aggregated custom metrics time-series data.\nPods are aggregated across the workload, grouped by metric name and container.",
        "tags": [
          "WorkloadOptimizationAPI"
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      },
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "workloadoptimization.v1.AggregatedCustomMetricGroup": {
        "description": "AggregatedCustomMetricGroup contains aggregated data points for a single metric name.",
        "properties": {
          "metricName": {
            "type": "string"
          },
          "unit": {
            "$ref": "#/components/schemas/workloadoptimization.v1.CustomMetricUnit"
          },
          "dataPoints": {
            "items": {
              "$ref": "#/components/schemas/workloadoptimization.v1.CustomMetricDataPoint"
            },
            "type": "array"
          }
        },
        "required": [
          "dataPoints",
          "metricName",
          "unit"
        ],
        "type": "object"
      },
      "workloadoptimization.v1.CustomMetricDataPoint": {
        "description": "CustomMetricDataPoint represents a single data point in a custom metric time series.",
        "properties": {
          "timestamp": {
            "format": "date-time",
            "type": "string"
          },
          "value": {
            "format": "double",
            "nullable": true,
            "type": "number"
          }
        },
        "required": [
          "timestamp"
        ],
        "type": "object"
      },
      "workloadoptimization.v1.CustomMetricUnit": {
        "default": "CUSTOM_METRIC_UNIT_UNSPECIFIED",
        "description": "CustomMetricUnit identifies the unit of a custom metric, inferred from naming conventions.",
        "enum": [
          "CUSTOM_METRIC_UNIT_UNSPECIFIED",
          "MILLISECONDS",
          "SECONDS",
          "BYTES",
          "KIBIBYTES",
          "MEGABYTES",
          "PERCENT",
          "COUNT",
          "THREADS",
          "CONNECTIONS",
          "REQUESTS",
          "PACKETS",
          "MESSAGES",
          "MILLICORES",
          "CORES"
        ],
        "type": "string"
      },
      "workloadoptimization.v1.GetAggregatedWorkloadCustomMetricsV1BetaResponse": {
        "properties": {
          "metricGroups": {
            "description": "Aggregated custom metrics time-series data grouped by metric name.",
            "items": {
              "$ref": "#/components/schemas/workloadoptimization.v1.AggregatedCustomMetricGroup"
            },
            "type": "array"
          },
          "step": {
            "description": "Step used to calculate metrics. May differ from the requested value if the server determines\nthe query would be too expensive. When the request does not provide a step, the server calculates one internally.",
            "type": "string"
          }
        },
        "required": [
          "metricGroups",
          "step"
        ],
        "type": "object"
      }
    }
  }
}
```