Skip to main content
PUT
/
cost_reports
/
{cost_report_token}
Update cost report
curl --request PUT \
  --url https://api.vantage.sh/v2/cost_reports/{cost_report_token} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "<string>",
  "groupings": "<string>",
  "filter": "<string>",
  "saved_filter_tokens": [
    "<string>"
  ],
  "business_metric_tokens_with_metadata": [
    {
      "business_metric_token": "<string>",
      "unit_scale": "per_unit",
      "label_filter": [
        "<string>"
      ]
    }
  ],
  "folder_token": "<string>",
  "settings": {
    "include_credits": true,
    "include_refunds": true,
    "include_discounts": true,
    "include_tax": true,
    "amortize": true,
    "unallocated": true,
    "aggregate_by": "<string>",
    "show_previous_period": true,
    "complete_period": true
  },
  "chart_settings": {
    "x_axis_dimension": [
      "<string>"
    ],
    "y_axis_dimension": "<string>"
  },
  "previous_period_start_date": "<string>",
  "previous_period_end_date": "<string>",
  "start_date": "<string>",
  "end_date": "<string>"
}
'
import requests

url = "https://api.vantage.sh/v2/cost_reports/{cost_report_token}"

payload = {
"title": "<string>",
"groupings": "<string>",
"filter": "<string>",
"saved_filter_tokens": ["<string>"],
"business_metric_tokens_with_metadata": [
{
"business_metric_token": "<string>",
"unit_scale": "per_unit",
"label_filter": ["<string>"]
}
],
"folder_token": "<string>",
"settings": {
"include_credits": True,
"include_refunds": True,
"include_discounts": True,
"include_tax": True,
"amortize": True,
"unallocated": True,
"aggregate_by": "<string>",
"show_previous_period": True,
"complete_period": True
},
"chart_settings": {
"x_axis_dimension": ["<string>"],
"y_axis_dimension": "<string>"
},
"previous_period_start_date": "<string>",
"previous_period_end_date": "<string>",
"start_date": "<string>",
"end_date": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
groupings: '<string>',
filter: '<string>',
saved_filter_tokens: ['<string>'],
business_metric_tokens_with_metadata: [
{
business_metric_token: '<string>',
unit_scale: 'per_unit',
label_filter: ['<string>']
}
],
folder_token: '<string>',
settings: {
include_credits: true,
include_refunds: true,
include_discounts: true,
include_tax: true,
amortize: true,
unallocated: true,
aggregate_by: '<string>',
show_previous_period: true,
complete_period: true
},
chart_settings: {x_axis_dimension: ['<string>'], y_axis_dimension: '<string>'},
previous_period_start_date: '<string>',
previous_period_end_date: '<string>',
start_date: '<string>',
end_date: '<string>'
})
};

