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/teamsReturns cost and resource usage aggregated by team label.
Required scope: costs:teams:read
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
cluster_id | string | Filter by cluster ID | |
limit | integer | 100 | Number of records to return (1 to 500) |
offset | integer | 0 | Number 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:
| Field | Type | Description |
|---|---|---|
team | string | Team label value |
namespace_count | integer | Number of namespaces owned by this team |
workload_count | integer | Number of workloads owned by this team |
pod_count | integer | Total running pods |
total_cpu_cores | float | Total CPU usage in cores |
total_memory_gb | float | Total memory usage in GB |
hourly_cost | float | Estimated hourly cost in USD |
monthly_cost | float | Estimated monthly cost in USD |
Costs by Department
text
GET /v1/costs/departmentsReturns cost and resource usage aggregated by department label.
Required scope: costs:departments:read
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
cluster_id | string | Filter by cluster ID | |
limit | integer | 100 | Number of records to return (1 to 500) |
offset | integer | 0 | Number 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:
| Field | Type | Description |
|---|---|---|
department | string | Department label value |
team_count | integer | Number of teams in this department |
namespace_count | integer | Number of namespaces owned by this department |
workload_count | integer | Number of workloads owned by this department |
pod_count | integer | Total running pods |
total_cpu_cores | float | Total CPU usage in cores |
total_memory_gb | float | Total memory usage in GB |
hourly_cost | float | Estimated hourly cost in USD |
monthly_cost | float | Estimated monthly cost in USD |
Related
- Clusters - Per-cluster cost distribution
- Namespaces - Namespace-level cost data
- Organization Dashboard - Organization-wide cost trends
- Recommendations - Cost optimization suggestions
- Cost Attribution - How costs are calculated