Get billable metrics for a customer
curl --request GET \
--url https://api.metronome.com/v1/customers/{customer_id}/billable-metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.metronome.com/v1/customers/{customer_id}/billable-metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.metronome.com/v1/customers/{customer_id}/billable-metrics', 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.metronome.com/v1/customers/{customer_id}/billable-metrics",
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: Bearer <token>"
],
]);
$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.metronome.com/v1/customers/{customer_id}/billable-metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.metronome.com/v1/customers/{customer_id}/billable-metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.metronome.com/v1/customers/{customer_id}/billable-metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"name": "data transfer (GB)",
"id": "9570e4f3-d1da-4b95-ba81-bd40ee002727",
"group_by": [
"cluster",
"region"
],
"aggregate": "sum",
"aggregate_keys": [
"bytes"
],
"aggregation_type": "SUM",
"aggregation_key": "bytes",
"event_type_filter": {
"in_values": [
"cpu_usage"
]
},
"property_filters": [
{
"name": "cpu_hours",
"exists": true
},
{
"name": "region",
"exists": true,
"in_values": [
"EU",
"NA"
]
},
{
"name": "machine_type",
"exists": true,
"in_values": [
"slow",
"fast"
]
}
],
"group_keys": [
[
"region"
],
[
"machine_type"
]
]
},
{
"name": "CPU hours",
"id": "13117714-3f05-48e5-a6e9-a66093f13b4d",
"aggregation_type": "SUM",
"aggregation_key": "bytes",
"event_type_filter": {
"in_values": [
"cpu_usage"
]
},
"property_filters": [
{
"name": "cpu_hours",
"exists": true
},
{
"name": "region",
"exists": true,
"in_values": [
"EU",
"NA"
]
},
{
"name": "machine_type",
"exists": true,
"in_values": [
"slow",
"fast"
]
}
],
"group_keys": [
[
"region"
],
[
"machine_type"
]
],
"archived_at": "2024-10-01T11:23:44Z"
}
],
"next_page": null
}Billable metrics
Get billable metrics for a customer
Get all billable metrics available for a specific customer. Supports pagination and filtering by current plan status or archived metrics. Use this endpoint to see which metrics are being tracked for billing calculations for a given customer.
GET
/
v1
/
customers
/
{customer_id}
/
billable-metrics
Get billable metrics for a customer
curl --request GET \
--url https://api.metronome.com/v1/customers/{customer_id}/billable-metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.metronome.com/v1/customers/{customer_id}/billable-metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.metronome.com/v1/customers/{customer_id}/billable-metrics', 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.metronome.com/v1/customers/{customer_id}/billable-metrics",
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: Bearer <token>"
],
]);
$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.metronome.com/v1/customers/{customer_id}/billable-metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.metronome.com/v1/customers/{customer_id}/billable-metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.metronome.com/v1/customers/{customer_id}/billable-metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"name": "data transfer (GB)",
"id": "9570e4f3-d1da-4b95-ba81-bd40ee002727",
"group_by": [
"cluster",
"region"
],
"aggregate": "sum",
"aggregate_keys": [
"bytes"
],
"aggregation_type": "SUM",
"aggregation_key": "bytes",
"event_type_filter": {
"in_values": [
"cpu_usage"
]
},
"property_filters": [
{
"name": "cpu_hours",
"exists": true
},
{
"name": "region",
"exists": true,
"in_values": [
"EU",
"NA"
]
},
{
"name": "machine_type",
"exists": true,
"in_values": [
"slow",
"fast"
]
}
],
"group_keys": [
[
"region"
],
[
"machine_type"
]
]
},
{
"name": "CPU hours",
"id": "13117714-3f05-48e5-a6e9-a66093f13b4d",
"aggregation_type": "SUM",
"aggregation_key": "bytes",
"event_type_filter": {
"in_values": [
"cpu_usage"
]
},
"property_filters": [
{
"name": "cpu_hours",
"exists": true
},
{
"name": "region",
"exists": true,
"in_values": [
"EU",
"NA"
]
},
{
"name": "machine_type",
"exists": true,
"in_values": [
"slow",
"fast"
]
}
],
"group_keys": [
[
"region"
],
[
"machine_type"
]
],
"archived_at": "2024-10-01T11:23:44Z"
}
],
"next_page": null
}