Get the asset cost over a time window
Retrieve asset cost
curl --request GET \
--url https://mycluster.domino.tech/api/cost/v1/asset \
--header 'X-Domino-Api-Key: <api-key>'import requests
url = "https://mycluster.domino.tech/api/cost/v1/asset"
headers = {"X-Domino-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Domino-Api-Key': '<api-key>'}};
fetch('https://mycluster.domino.tech/api/cost/v1/asset', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mycluster.domino.tech/api/cost/v1/asset",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Domino-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://mycluster.domino.tech/api/cost/v1/asset"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Domino-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://mycluster.domino.tech/api/cost/v1/asset")
.header("X-Domino-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://mycluster.domino.tech/api/cost/v1/asset")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Domino-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"cpuCost": 123,
"gpuCost": 123,
"labels": {
"instance": "<string>",
"job": "<string>",
"label_dominodatalab_com_domino_node": "<string>",
"label_dominodatalab_com_node_pool": "<string>"
},
"name": "<string>",
"properties": {
"category": "<string>",
"cluster": "<string>",
"provider": "<string>",
"providerId": "<string>",
"service": "<string>"
},
"ramCost": 123,
"totalCost": 123,
"type": "<string>",
"window": {
"end": "<string>",
"minutes": 123,
"start": "<string>"
}
}
]
}Authorizations
Query Parameters
Duration of time over which to query. Accepts words like today, week, month, yesterday, lastweek, lastmonth; durations like 30m, 12h, 7d, or time like 2021-03-10T00:00:00Z,2021-03-11T00:00:00Z
Aggregate the cost allocation. Accepts kubecost aggregates cluster, namespace, pod, deployment, service, daemonset, statefulset, job, cronjob, replicaset, node, container, pv, pvc, storageclass, cluster
Start time of the query. Accepts RFC3339 format, must be inside the window
End time of the query. Accepts RFC3339 format, must be inside the window
If the result will be accumulated. Default is false. If true, the result will be accumulated from the start time to the end time.
Filter the result by the kubecost filter like cluster, namespace, pod, deployment, service, daemonset, statefulset
Response
Success
Show child attributes
Show child attributes
Was this page helpful?
curl --request GET \
--url https://mycluster.domino.tech/api/cost/v1/asset \
--header 'X-Domino-Api-Key: <api-key>'import requests
url = "https://mycluster.domino.tech/api/cost/v1/asset"
headers = {"X-Domino-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Domino-Api-Key': '<api-key>'}};
fetch('https://mycluster.domino.tech/api/cost/v1/asset', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mycluster.domino.tech/api/cost/v1/asset",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Domino-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://mycluster.domino.tech/api/cost/v1/asset"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Domino-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://mycluster.domino.tech/api/cost/v1/asset")
.header("X-Domino-Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://mycluster.domino.tech/api/cost/v1/asset")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Domino-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"cpuCost": 123,
"gpuCost": 123,
"labels": {
"instance": "<string>",
"job": "<string>",
"label_dominodatalab_com_domino_node": "<string>",
"label_dominodatalab_com_node_pool": "<string>"
},
"name": "<string>",
"properties": {
"category": "<string>",
"cluster": "<string>",
"provider": "<string>",
"providerId": "<string>",
"service": "<string>"
},
"ramCost": 123,
"totalCost": 123,
"type": "<string>",
"window": {
"end": "<string>",
"minutes": 123,
"start": "<string>"
}
}
]
}