Get organization usage costs
Returns a grand total and a list of daily, per-entity organization usage cost records for the organization in the queried time period (maximum 31 days). All days in both the request and the response are evaluated based on the UTC timezone.
GET
/
v1
/
organizations
/
{organizationId}
/
usageCost
Get organization usage costs
curl --request GET \
--url https://api.clickhouse.cloud/v1/organizations/{organizationId}/usageCost \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.clickhouse.cloud/v1/organizations/{organizationId}/usageCost"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.clickhouse.cloud/v1/organizations/{organizationId}/usageCost', 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.clickhouse.cloud/v1/organizations/{organizationId}/usageCost",
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: Basic <encoded-value>"
],
]);
$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.clickhouse.cloud/v1/organizations/{organizationId}/usageCost"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.clickhouse.cloud/v1/organizations/{organizationId}/usageCost")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clickhouse.cloud/v1/organizations/{organizationId}/usageCost")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"status": 200,
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"result": {
"grandTotalCHC": 123,
"costs": [
{
"dataWarehouseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"serviceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"date": "2023-12-25",
"entityType": "datawarehouse",
"entityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"entityName": "<string>",
"metrics": {
"storageCHC": 123,
"backupCHC": 123,
"computeCHC": 123,
"dataTransferCHC": 123,
"initialLoadCHC": 123,
"publicDataTransferCHC": 123,
"interRegionTier1DataTransferCHC": 123,
"interRegionTier2DataTransferCHC": 123,
"interRegionTier3DataTransferCHC": 123,
"interRegionTier4DataTransferCHC": 123
},
"totalCHC": 123,
"locked": true
}
]
}
}{
"status": 400,
"error": "<string>",
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"status": 500,
"error": "<string>",
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}التفويضات
Use key ID and key secret obtained in ClickHouse Cloud console: https://clickhouse.com/docs/cloud/manage/openapi
معلمات المسار
ID of the requested organization.
معلمات الاستعلام
Start date for the report, e.g. 2024-12-19.
End date (inclusive) for the report, e.g. 2024-12-20. This date cannot be more than 30 days after from_date (for a maximum queried period of 31 days).
Filter criteria to apply when retrieving the usage cost report. Currently, only filtering by resource tags is supported.
آخر تعديل في ٣ سبتمبر ٢٠٢٦
هل كانت هذه الصفحة مفيدة؟
⌘I
Get organization usage costs
curl --request GET \
--url https://api.clickhouse.cloud/v1/organizations/{organizationId}/usageCost \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.clickhouse.cloud/v1/organizations/{organizationId}/usageCost"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.clickhouse.cloud/v1/organizations/{organizationId}/usageCost', 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.clickhouse.cloud/v1/organizations/{organizationId}/usageCost",
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: Basic <encoded-value>"
],
]);
$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.clickhouse.cloud/v1/organizations/{organizationId}/usageCost"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.clickhouse.cloud/v1/organizations/{organizationId}/usageCost")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clickhouse.cloud/v1/organizations/{organizationId}/usageCost")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"status": 200,
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"result": {
"grandTotalCHC": 123,
"costs": [
{
"dataWarehouseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"serviceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"date": "2023-12-25",
"entityType": "datawarehouse",
"entityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"entityName": "<string>",
"metrics": {
"storageCHC": 123,
"backupCHC": 123,
"computeCHC": 123,
"dataTransferCHC": 123,
"initialLoadCHC": 123,
"publicDataTransferCHC": 123,
"interRegionTier1DataTransferCHC": 123,
"interRegionTier2DataTransferCHC": 123,
"interRegionTier3DataTransferCHC": 123,
"interRegionTier4DataTransferCHC": 123
},
"totalCHC": 123,
"locked": true
}
]
}
}{
"status": 400,
"error": "<string>",
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"status": 500,
"error": "<string>",
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}