---
title: "Get Cluster Aggregated Detailed Costs"
method: POST
path: "/ocean/gcp/k8s/cluster/{oceanClusterId}/aggregatedCosts"
tags: ["Ocean GKE"]
---

# Get Cluster Aggregated Detailed Costs

`POST /ocean/gcp/k8s/cluster/{oceanClusterId}/aggregatedCosts`

Provides Kubernetes cluster resource usage and costs over a time interval which can be grouped and/or filtered by label/annotaion.\
For example - application name (webapp, backend), environment (production, staging), version etc.\
The response will contain a breakdown of the cluster resource costs($) in terms of compute (CPU, memory) and storage.
The response will group the cluster usage costs based on preselected default of application namespace or user selected label or annotation.\
Within the group, resource costs are broken down per resource kind (Deployment, DaemonSet etc.).

Time Rounding Down: The CostAnalysis API applies rounding down to the hours provided during the call.\
For example, the value 1707004799099 (In GMT) representing Saturday, February 3, 2024, 23:59:59.099 is rounded down to Saturday, February 3, 2024, 23:00:00.000, resulting in the omission of one hour of cost.

## Parameters

- `#/paths/~1ocean~1aws~1k8s~1cluster~1%7BoceanClusterId%7D/get/parameters/1` — unresolved $ref
- `#/paths/~1azure~1costs/get/parameters/0` — unresolved $ref

## Request body

- object
  - `startTime` string, required — Beginning date value using either the date format "yyyy-MM-dd'T'HH:mm:ss'Z'" or ms "1494751821472".
  - `endTime` string, required — End date value using either the date format "yyyy-MM-dd'T'HH:mm:ss'Z'" or ms "1494751821472".
  - `groupBy` 'namespace' | 'namespace.label.${labelKey}' | 'resource.label.${labelKey}' | 'resource.annotation.${annotationKey}' | 'namespace.annotation.${annotationKey}' — The parameter we want to group the costs by.
  - `filter` object — Describe how to filter the costs. Optional field.
    - `scope` 'namespace' | 'resource', required
    - `conditions` object, required
      - `anyMatch` object[], required — Array of conditions set that OR operator is applied between them.
        - `allMatch` object[], required — Array of conditions that AND operator is applied between them.\ For example, (label env equals prod) AND (label app exists)
          - `type` 'label' | 'annotation', required
          - `key` string, required — May be any string, but shouldn't be empty.
          - `operator` 'equals' | 'notEquals' | 'exists' | 'notExists', required
          - `value` string — Required whenever the operator is "equals" or "notEquals".

## Other responses

- `400` — Bad Request

---

[API](https://skmtc.net/spot/apis/spot-by-flexera-api.md) · [All operations](https://skmtc.net/spot/apis/spot-by-flexera-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/spot/spot-by-flexera-api/revisions/72813baf8d47/schema)
