Generate data export of unit costs
curl --request POST \
--url https://api.vantage.sh/v2/unit_costs/data_exports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cost_report_token": "<string>",
"workspace_token": "<string>",
"start_date": "<string>",
"end_date": "<string>"
}
'import requests
url = "https://api.vantage.sh/v2/unit_costs/data_exports"
payload = {
"cost_report_token": "<string>",
"workspace_token": "<string>",
"start_date": "<string>",
"end_date": "<string>"
}
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>',
workspace_token: '<string>',
start_date: '<string>',
end_date: '<string>'
})
};
fetch('https://api.vantage.sh/v2/unit_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/unit_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>',
'workspace_token' => '<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/unit_costs/data_exports"
payload := strings.NewReader("{\n \"cost_report_token\": \"<string>\",\n \"workspace_token\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\"\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/unit_costs/data_exports")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cost_report_token\": \"<string>\",\n \"workspace_token\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vantage.sh/v2/unit_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 \"workspace_token\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"token": "dta_xprt_abcd1234567890",
"status": "pending",
"created_at": "2025-03-20T12:00:00Z",
"export_type": "cost_report",
"manifest": {
"files": [
""
],
"completed_at": "2025-03-20T12:00:00Z",
"valid_until": "2025-03-20T12:00:00Z"
},
"attributes": {}
}{
"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>"
}
}UnitCosts
Generate data export of unit costs
Generate a DataExport of unit costs.
POST
/
unit_costs
/
data_exports
Generate data export of unit costs
curl --request POST \
--url https://api.vantage.sh/v2/unit_costs/data_exports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cost_report_token": "<string>",
"workspace_token": "<string>",
"start_date": "<string>",
"end_date": "<string>"
}
'import requests
url = "https://api.vantage.sh/v2/unit_costs/data_exports"
payload = {
"cost_report_token": "<string>",
"workspace_token": "<string>",
"start_date": "<string>",
"end_date": "<string>"
}
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>',
workspace_token: '<string>',
start_date: '<string>',
end_date: '<string>'
})
};
fetch('https://api.vantage.sh/v2/unit_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/unit_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>',
'workspace_token' => '<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/unit_costs/data_exports"
payload := strings.NewReader("{\n \"cost_report_token\": \"<string>\",\n \"workspace_token\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\"\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/unit_costs/data_exports")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cost_report_token\": \"<string>\",\n \"workspace_token\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vantage.sh/v2/unit_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 \"workspace_token\": \"<string>\",\n \"start_date\": \"<string>\",\n \"end_date\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"token": "dta_xprt_abcd1234567890",
"status": "pending",
"created_at": "2025-03-20T12:00:00Z",
"export_type": "cost_report",
"manifest": {
"files": [
""
],
"completed_at": "2025-03-20T12:00:00Z",
"valid_until": "2025-03-20T12:00:00Z"
},
"attributes": {}
}{
"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
application/json
Generate a DataExport of unit costs.
The CostReport token.
The token of the Workspace to query costs from. Required if the API token is associated with multiple Workspaces.
First date you would like to filter unit costs from. Defaults to the report's default. ISO 8601 formatted.
Last date you would like to filter unit costs to. Defaults to the report's default. ISO 8601 formatted.
The date bin of the unit costs. Defaults to the report's default or day.
Available options:
day, week, month, quarter, hour Response
The data export has been queued and will be available at the location specified in the Location header.
⌘I