curl --request POST \
--url https://api.vantage.sh/v2/costs/data_exports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cost_report_token": "<string>",
"filter": "<string>",
"workspace_token": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"groupings": [
"<string>"
],
"schema": "vntg",
"settings": {
"include_credits": false,
"include_refunds": false,
"include_discounts": true,
"include_tax": true,
"amortize": true,
"unallocated": false,
"aggregate_by": "cost",
"show_previous_period": true
}
}
'import requests
url = "https://api.vantage.sh/v2/costs/data_exports"
payload = {
"cost_report_token": "<string>",
"filter": "<string>",
"workspace_token": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"groupings": ["<string>"],
"schema": "vntg",
"settings": {
"include_credits": False,
"include_refunds": False,
"include_discounts": True,
"include_tax": True,
"amortize": True,
"unallocated": False,
"aggregate_by": "cost",
"show_previous_period": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cost_report_token: '<string>',
filter: '<string>',
workspace_token: '<string>',
start_date: '<string>',
end_date: '<string>',
groupings: ['<string>'],
schema: 'vntg',
settings: {
include_credits: false,
include_refunds: false,
include_discounts: true,
include_tax: true,
amortize: true,
unallocated: false,
aggregate_by: 'cost',
show_previous_period: true
}
})
};
fetch('https://api.vantage.sh/v2/costs/data_exports', 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/costs/data_exports",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cost_report_token' => '<string>',
'filter' => '<string>',
'workspace_token' => '<string>',
'start_date' => '<string>',
'end_date' => '<string>',
'groupings' => [
'<string>'
],
'schema' => 'vntg',
'settings' => [
'include_credits' => false,
'include_refunds' => false,
'include_discounts' => true,
'include_tax' => true,
'amortize' => true,
'unallocated' => false,
'aggregate_by' => 'cost',
'show_previous_period' => true
]
]),
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/costs/data_exports"
payload := strings.NewReader("{\n \"cost_report_token\": \"<string>\",\n \"filter\": \"<string>\",\n \"workspace_token\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\",\n \"groupings\": [\n \"<string>\"\n ],\n \"schema\": \"vntg\",\n \"settings\": {\n \"include_credits\": false,\n \"include_refunds\": false,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true,\n \"unallocated\": false,\n \"aggregate_by\": \"cost\",\n \"show_previous_period\": true\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.vantage.sh/v2/costs/data_exports")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cost_report_token\": \"<string>\",\n \"filter\": \"<string>\",\n \"workspace_token\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\",\n \"groupings\": [\n \"<string>\"\n ],\n \"schema\": \"vntg\",\n \"settings\": {\n \"include_credits\": false,\n \"include_refunds\": false,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true,\n \"unallocated\": false,\n \"aggregate_by\": \"cost\",\n \"show_previous_period\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vantage.sh/v2/costs/data_exports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cost_report_token\": \"<string>\",\n \"filter\": \"<string>\",\n \"workspace_token\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\",\n \"groupings\": [\n \"<string>\"\n ],\n \"schema\": \"vntg\",\n \"settings\": {\n \"include_credits\": false,\n \"include_refunds\": false,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true,\n \"unallocated\": false,\n \"aggregate_by\": \"cost\",\n \"show_previous_period\": true\n }\n}"
response = http.request(request)
puts response.read_bodyThis response has no body data.{
"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>"
}
}Generate cost data export
Generate a DataExport of costs.
curl --request POST \
--url https://api.vantage.sh/v2/costs/data_exports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cost_report_token": "<string>",
"filter": "<string>",
"workspace_token": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"groupings": [
"<string>"
],
"schema": "vntg",
"settings": {
"include_credits": false,
"include_refunds": false,
"include_discounts": true,
"include_tax": true,
"amortize": true,
"unallocated": false,
"aggregate_by": "cost",
"show_previous_period": true
}
}
'import requests
url = "https://api.vantage.sh/v2/costs/data_exports"
payload = {
"cost_report_token": "<string>",
"filter": "<string>",
"workspace_token": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"groupings": ["<string>"],
"schema": "vntg",
"settings": {
"include_credits": False,
"include_refunds": False,
"include_discounts": True,
"include_tax": True,
"amortize": True,
"unallocated": False,
"aggregate_by": "cost",
"show_previous_period": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cost_report_token: '<string>',
filter: '<string>',
workspace_token: '<string>',
start_date: '<string>',
end_date: '<string>',
groupings: ['<string>'],
schema: 'vntg',
settings: {
include_credits: false,
include_refunds: false,
include_discounts: true,
include_tax: true,
amortize: true,
unallocated: false,
aggregate_by: 'cost',
show_previous_period: true
}
})
};
fetch('https://api.vantage.sh/v2/costs/data_exports', 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/costs/data_exports",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cost_report_token' => '<string>',
'filter' => '<string>',
'workspace_token' => '<string>',
'start_date' => '<string>',
'end_date' => '<string>',
'groupings' => [
'<string>'
],
'schema' => 'vntg',
'settings' => [
'include_credits' => false,
'include_refunds' => false,
'include_discounts' => true,
'include_tax' => true,
'amortize' => true,
'unallocated' => false,
'aggregate_by' => 'cost',
'show_previous_period' => true
]
]),
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/costs/data_exports"
payload := strings.NewReader("{\n \"cost_report_token\": \"<string>\",\n \"filter\": \"<string>\",\n \"workspace_token\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\",\n \"groupings\": [\n \"<string>\"\n ],\n \"schema\": \"vntg\",\n \"settings\": {\n \"include_credits\": false,\n \"include_refunds\": false,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true,\n \"unallocated\": false,\n \"aggregate_by\": \"cost\",\n \"show_previous_period\": true\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.vantage.sh/v2/costs/data_exports")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cost_report_token\": \"<string>\",\n \"filter\": \"<string>\",\n \"workspace_token\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\",\n \"groupings\": [\n \"<string>\"\n ],\n \"schema\": \"vntg\",\n \"settings\": {\n \"include_credits\": false,\n \"include_refunds\": false,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true,\n \"unallocated\": false,\n \"aggregate_by\": \"cost\",\n \"show_previous_period\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vantage.sh/v2/costs/data_exports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cost_report_token\": \"<string>\",\n \"filter\": \"<string>\",\n \"workspace_token\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\",\n \"groupings\": [\n \"<string>\"\n ],\n \"schema\": \"vntg\",\n \"settings\": {\n \"include_credits\": false,\n \"include_refunds\": false,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true,\n \"unallocated\": false,\n \"aggregate_by\": \"cost\",\n \"show_previous_period\": true\n }\n}"
response = http.request(request)
puts response.read_bodyThis response has no body data.{
"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
The access token received from the authorization server in the OAuth 2.0 flow.
Body
Generate a DataExport of costs.
The CostReport token.
The VQL filter to apply to the costs. If this is supplied you do not need cost_report_token.
The token of the Workspace to query costs from. Ignored if 'cost_report_token' is set. Required if the API token is associated with multiple Workspaces.
First date you would like to filter costs from. ISO 8601 formatted.
Last date you would like to filter costs to. ISO 8601 formatted.
Group the results by specific field(s). Defaults to provider, service, account_id. 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
The date bin of the costs. Defaults to the report's default or day.
day, week, month, quarter, hour The schema of the data export.
vntg, focus, comparison Cost-related settings.
Show child attributes
Show child attributes