Vantage Launches API Endpoint and CSV Export for Unit Costs

by Vantage Team


Vantage Launches API Endpoint and CSV Export for Unit Costs

Today, Vantage is launching API support for Unit Costs, as well as ability to export Unit Costs to CSV from Cost Reports. Customers can now retrieve their calculated Unit Costs of Business Metrics that are assigned to Cost Reports for their own data analytics outside of the Vantage console.

While users could previously view Unit Costs within Cost Reports in the console, export of this data was not possible. Customers were able to retrieve raw Business Metrics via the /business_metrics API, however manual calculations were required in order to calculate unit costs with data from the /costs API or CSV exports from Cost Reports.

Now, with the addition of a /unit_costs API endpoint and Unit Costs CSV exports, customers can retrieve this data for use outside the Vantage console. With a Vantage API Access Token and cost_report_token, customers can programmatically fetch unit costs for the default date ranges of the Cost Report or a custom date range, without needing to interact with the Vantage console. Alternatively, customers can choose to export Unit Costs in addition to cost data when exporting their Cost Reports within the Vantage console.

The /unit_costs API endpoint and new CSV export are now available to all users, including users in the free tier. To get started with the API, see the API documentation. To get started with the CSV export, see the Cost Report documentation.

Frequently Asked Questions

1. What is being launched today?

Vantage is launching the ability to export Unit Costs through the /unit_costs API endpoint and through CSV export of Cost Reports.

2. Who is the customer?

The customer is anyone who would like to retrieve calculated Unit Cost information from their Cost Reports for manipulation outside the Vantage console.

3. How much does this cost?

There is no additional cost to use the API or CSV export. It is included in the cost of a Vantage subscription, including users in the free tier.

4. How do I retrieve Unit Costs via CSV export?

When exporting a Cost Report as a CSV, you can decide if you want Unit Costs exported at the same time. If included, you will receive a separate CSV that includes your Unit Costs in addition to your costs from your Cost Report via email. See the Export Cost Reports documentation for more information.

5. How do I retrieve Unit Costs via the API?

Send the following API request to retrieve Unit Costs using the /unit_costs endpoint. Details on parameters used in this sample request are provided below:

curl --request GET \
      --url https://api.vantage.sh/v2/unit_costs?page=1 \
      --header 'accept: application/json' \
      --header 'authorization: Bearer TOKEN' \
      --header 'content-type: application/json' \
      --data @- **<<**EOF
  {
    "cost_report_token": "rprt_123456789",
    "start_date": "2025-01-01",
    "end_date": "2025-03-31",
    "date_bin": "day"
  }
  EOF

In the above request:

  • Each request requires the associated Cost Report’s cost_report_token. You can retrieve this from the /cost_reports endpoint. Alternatively, you can get the cost_report_token at the end of the Cost Report’s URL when viewing the report in the console (e.g., rprt_1234 in https://console.vantage.sh/reports/rprt_1234).
  • You can optionally filter the results with a start_date , end_date , and date_bin. If not specified, the API will return the default date window from the cost report
  • For paginated results, you can use the page parameter in the url to specify page you want to retrieve

6. What methods are available with these endpoints?

The /unit_costs endpoints uses the GET method.

7. How do I authenticate with the API?

The Vantage API uses API tokens for authentication. You can create both user and service tokens in the console. An API key can be assigned Read and Write scopes. See the API documentation for details on how to get started with API keys.

8. Who has permission to use the API?

All users can generate Read API keys. Using the API key, you can retrieve unit costs for any Cost Report the user that creates the API keys has access to in the Vantage console.

9. What are some resources I can use to get started with the API?

Vantage provides multiple resources for getting started with the API:

10. What does an API response look like?

{
  "links": {
    "self": "http://api.vantage.sh/v2/unit_costs?cost_report_token=rprt_abcdefghji",
    "first": "http://api.vantage.sh/v2/unit_costs?cost_report_token=rprt_abcdefghji&page=1",
    "next": null,
    "last": null,
    "prev": null
  },
  "unit_costs": [
    {
      "business_metric_token": "bsnss_mtrc_1234567890",
      "business_metric_title": "CPU Utilization",
      "unit_cost_amount": "71.8826803",
      "business_metric_amount": "0.01",
      "scale": 1.0,
      "date": "2025-04-02"
    },
    {
      "business_metric_token": "bsnss_mtrc_abcdefghij",
      "business_metric_title": "Load Balancer Requests",
      "unit_cost_amount": "0.000476865764492992599938787566758327",
      "business_metric_amount": "106552",
      "scale": 1000.0,
      "date": "2025-04-02"
    },
    {
      "business_metric_token": "bsnss_mtrc_1234567890",
      "business_metric_title": "CPU Utilization",
      "unit_cost_amount": "73.6952854",
      "business_metric_amount": "0.73",
      "scale": 1.0,
      "date": "2025-04-01"
    },
    {
      "business_metric_token": "bsnss_mtrc_abcdefghij",
      "business_metric_title": "Load Balancer Requests",
      "unit_cost_amount": "0.00053835",
      "business_metric_amount": "148765",
      "scale": 1000.0,
      "date": "2025-04-01"
    }
  ]
}

11. What does a CSV export look like?

Below is a sample export of the CSV file generated for a Cost Report with two business metrics called CPU Utilization and Load Balancer Requests.

date business_ metric_amount unit_cost_ amount business_ metric_token business_ metric_title scale
2025-04-01 0.73 73.69528 bsnss_mtrc_ 1234567890 CPU Utilization 1
2025-04-01 148765 0.000538 bsnss_mtrc_ abcdefghij Load Balancer Requests 1000
2025-04-02 0.01 71.88268 bsnss_mtrc_ 1234567890 CPU Utilization 1
2025-04-02 106552 0.000476 bsnss_mtrc_ abcdefghij Load Balancer Requests 1000
2025-04-03 0.91 74.74969 bsnss_mtrc_ 1234567890 CPU Utilization 1
2025-04-03 67631 0.000495 bsnss_mtrc_ abcdefghij Load Balancer Requests 1000
2025-04-04 0.82 73.30140 bsnss_mtrc_ 1234567890 CPU Utilization 1
2025-04-04 61734 0.000489 bsnss_mtrc_ abcdefghij Load Balancer Requests 1000

12. Can I retrieve unit costs via the Vantage MCP server? Retrieving Unit Cost data is available in v0.0.2 of the Vantage MCP Server. Check the Vantage MCP GitHub README for updated list of MCP functionality and instructions on how to update versions.