Skip to main content
GET
/
unit_costs
Get all unit costs for a cost report
curl --request GET \
  --url https://api.vantage.sh/v2/unit_costs \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.vantage.sh/v2/unit_costs"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.vantage.sh/v2/unit_costs', 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.vantage.sh/v2/unit_costs",
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.vantage.sh/v2/unit_costs"

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.vantage.sh/v2/unit_costs")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.vantage.sh/v2/unit_costs")

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
{
  "links": {
    "self": "https://api.vantage.sh/v2/unit_costs?cost_report_token=rprt_ea7dbb4f5783d677",
    "first": "https://api.vantage.sh/v2/unit_costs?cost_report_token=rprt_ea7dbb4f5783d677&page=1",
    "next": null,
    "last": null,
    "prev": null
  },
  "unit_costs": [
    {
      "business_metric_token": "bsnss_mtrc_3080a050c04104ff",
      "business_metric_title": "Biz Metric",
      "unit_cost_amount": "21.7",
      "business_metric_amount": "3.71",
      "scale": "1.0",
      "date": "2023-06-05"
    },
    {
      "business_metric_token": "bsnss_mtrc_4999b969d95095ef",
      "business_metric_title": "Different Biz Metric",
      "unit_cost_amount": "101.11",
      "business_metric_amount": "43.21",
      "scale": "1.0",
      "date": "2023-06-05"
    },
    {
      "business_metric_token": "bsnss_mtrc_3080a050c04104ff",
      "business_metric_title": "Biz Metric",
      "unit_cost_amount": "18.9",
      "business_metric_amount": "3.71",
      "scale": "1.0",
      "date": "2023-06-06"
    },
    {
      "business_metric_token": "bsnss_mtrc_4999b969d95095ef",
      "business_metric_title": "Different Biz Metric",
      "unit_cost_amount": "121.12",
      "business_metric_amount": "38.1",
      "scale": "1.0",
      "date": "2023-06-06"
    },
    {
      "business_metric_token": "bsnss_mtrc_3080a050c04104ff",
      "business_metric_title": "Biz Metric",
      "unit_cost_amount": "21.2",
      "business_metric_amount": "3.51",
      "scale": "1.0",
      "date": "2023-06-07"
    }
  ]
}
{
"errors": [
"<string>"
],
"links": {
"self": "<string>",
"first": "<string>",
"next": "<string>",
"last": "<string>",
"prev": "<string>"
}
}
{
"errors": [
"<string>"
],
"links": {
"self": "<string>",
"first": "<string>",
"next": "<string>",
"last": "<string>",
"prev": "<string>"
}
}
{
"errors": [
"<string>"
],
"links": {
"self": "<string>",
"first": "<string>",
"next": "<string>",
"last": "<string>",
"prev": "<string>"
}
}

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Query Parameters

cost_report_token
string
required

The CostReport token.

start_date
string

First date you would like to filter unit costs from. Defaults to the report's default. ISO 8601 formatted.

end_date
string

Last date you would like to filter unit costs to. Defaults to the report's default. ISO 8601 formatted.

date_bin
enum<string>

The date bin of the unit costs. Defaults to the report's default or day.

Available options:
day,
week,
month,
quarter,
hour
order
enum<string>
default:desc

Whether to order unit costs by date in an ascending or descending manner.

Available options:
asc,
desc
limit
integer<int32>

The amount of results to return. The maximum is 1000.

page
integer<int32>

The page of results to return.

Response

UnitCosts model

unit_costs
object[]
required