KubeadaptDocsBack to site
Sign inStart free
DocsAPI ReferenceCLI
    • Discovery
    • Organization
    • Clusters
    • Namespaces
    • Workloads
    • Nodes
    • Node Groups
    • Recommendations
    • Teams
    • Departments
    • Cost Explorer
    • Cost Trends
Docs homev1Api ReferenceCost Trends

API Reference

Cost Trends

Time-series cost data at hourly, daily, weekly, or monthly granularity. Five scope-specific endpoints, one shared query model, and the CostTrendSeries response shape.


Cost-trend endpoints return time-series cost data for one resource scope: cluster, namespace, workload, node-group, or the whole organization. Five endpoints, a common parameter set (the node-group endpoint omits cost_mode — see exception), one response shape (CostTrendSeries).

Endpoints

ScopeEndpointRequired scopecost_mode
ClusterGET /v1/clusters/{cluster_id}/cost-trendclusters:readdefault fully_loaded
NamespaceGET /v1/clusters/{cluster_id}/namespaces/{namespace}/cost-trendnamespaces:readdefault workload_only
WorkloadGET /v1/clusters/{cluster_id}/workloads/by-uid/{workload_uid}/cost-trendworkloads:readdefault workload_only
Node-groupGET /v1/clusters/{cluster_id}/node-groups/{name}/cost-trendnodes:readrejected (422 INVALID_COST_MODE)
OrganizationGET /v1/organizations/dashboard/cost-trendorganization:readdefault fully_loaded

Path-parameter notes:

  • cluster_id, workload_uid are UUIDs.
  • namespace is the human-readable Kubernetes namespace name (not metadata.uid).
  • name (node-group) is the node_group label value. URL-encode characters such as : and ,.

Query parameters

Four of the five endpoints share the same parameter set. The node-group endpoint accepts the same parameters except cost_mode — see the note below.

ParameterRequiredTypeDefaultDescription
startyesinteger (unix epoch seconds, UTC)—Window start.
endyesinteger (unix epoch seconds, UTC)—Window end. Must be greater than start. Window must not exceed 5 years.
typenoenumrun_raterun_rate: each bucket's burn rate projected to a full month. breakdown: actual cost summed per bucket.
granularitynoenumautoauto, hourly, daily, weekly, monthly. See granularity rules.
cost_modenoenumscope-dependent (table above)fully_loaded or workload_only. Not accepted on the node-group endpoint — see node-group exception.

Node-group cost_mode exception

The node-group cost-trend endpoint rejects ?cost_mode= with 422 INVALID_COST_MODE, even when the value is fully_loaded or workload_only. Nodes carry a single physical cloud bill, so a node-group aggregate (the union of nodes sharing a node_group label) is mode-invariant. meta.cost_mode is omitted from the response.

This matches the rejection rule on the node-group listing and detail endpoints — see Cost Modes.

Granularity rules

GranularityBehavior
auto (default)Resolves to hourly for windows ≤ 14 days (inclusive), otherwise daily. The resolved value appears in data.granularity.
hourlyCapped at 60-day windows. Requests with a larger window return 422 VALIDATION_ERROR.
daily, weekly, monthlyNo window cap below the 5-year ceiling.

type=breakdown rejects granularity=hourly. Pair breakdown with daily or coarser.

Response

json
1{
2  "data": {
3    "kind": "CostTrend",
4    "scope": "cluster",
5    "scope_ref": {
6      "cluster_id": "c1a2b3c4-d5e6-7890-abcd-ef1234567890"
7    },
8    "start": "2026-05-01T00:00:00Z",
9    "end": "2026-05-08T00:00:00Z",
10    "granularity": "hourly",
11    "type": "run_rate",
12    "points": [
13      {
14        "bucket_start": "2026-05-01T00:00:00Z",
15        "total_cost": { "amount": "12.4700", "currency": "USD" }
16      },
17      {
18        "bucket_start": "2026-05-01T01:00:00Z",
19        "total_cost": { "amount": "12.5100", "currency": "USD" }
20      }
21    ],
22    "excluded_cluster_ids": []
23  },
24  "meta": {
25    "request_id": "req_01J5...",
26    "applied_at": "2026-05-21T10:30:00Z",
27    "cost_mode": "fully_loaded"
28  }
29}

Top-level fields

FieldTypeDescription
kindstringAlways "CostTrend".
scopeenumcluster, namespace, workload, node-group, or organization. Matches the endpoint called.
scope_refobjectIdentifies the entity. Field presence varies by scope (see scope_ref shape). Omitted for organization.
startstringRFC 3339 UTC anchor of the window start.
endstringRFC 3339 UTC anchor of the window end.
granularityenumPost-resolution value. Always one of hourly, daily, weekly, monthly. Never auto.
typeenumEchoes the requested type (run_rate or breakdown).
pointsarrayOne entry per bucket. Always an array — empty windows serialize as [], never null.
excluded_cluster_idsstring[]Populated only on organization scope, listing clusters that are not included in the response (for example, clusters the API key cannot access).

