Skip to main content
POST
/
business_metrics
Create business metric
curl --request POST \
  --url https://api.vantage.sh/v2/business_metrics \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "<string>",
  "cost_report_tokens_with_metadata": [
    {
      "cost_report_token": "<string>",
      "unit_scale": "per_unit",
      "label_filter": [
        "<string>"
      ]
    }
  ],
  "values": [
    {
      "date": "2023-11-07T05:31:56Z",
      "amount": 123,
      "label": "<string>"
    }
  ],
  "forecasted_values": [
    {
      "date": "2023-11-07T05:31:56Z",
      "amount": 123,
      "label": "<string>"
    }
  ],
  "datadog_metric_fields": {
    "integration_token": "<string>",
    "query": "<string>"
  },
  "cloudwatch_fields": {
    "integration_token": "<string>",
    "stat": "<string>",
    "region": "<string>",
    "namespace": "<string>",
    "metric_name": "<string>",
    "label_dimension": "<string>",
    "dimensions": [
      {
        "name": "<string>",
        "value": "<string>"
      }
    ]
  },
  "snowflake_metric_fields": {
    "integration_token": "<string>",
    "sql_query": "<string>"
  }
}
'
import requests

url = "https://api.vantage.sh/v2/business_metrics"

payload = {
"title": "<string>",
"cost_report_tokens_with_metadata": [
{
"cost_report_token": "<string>",
"unit_scale": "per_unit",
"label_filter": ["<string>"]
}
],
"values": [
{
"date": "2023-11-07T05:31:56Z",
"amount": 123,
"label": "<string>"
}
],
"forecasted_values": [
{
"date": "2023-11-07T05:31:56Z",
"amount": 123,
"label": "<string>"
}
],
"datadog_metric_fields": {
"integration_token": "<string>",
"query": "<string>"
},
"cloudwatch_fields": {
"integration_token": "<string>",
"stat": "<string>",
"region": "<string>",
"namespace": "<string>",
"metric_name": "<string>",
"label_dimension": "<string>",
"dimensions": [
{
"name": "<string>",
"value": "<string>"
}
]
},
"snowflake_metric_fields": {
"integration_token": "<string>",
"sql_query": "<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({
title: '<string>',
cost_report_tokens_with_metadata: [
{
cost_report_token: '<string>',
unit_scale: 'per_unit',
label_filter: ['<string>']
}
],
values: [{date: '2023-11-07T05:31:56Z', amount: 123, label: '<string>'}],
forecasted_values: [{date: '2023-11-07T05:31:56Z', amount: 123, label: '<string>'}],
datadog_metric_fields: {integration_token: '<string>', query: '<string>'},
cloudwatch_fields: {
integration_token: '<string>',
stat: '<string>',
region: '<string>',
namespace: '<string>',
metric_name: '<string>',
label_dimension: '<string>',
dimensions: [{name: '<string>', value: '<string>'}]
},
snowflake_metric_fields: {integration_token: '<string>', sql_query: '<string>'}
})
};

