List Costs
Get customer costs
client.v1.customers.listCosts(CustomerListCostsParamsparams, RequestOptionsoptions?): CursorPage<credit_typesRecord<string, CreditTypes>end_timestampstringstart_timestampstringCustomerListCostsResponse>
get/v1/customers/{customer_id}/costs
Fetch daily pending costs for the specified customer, broken down by credit type and line items. Note: this is not supported for customers whose plan includes a UNIQUE-type billable metric.
Parameters
paramscustomer_idstringending_beforestringstarting_onstringlimitnumbernext_pagestringCustomerListCostsParams
Returns
CustomerListCostsResponse
import Metronome from '@metronome/sdk';
const client = new Metronome({
bearerToken: 'My Bearer Token',
});
// Automatically fetches more pages as needed.
for await (const customerListCostsResponse of client.v1.customers.listCosts({
customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
ending_before: '2019-12-27T18:11:19.117Z',
starting_on: '2019-12-27T18:11:19.117Z',
})) {
console.log(customerListCostsResponse.credit_types);
}
200 Example
{
"data": [
{
"credit_types": {
"foo": {
"cost": 0,
"line_item_breakdown": [
{
"cost": 0,
"name": "name",
"group_key": "group_key",
"group_value": "group_value"
}
],
"name": "name"
}
},
"end_timestamp": "2019-12-27T18:11:19.117Z",
"start_timestamp": "2019-12-27T18:11:19.117Z"
}
],
"next_page": "next_page"
}