fetch('https://api.vantage.sh/v2/cost_reports/{cost_report_token}', 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/cost_reports/{cost_report_token}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'groupings' => '<string>',
'filter' => '<string>',
'saved_filter_tokens' => [
'<string>'
],
'business_metric_tokens_with_metadata' => [
[
'business_metric_token' => '<string>',
'unit_scale' => 'per_unit',
'label_filter' => [
'<string>'
]
]
],
'folder_token' => '<string>',
'settings' => [
'include_credits' => true,
'include_refunds' => true,
'include_discounts' => true,
'include_tax' => true,
'amortize' => true,
'unallocated' => true,
'aggregate_by' => '<string>',
'show_previous_period' => true,
'complete_period' => true
],
'chart_settings' => [
'x_axis_dimension' => [
'<string>'
],
'y_axis_dimension' => '<string>'
],
'previous_period_start_date' => '<string>',
'previous_period_end_date' => '<string>',
'start_date' => '<string>',
'end_date' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.vantage.sh/v2/cost_reports/{cost_report_token}"

payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"groupings\": \"<string>\",\n \"filter\": \"<string>\",\n \"saved_filter_tokens\": [\n \"<string>\"\n ],\n \"business_metric_tokens_with_metadata\": [\n {\n \"business_metric_token\": \"<string>\",\n \"unit_scale\": \"per_unit\",\n \"label_filter\": [\n \"<string>\"\n ]\n }\n ],\n \"folder_token\": \"<string>\",\n \"settings\": {\n \"include_credits\": true,\n \"include_refunds\": true,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true,\n \"unallocated\": true,\n \"aggregate_by\": \"<string>\",\n \"show_previous_period\": true,\n \"complete_period\": true\n },\n \"chart_settings\": {\n \"x_axis_dimension\": [\n \"<string>\"\n ],\n \"y_axis_dimension\": \"<string>\"\n },\n \"previous_period_start_date\": \"<string>\",\n \"previous_period_end_date\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\"\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://api.vantage.sh/v2/cost_reports/{cost_report_token}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"groupings\": \"<string>\",\n \"filter\": \"<string>\",\n \"saved_filter_tokens\": [\n \"<string>\"\n ],\n \"business_metric_tokens_with_metadata\": [\n {\n \"business_metric_token\": \"<string>\",\n \"unit_scale\": \"per_unit\",\n \"label_filter\": [\n \"<string>\"\n ]\n }\n ],\n \"folder_token\": \"<string>\",\n \"settings\": {\n \"include_credits\": true,\n \"include_refunds\": true,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true,\n \"unallocated\": true,\n \"aggregate_by\": \"<string>\",\n \"show_previous_period\": true,\n \"complete_period\": true\n },\n \"chart_settings\": {\n \"x_axis_dimension\": [\n \"<string>\"\n ],\n \"y_axis_dimension\": \"<string>\"\n },\n \"previous_period_start_date\": \"<string>\",\n \"previous_period_end_date\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.vantage.sh/v2/cost_reports/{cost_report_token}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"groupings\": \"<string>\",\n \"filter\": \"<string>\",\n \"saved_filter_tokens\": [\n \"<string>\"\n ],\n \"business_metric_tokens_with_metadata\": [\n {\n \"business_metric_token\": \"<string>\",\n \"unit_scale\": \"per_unit\",\n \"label_filter\": [\n \"<string>\"\n ]\n }\n ],\n \"folder_token\": \"<string>\",\n \"settings\": {\n \"include_credits\": true,\n \"include_refunds\": true,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true,\n \"unallocated\": true,\n \"aggregate_by\": \"<string>\",\n \"show_previous_period\": true,\n \"complete_period\": true\n },\n \"chart_settings\": {\n \"x_axis_dimension\": [\n \"<string>\"\n ],\n \"y_axis_dimension\": \"<string>\"\n },\n \"previous_period_start_date\": \"<string>\",\n \"previous_period_end_date\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "token": "rprt_1e692ea6b3eddf6b",
  "title": "Updated Cost Report",
  "folder_token": "fldr_86dec25791dca5ce",
  "saved_filter_tokens": [
    "svd_fltr_1977fb9dc5e2b336"
  ],
  "business_metric_tokens_with_metadata": [
    {
      "business_metric_token": "bsnss_mtrc_14dc9a1fb1ce67ce",
      "unit_scale": "per_thousand",
      "label_filter": [
        "CBGB",
        "Roxy",
        "Studio 54",
        ""
      ]
    },
    {
      "business_metric_token": "bsnss_mtrc_ab4227c15f99f995",
      "unit_scale": "per_million"
    }
  ],
  "default_forecast": {
    "kind": "baseline"
  },
  "filter": "costs.provider = 'azure'",
  "groupings": "account_id,service",
  "settings": {
    "include_credits": false,
    "include_refunds": false,
    "include_discounts": true,
    "include_tax": true,
    "amortize": true,
    "unallocated": false,
    "aggregate_by": "cost",
    "show_previous_period": true,
    "complete_period": false
  },
  "created_at": "2024-07-03T00:00:00Z",
  "workspace_token": "wrkspc_a8fb0662fdca90e0",
  "previous_period_start_date": null,
  "previous_period_end_date": null,
  "start_date": "2024-07-01",
  "end_date": "2024-07-31",
  "date_interval": "this_month",
  "chart_type": "pie",
  "date_bin": "week",
  "chart_settings": {
    "y_axis_dimension": "cost",
    "x_axis_dimension": [
      "date"
    ]
  }
}
{
"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.

Path Parameters

cost_report_token
string
required

Body

application/json

Update a CostReport.

title
string

The title of the CostReport.

groupings
string

Grouping values for aggregating costs on the report. Valid groupings: account_id, billing_account_id, charge_type, cost_category, cost_subcategory, provider, region, resource_id, service, tagged, tag:<tag_value>. If providing multiple groupings, join as comma separated values: groupings=provider,service,region

filter
string

The filter query language to apply to the CostReport. Additional documentation available at https://docs.vantage.sh/vql.

saved_filter_tokens
string[]

The tokens of the SavedFilters to apply to the CostReport.

business_metric_tokens_with_metadata
object[]

The tokens for any BusinessMetrics to attach to the CostReport, and the unit scale.

folder_token
string

The token of the Folder to add the CostReport to. Determines the Workspace the report is assigned to.

default_forecast
object

The default forecast selection for the CostReport.

settings
object

Report settings.

chart_settings
object

Report chart settings.

previous_period_start_date
string

The previous period start date of the CostReport. ISO 8601 Formatted.

previous_period_end_date
string

The previous period end date of the CostReport. ISO 8601 Formatted. Required when previous_period_start_date is provided.

start_date
string

The start date of the CostReport. ISO 8601 Formatted. Incompatible with 'date_interval' parameter.

end_date
string

The end date of the CostReport. ISO 8601 Formatted. Required when start_date is provided. Incompatible with 'date_interval' parameter.

date_interval
enum<string>

The date interval of the CostReport. Incompatible with 'start_date' and 'end_date' parameters. Defaults to 'this_month' if start_date and end_date are not provided.

Available options:
this_month,
last_7_days,
last_30_days,
last_month,
last_3_months,
last_6_months,
custom,
last_12_months,
last_24_months,
last_36_months,
next_month,
next_3_months,
next_6_months,
next_12_months,
year_to_date,
last_3_days,
last_14_days
chart_type
enum<string>

The chart type of the CostReport.

Available options:
area,
line,
pie,
bar,
multi_bar
date_bin
enum<string>

The date bin of the CostReport.

Available options:
cumulative,
day,
week,
month,
quarter,
hour

Response

CostReport model

token
string
required
title
string
required

The title of the CostReport.

Example:

"Production Environment"

business_metric_tokens_with_metadata
object[]
required

The tokens for the BusinessMetrics assigned to the CostReport, the unit scale, and label filter.

default_forecast
object
required

The default forecast selection for the CostReport.

Example:
{ "kind": "baseline" }
filter
string | null
required

The filter applied to the CostReport. Additional documentation available at https://docs.vantage.sh/vql.

created_at
string
required

The date and time, in UTC, the report was created. ISO 8601 Formatted.

Example:

"2021-07-09T00:00:00Z"

workspace_token
string
required

The token for the Workspace the CostReport is a part of.

date_interval
string
required

The date interval of the CostReport.

chart_type
string
required

The chart type of the CostReport.

date_bin
string
required

The date bin of the CostReport.

chart_settings
object
required
folder_token
string | null

The token for the Folder the CostReport is a part of.

saved_filter_tokens
string[] | null

The tokens for the SavedFilters assigned to the CostReport.

groupings
string | null

The grouping aggregations applied to the filtered data.

Example:

"provider, service"

settings
object

Report settings.

previous_period_start_date
string | null

The previous period start date of the CostReport. ISO 8601 Formatted.

Example:

"2024-06-01"

previous_period_end_date
string | null

The previous period end date of the CostReport. ISO 8601 Formatted.

Example:

"2024-06-15"

start_date
string | null

The start date of the CostReports. ISO 8601 Formatted. Overwrites 'date_interval' if set.

Example:

"2024-07-01"

end_date
string | null

The end date of the CostReports. ISO 8601 Formatted. Overwrites 'date_interval' if set.

Example:

"2024-07-15"