API REFERENCE

Cost Allocation API

Get Kubernetes cost breakdowns by team and department using the Kubeadapt API. Build chargeback and showback reports with aggregated spend data.

Cost endpoints return aggregated spend data grouped by team or department. Use these to build chargeback reports or track cost allocation across your organization.

Costs by Team

text
GET /v1/costs/teams

Returns cost and resource usage aggregated by team label.

Required scope: costs:teams:read

Query Parameters

ParameterTypeDefaultDescription
cluster_idstringFilter by cluster ID
limitinteger100Number of records to return (1 to 500)
offsetinteger0Number of records to skip

Example Request

bash
curl -H "Authorization: Bearer ka_your_api_key" \ "https://public-api.kubeadapt.io/v1/costs/teams?cluster_id=cls-abc123"

Example Response

json
{ "teams": [ { "team": "platform", "namespace_count": 3, "workload_count": 18, "pod_count": 72, "total_cpu_cores": 8.4, "total_memory_gb": 33.6, "hourly_cost": 22.8, "monthly_cost": 16644.0 }, { "team": "data", "namespace_count": 2, "workload_count": 9, "pod_count": 36, "total_cpu_cores": 12.0, "total_memory_gb": 48.0, "hourly_cost": 38.4, "monthly_cost": 28032.0 } ], "total": 4, "summary": { "total_hourly_cost": 125.5, "total_monthly_cost": 91615.0 } }

Response Fields

Each object in the teams array contains:

FieldTypeDescription
teamstringTeam label value
namespace_countintegerNumber of namespaces owned by this team
workload_countintegerNumber of workloads owned by this team
pod_countintegerTotal running pods
total_cpu_coresfloatTotal CPU usage in cores
total_memory_gbfloatTotal memory usage in GB
hourly_costfloatEstimated hourly cost in USD
monthly_costfloatEstimated monthly cost in USD

Costs by Department

text
GET /v1/costs/departments

Returns cost and resource usage aggregated by department label.

Required scope: costs:departments:read

Query Parameters

ParameterTypeDefaultDescription
cluster_idstringFilter by cluster ID
limitinteger100Number of records to return (1 to 500)
offsetinteger0Number of records to skip

Example Request

bash
curl -H "Authorization: Bearer ka_your_api_key" \ "https://public-api.kubeadapt.io/v1/costs/departments?cluster_id=cls-abc123"

Example Response

json
{ "departments": [ { "department": "engineering", "team_count": 3, "namespace_count": 5, "workload_count": 27, "pod_count": 108, "total_cpu_cores": 20.4, "total_memory_gb": 81.6, "hourly_cost": 61.2, "monthly_cost": 44676.0 }, { "department": "data-science", "team_count": 1, "namespace_count": 2, "workload_count": 9, "pod_count": 36, "total_cpu_cores": 12.0, "total_memory_gb": 48.0, "hourly_cost": 38.4, "monthly_cost": 28032.0 } ], "total": 2, "summary": { "total_hourly_cost": 125.5, "total_monthly_cost": 91615.0 } }

Response Fields

Each object in the departments array contains:

FieldTypeDescription
departmentstringDepartment label value
team_countintegerNumber of teams in this department
namespace_countintegerNumber of namespaces owned by this department
workload_countintegerNumber of workloads owned by this department
pod_countintegerTotal running pods
total_cpu_coresfloatTotal CPU usage in cores
total_memory_gbfloatTotal memory usage in GB
hourly_costfloatEstimated hourly cost in USD
monthly_costfloatEstimated monthly cost in USD