Skip to main content
POST
/
cost_reports
Create cost report
curl --request POST \
  --url https://api.vantage.sh/v2/cost_reports \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "<string>",
  "previous_period_end_date": "<string>",
  "end_date": "<string>",
  "workspace_token": "<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": false,
    "include_refunds": false,
    "include_discounts": true,
    "include_tax": true,
    "amortize": true,
    "unallocated": false,
    "aggregate_by": "cost",
    "show_previous_period": true
  },
  "previous_period_start_date": "<string>",
  "start_date": "<string>",
  "date_interval": "this_month",
  "chart_type": "line",
  "date_bin": "cumulative",
  "chart_settings": {
    "x_axis_dimension": [
      "<string>"
    ],
    "y_axis_dimension": "<string>"
  }
}
'
{
  "token": "rprt_377f6f8b25e8053d",
  "title": "New Cost Report",
  "folder_token": "fldr_f20201244e42cb99",
  "saved_filter_tokens": [
    "svd_fltr_550e30f350ffafe4"
  ],
  "business_metric_tokens_with_metadata": [
    {
      "business_metric_token": "bsnss_mtrc_ff259eb1ce9fe935",
      "unit_scale": "per_thousand",
      "label_filter": [
        "CBGB",
        "Roxy",
        "Studio 54",
        ""
      ]
    }
  ],
  "filter": "costs.provider = 'aws' AND costs.service = 'Amazon Simple Storage Service'",
  "groupings": "service,provider",
  "settings": {
    "include_credits": false,
    "include_refunds": false,
    "include_discounts": true,
    "include_tax": true,
    "amortize": true,
    "unallocated": false,
    "aggregate_by": "cost",
    "show_previous_period": true
  },
  "created_at": "2024-07-03T00:00:00Z",
  "workspace_token": "wrkspc_d364d177f557981e",
  "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": "bar",
  "date_bin": "day",
  "chart_settings": {
    "y_axis_dimension": "cost",
    "x_axis_dimension": [
      "date"
    ]
  }
}

Authorizations

Authorization
string
header
required

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

Body

application/json

Create a CostReport.

title
string
required

The title of the CostReport.

previous_period_end_date
string
required

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

end_date
string
required

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

workspace_token
string

The token of the Workspace to add the Cost Report to. Ignored if 'folder_token' is set. Required if the API token is associated with multiple Workspaces.

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.

settings
object

Report settings.

previous_period_start_date
string

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

start_date
string

The start date of the CostReport. ISO 8601 Formatted. 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>
default:line

The chart type of the CostReport.

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

The date bin of the CostReport.

Available options:
cumulative,
day,
week,
month,
quarter
chart_settings
object

Report chart settings.

Response

CostReport model

token
string
title
string

The title of the CostReport.

Example:

"Production Environment"

folder_token
string

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

saved_filter_tokens
string[]

The tokens for the SavedFilters assigned to the CostReport.

business_metric_tokens_with_metadata
object[]

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

filter
string

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

groupings
string

The grouping aggregations applied to the filtered data.

Example:

"provider, service"

settings
object

Report settings.

created_at
string

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

Example:

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

workspace_token
string

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

previous_period_start_date
string

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

Example:

"2024-06-01"

previous_period_end_date
string

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

Example:

"2024-06-15"

start_date
string

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

Example:

"2024-07-01"

end_date
string

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

Example:

"2024-07-15"

date_interval
string

The date interval of the CostReport.

chart_type
string

The chart type of the CostReport.

date_bin
string

The date bin of the CostReport.

chart_settings
object