scope_ref shape

ScopeFields
clustercluster_id
namespacecluster_id, namespace
workloadcluster_id, workload_uid
node-groupcluster_id, node_group
organizationomitted

Bucket fields

FieldTypeDescription
bucket_startstringRFC 3339 UTC anchor of the bucket (start of hour, day, week, or month).
total_costMoney{amount, currency}. amount is a decimal string.

Empty-result behavior

The organization endpoint returns 200 OK with points: [] and excluded_cluster_ids: [] when the API key has an empty allowed-cluster list. It does not return 403. Resource-scoped endpoints (cluster, namespace, workload, node-group) return 403 CLUSTER_ACCESS_DENIED if the path-bound cluster is outside the key's allow-list.

Errors

HTTPerror.codeCause
400BAD_REQUESTMissing start or end, non-integer epoch, malformed UUID.
400INVALID_CLUSTER_IDcluster_id is not a valid UUID.
401UNAUTHORIZEDMissing or invalid Bearer token.
403FORBIDDENAPI key lacks the scope this endpoint requires.
403CLUSTER_ACCESS_DENIEDAPI key cannot reach the cluster in the path.
404CLUSTER_NOT_FOUND / NAMESPACE_NOT_FOUND / WORKLOAD_NOT_FOUND / NODE_GROUP_NOT_FOUNDPath-bound resource does not exist in the tenant.
422VALIDATION_ERRORend ≤ start, window > 5 years, granularity=hourly with a window > 60 days, type=breakdown with granularity=hourly, or an unknown enum value.
422INVALID_COST_MODEcost_mode is not fully_loaded or workload_only, OR cost_mode was supplied to the node-group endpoint (which rejects the parameter — see exception).
429RATE_LIMITEDPer-key quota exceeded. Honor Retry-After.
500INTERNAL_ERRORUnhandled server error.
503SERVICE_UNAVAILABLEA backend dependency was unavailable. Retry with backoff.

See Error Handling for the full catalog and retry guidance.

Examples

Hourly run-rate for one cluster, last seven days

bash
START=$(date -u -d '7 days ago' +%s)
END=$(date -u +%s)

curl -H "Authorization: Bearer ka_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  "https://public-api.kubeadapt.io/v1/clusters/c1a2b3c4-d5e6-7890-abcd-ef1234567890/cost-trend?start=$START&end=$END&type=run_rate&granularity=hourly"

Monthly breakdown for an organization, last year

bash
START=$(date -u -d '12 months ago' +%s)
END=$(date -u +%s)

curl -H "Authorization: Bearer ka_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  "https://public-api.kubeadapt.io/v1/organizations/dashboard/cost-trend?start=$START&end=$END&type=breakdown&granularity=monthly"

Workload trend with explicit cost mode

bash
curl -H "Authorization: Bearer ka_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  "https://public-api.kubeadapt.io/v1/clusters/c1a2b3c4-d5e6-7890-abcd-ef1234567890/workloads/by-uid/01J5K3V0Q7Y4XR8A2B3C5D7E9F/cost-trend?start=1748736000&end=1749340800&granularity=daily&cost_mode=fully_loaded"

See also

  • API Overview: base URL, envelope shape, the full endpoint index.
  • Cost Modes: the fully_loaded vs workload_only contract and per-scope defaults.
  • Permission Scopes: the scopes that gate each cost-trend endpoint.
  • Error Handling: the full error code catalog and recommended retry behavior.

Related

  • API Overview
  • Permission Scopes
  • Cost Modes
  • Error Handling
PreviousCost ExplorerAPI Reference

On this page

  • Endpoints
  • Query parameters
  • Node-group costmode exception
  • Granularity rules
  • Response
  • Top-level fields
  • scoperef shape
  • Bucket fields
  • Empty-result behavior
  • Errors
  • Examples
  • Hourly run-rate for one cluster, last seven days
  • Monthly breakdown for an organization, last year
  • Workload trend with explicit cost mode
  • See also
Edit this page
Kubeadapt

Kubernetes FinOps platform. Cost visibility, rightsizing, and capacity planning that pays for itself in 30 days.

Product

  • Cost Monitoring
  • Cost Attribution
  • Workload Rightsizing
  • Recommendations
  • Smart Alerting
  • Best Practices
  • Network Cross-AZ

Resources

  • Documentation
  • Status Page
  • Feature Requests

Company

  • About Us
  • Security
  • Careers
  • Contact

© 2026 Kubeadapt. All rights reserved.

PrivacyTermsSecurity