fetch('https://api.vantage.sh/v2/business_metrics', 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/business_metrics",
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([
'title' => '<string>',
'cost_report_tokens_with_metadata' => [
[
'cost_report_token' => '<string>',
'unit_scale' => 'per_unit',
'label_filter' => [
'<string>'
]
]
],
'values' => [
[
'date' => '2023-11-07T05:31:56Z',
'amount' => 123,
'label' => '<string>'
]
],
'forecasted_values' => [
[
'date' => '2023-11-07T05:31:56Z',
'amount' => 123,
'label' => '<string>'
]
],
'datadog_metric_fields' => [
'integration_token' => '<string>',
'query' => '<string>'
],
'cloudwatch_fields' => [
'integration_token' => '<string>',
'stat' => '<string>',
'region' => '<string>',
'namespace' => '<string>',
'metric_name' => '<string>',
'label_dimension' => '<string>',
'dimensions' => [
[
'name' => '<string>',
'value' => '<string>'
]
]
],
'snowflake_metric_fields' => [
'integration_token' => '<string>',
'sql_query' => '<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/business_metrics"

payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"cost_report_tokens_with_metadata\": [\n {\n \"cost_report_token\": \"<string>\",\n \"unit_scale\": \"per_unit\",\n \"label_filter\": [\n \"<string>\"\n ]\n }\n ],\n \"values\": [\n {\n \"date\": \"2023-11-07T05:31:56Z\",\n \"amount\": 123,\n \"label\": \"<string>\"\n }\n ],\n \"forecasted_values\": [\n {\n \"date\": \"2023-11-07T05:31:56Z\",\n \"amount\": 123,\n \"label\": \"<string>\"\n }\n ],\n \"datadog_metric_fields\": {\n \"integration_token\": \"<string>\",\n \"query\": \"<string>\"\n },\n \"cloudwatch_fields\": {\n \"integration_token\": \"<string>\",\n \"stat\": \"<string>\",\n \"region\": \"<string>\",\n \"namespace\": \"<string>\",\n \"metric_name\": \"<string>\",\n \"label_dimension\": \"<string>\",\n \"dimensions\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n },\n \"snowflake_metric_fields\": {\n \"integration_token\": \"<string>\",\n \"sql_query\": \"<string>\"\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/business_metrics")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"cost_report_tokens_with_metadata\": [\n {\n \"cost_report_token\": \"<string>\",\n \"unit_scale\": \"per_unit\",\n \"label_filter\": [\n \"<string>\"\n ]\n }\n ],\n \"values\": [\n {\n \"date\": \"2023-11-07T05:31:56Z\",\n \"amount\": 123,\n \"label\": \"<string>\"\n }\n ],\n \"forecasted_values\": [\n {\n \"date\": \"2023-11-07T05:31:56Z\",\n \"amount\": 123,\n \"label\": \"<string>\"\n }\n ],\n \"datadog_metric_fields\": {\n \"integration_token\": \"<string>\",\n \"query\": \"<string>\"\n },\n \"cloudwatch_fields\": {\n \"integration_token\": \"<string>\",\n \"stat\": \"<string>\",\n \"region\": \"<string>\",\n \"namespace\": \"<string>\",\n \"metric_name\": \"<string>\",\n \"label_dimension\": \"<string>\",\n \"dimensions\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n },\n \"snowflake_metric_fields\": {\n \"integration_token\": \"<string>\",\n \"sql_query\": \"<string>\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.vantage.sh/v2/business_metrics")

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 \"title\": \"<string>\",\n \"cost_report_tokens_with_metadata\": [\n {\n \"cost_report_token\": \"<string>\",\n \"unit_scale\": \"per_unit\",\n \"label_filter\": [\n \"<string>\"\n ]\n }\n ],\n \"values\": [\n {\n \"date\": \"2023-11-07T05:31:56Z\",\n \"amount\": 123,\n \"label\": \"<string>\"\n }\n ],\n \"forecasted_values\": [\n {\n \"date\": \"2023-11-07T05:31:56Z\",\n \"amount\": 123,\n \"label\": \"<string>\"\n }\n ],\n \"datadog_metric_fields\": {\n \"integration_token\": \"<string>\",\n \"query\": \"<string>\"\n },\n \"cloudwatch_fields\": {\n \"integration_token\": \"<string>\",\n \"stat\": \"<string>\",\n \"region\": \"<string>\",\n \"namespace\": \"<string>\",\n \"metric_name\": \"<string>\",\n \"label_dimension\": \"<string>\",\n \"dimensions\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n },\n \"snowflake_metric_fields\": {\n \"integration_token\": \"<string>\",\n \"sql_query\": \"<string>\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "token": "bsnss_mtrc_e8d0a6f35c9f4e8c",
  "title": "New Biz Metric",
  "created_by_token": "usr_464e70f8e230fa62",
  "cost_report_tokens_with_metadata": [
    {
      "cost_report_token": "rprt_67a1e1ac3bb7cefd",
      "unit_scale": "per_thousand",
      "label_filter": [
        "Dev",
        "Prod",
        "Staging",
        ""
      ]
    }
  ],
  "import_type": "csv",
  "integration_token": ""
}
{
"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>"
}
}
{
"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.

Body

application/json

Create a new BusinessMetric.

title
string
required

The title of the BusinessMetrics.

cost_report_tokens_with_metadata
object[]

The tokens for any CostReports that use the BusinessMetric, the unit scale, and label filter.

values
object[]

The dates, amounts, and (optional) labels for the BusinessMetric.

forecasted_values
object[]

The dates, amounts, and (optional) labels for forecasted BusinessMetric values.

datadog_metric_fields
object

Datadog metric configuration fields

cloudwatch_fields
object

Cloudwatch configuration fields.

snowflake_metric_fields
object

Snowflake metric configuration fields.

Response

BusinessMetric model

token
string
required

The token of the BusinessMetric.

Example:

"bsnss_mtrc_1234"

title
string
required

The title of the BusinessMetric.

Example:

"Total Revenue"

cost_report_tokens_with_metadata
object[]
required

The tokens for any CostReports that use the BusinessMetric, the unit scale, and label filter.

import_type
enum<string> | null
required

The type of import for the BusinessMetric.

Available options:
datadog_metrics,
cloudwatch,
snowflake_metrics,
metronome_metrics,
csv
Example:

"datadog_metrics"

integration_token
string | null
required

The Integration token used to import the BusinessMetric.

created_by_token
string | null

The token of the Creator of the BusinessMetric.

Example:

"usr_1234"

cloudwatch_fields
object
datadog_metric_fields
object
snowflake_metric_fields
object