Billing
Get billing usage
Returns the organization’s CostGraph charges for a billing period as a FinOps FOCUS 1.2 dataset, one record per tenant per meter. Optional ?period=YYYY-MM (defaults to current month).
GET
/
api
/
v1
/
billing
/
usage
Get billing usage
curl --request GET \
--url https://api.costgraph.ai/api/v1/billing/usage \
--header 'Authorization: <api-key>'import requests
url = "https://api.costgraph.ai/api/v1/billing/usage"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.costgraph.ai/api/v1/billing/usage', 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://api.costgraph.ai/api/v1/billing/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <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://api.costgraph.ai/api/v1/billing/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<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://api.costgraph.ai/api/v1/billing/usage")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/billing/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"charges": {
"comparable": true,
"groups": [
{
"billedCost": 123,
"changePct": 123,
"chargeCategory": "<string>",
"children": "<array>",
"contractedCost": 123,
"current": 123,
"dimension": "<string>",
"key": "<string>",
"listCost": 123,
"previous": 123,
"share": 123,
"usageQuantity": 123,
"usageUnit": "<string>"
}
]
},
"focus_version": "<string>",
"period": "<string>",
"rows": [
{
"AvailabilityZone": "<string>",
"BilledCost": "<string>",
"BillingAccountId": "<string>",
"BillingAccountName": "<string>",
"BillingAccountType": "<string>",
"BillingCurrency": "<string>",
"BillingPeriodEnd": "<string>",
"BillingPeriodStart": "<string>",
"CapacityReservationId": "<string>",
"CapacityReservationStatus": "<string>",
"ChargeCategory": "<string>",
"ChargeClass": "<string>",
"ChargeDescription": "<string>",
"ChargeFrequency": "<string>",
"ChargePeriodEnd": "<string>",
"ChargePeriodStart": "<string>",
"CommitmentDiscountCategory": "<string>",
"CommitmentDiscountId": "<string>",
"CommitmentDiscountName": "<string>",
"CommitmentDiscountQuantity": "<string>",
"CommitmentDiscountStatus": "<string>",
"CommitmentDiscountType": "<string>",
"CommitmentDiscountUnit": "<string>",
"ConsumedQuantity": "<string>",
"ConsumedUnit": "<string>",
"ContractedCost": "<string>",
"ContractedUnitPrice": "<string>",
"EffectiveCost": "<string>",
"InvoiceId": "<string>",
"InvoiceIssuer": "<string>",
"ListCost": "<string>",
"ListUnitPrice": "<string>",
"PricingCategory": "<string>",
"PricingCurrency": "<string>",
"PricingCurrencyContractedUnitPrice": "<string>",
"PricingCurrencyEffectiveCost": "<string>",
"PricingCurrencyListUnitPrice": "<string>",
"PricingQuantity": "<string>",
"PricingUnit": "<string>",
"Provider": "<string>",
"Publisher": "<string>",
"RegionId": "<string>",
"RegionName": "<string>",
"ResourceId": "<string>",
"ResourceName": "<string>",
"ResourceType": "<string>",
"ServiceCategory": "<string>",
"ServiceName": "<string>",
"ServiceSubcategory": "<string>",
"SkuId": "<string>",
"SkuMeter": "<string>",
"SkuPriceDetails": [
123
],
"SkuPriceId": "<string>",
"SubAccountId": "<string>",
"SubAccountName": "<string>",
"SubAccountType": "<string>",
"Tags": [
123
]
}
],
"totals": {
"billed_cost": "<string>",
"billing_currency": "<string>",
"effective_cost": "<string>",
"list_cost": "<string>"
}
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}Was this page helpful?
⌘I
Get billing usage
curl --request GET \
--url https://api.costgraph.ai/api/v1/billing/usage \
--header 'Authorization: <api-key>'import requests
url = "https://api.costgraph.ai/api/v1/billing/usage"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.costgraph.ai/api/v1/billing/usage', 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://api.costgraph.ai/api/v1/billing/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <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://api.costgraph.ai/api/v1/billing/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<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://api.costgraph.ai/api/v1/billing/usage")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/billing/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"charges": {
"comparable": true,
"groups": [
{
"billedCost": 123,
"changePct": 123,
"chargeCategory": "<string>",
"children": "<array>",
"contractedCost": 123,
"current": 123,
"dimension": "<string>",
"key": "<string>",
"listCost": 123,
"previous": 123,
"share": 123,
"usageQuantity": 123,
"usageUnit": "<string>"
}
]
},
"focus_version": "<string>",
"period": "<string>",
"rows": [
{
"AvailabilityZone": "<string>",
"BilledCost": "<string>",
"BillingAccountId": "<string>",
"BillingAccountName": "<string>",
"BillingAccountType": "<string>",
"BillingCurrency": "<string>",
"BillingPeriodEnd": "<string>",
"BillingPeriodStart": "<string>",
"CapacityReservationId": "<string>",
"CapacityReservationStatus": "<string>",
"ChargeCategory": "<string>",
"ChargeClass": "<string>",
"ChargeDescription": "<string>",
"ChargeFrequency": "<string>",
"ChargePeriodEnd": "<string>",
"ChargePeriodStart": "<string>",
"CommitmentDiscountCategory": "<string>",
"CommitmentDiscountId": "<string>",
"CommitmentDiscountName": "<string>",
"CommitmentDiscountQuantity": "<string>",
"CommitmentDiscountStatus": "<string>",
"CommitmentDiscountType": "<string>",
"CommitmentDiscountUnit": "<string>",
"ConsumedQuantity": "<string>",
"ConsumedUnit": "<string>",
"ContractedCost": "<string>",
"ContractedUnitPrice": "<string>",
"EffectiveCost": "<string>",
"InvoiceId": "<string>",
"InvoiceIssuer": "<string>",
"ListCost": "<string>",
"ListUnitPrice": "<string>",
"PricingCategory": "<string>",
"PricingCurrency": "<string>",
"PricingCurrencyContractedUnitPrice": "<string>",
"PricingCurrencyEffectiveCost": "<string>",
"PricingCurrencyListUnitPrice": "<string>",
"PricingQuantity": "<string>",
"PricingUnit": "<string>",
"Provider": "<string>",
"Publisher": "<string>",
"RegionId": "<string>",
"RegionName": "<string>",
"ResourceId": "<string>",
"ResourceName": "<string>",
"ResourceType": "<string>",
"ServiceCategory": "<string>",
"ServiceName": "<string>",
"ServiceSubcategory": "<string>",
"SkuId": "<string>",
"SkuMeter": "<string>",
"SkuPriceDetails": [
123
],
"SkuPriceId": "<string>",
"SubAccountId": "<string>",
"SubAccountName": "<string>",
"SubAccountType": "<string>",
"Tags": [
123
]
}
],
"totals": {
"billed_cost": "<string>",
"billing_currency": "<string>",
"effective_cost": "<string>",
"list_cost": "<string>"
}
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}