Analyze costs using API

The Domino Cost Center APIs allow aggregation only by labels of Domino domain objects, not by arbitrary Kubernetes objects, such as clusters.

Access Cost Center through Domino Cost API

Use the Domino Cost API to access Cost Center features.

Note
Only SysAdmins can use the /allocation and /asset API paths.

API samples

To obtain the Domino API key, go to Account Settings > API Key.

Today’s total cost with idle cost shared among allocations

curl -H "X-Domino-Api-Key: $API_KEY" -H "Accept: application/json" https://$DOMAIN/api/cost/v2/allocation/summary?window=7d&shareIdle=true -G

Today’s total for a particular Project

curl -H "X-Domino-Api-Key: $API_KEY" -H "Accept: application/json" https://$DOMAIN/api/cost/v2/allocation/summary?window=1d&&aggregate=projectId&aggregate=projectName&filter=projectId:%$PROJECT-ID%22 -G

Today’s total for a particular User

curl -H "X-Domino-Api-Key: $API_KEY" -H "Accept: application/json" https://$DOMAIN/api/cost/v2/allocation/summary?window=7d&shareIdle=true&filter=startingUserId:%$USER-ID%22 -G

Today’s asset costs

curl -H "X-Domino-Api-Key: $API_KEY" -H "Accept: application/json" https://$DOMAIN/api/cost/v2/asset?window=1d -G

Today’s cloud cost

curl -H "X-Domino-Api-Key: $API_KEY" -H "Accept: application/json" https://$DOMAIN/api/cost/v2/cloudCost/accumulated?window=7d&&aggregate=invoiceEntityID -G

API schema

There are a number of field options available with Cost Center APIs. The window query parameter is required.

FieldDescription

name

Name of each relevant Kubernetes concept described by the allocation, delimited by slashes, e.g. cluster/node/namespace/pod/container.

properties

Map of name-to-value for all relevant property fields, including cluster, node, namespace, controller, controllerKind, pod, container, labels, annotation, etc. Note: Prometheus only supports underscores (_) in label names. Dashes (-) and dots (.), while supported by Kubernetes, will be translated to underscores by Prometheus. This may cause the merging of labels, which could result in aggregated costs being charged to a single label.

window

Period of time over which the allocation is defined.

start

Precise starting time of the allocation. By definition must be within the window.

end

Precise ending time of the allocation. By definition must be within the window.

minutes

Number of minutes running; i.e. the minutes from start until end.

totalCost

Total cumulative cost.

rawAllocationOnly

Object with fields cpuCoreUsageMax and ramByteUsageMax, which are the maximum usages in the window for the Allocation. If the Allocation query is aggregated or accumulated, this object will be null because the meaning of maximum is ambiguous in these situations. Consider aggregating by namespace: should the maximum be the maximum of each Allocation individually, or the maximum combined usage of all Allocations (at any point in time in the window) in the namespace?

Next steps

See other ways Domino Cost Center can help you optimize the performance of your projects while managing cloud expenditures: