Skip to main content
POST
/
budgets
Create budget
curl --request POST \
  --url https://api.vantage.sh/v2/budgets \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "workspace_token": "<string>",
  "cost_report_token": "<string>",
  "child_budget_tokens": [
    "<string>"
  ],
  "periods": [
    {
      "start_at": "2023-12-25",
      "amount": 123,
      "end_at": "2023-12-25"
    }
  ]
}
'
import requests

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

payload = {
"name": "<string>",
"workspace_token": "<string>",
"cost_report_token": "<string>",
"child_budget_tokens": ["<string>"],
"periods": [
{
"start_at": "2023-12-25",
"amount": 123,
"end_at": "2023-12-25"
}
]
}
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({
name: '<string>',
workspace_token: '<string>',
cost_report_token: '<string>',
child_budget_tokens: ['<string>'],
periods: [{start_at: '2023-12-25', amount: 123, end_at: '2023-12-25'}]
})
};

fetch('https://api.vantage.sh/v2/budgets', 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/budgets",
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([
'name' => '<string>',
'workspace_token' => '<string>',
'cost_report_token' => '<string>',
'child_budget_tokens' => [
'<string>'
],
'periods' => [
[
'start_at' => '2023-12-25',
'amount' => 123,
'end_at' => '2023-12-25'
]
]
]),
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/budgets"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"workspace_token\": \"<string>\",\n \"cost_report_token\": \"<string>\",\n \"child_budget_tokens\": [\n \"<string>\"\n ],\n \"periods\": [\n {\n \"start_at\": \"2023-12-25\",\n \"amount\": 123,\n \"end_at\": \"2023-12-25\"\n }\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/budgets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"workspace_token\": \"<string>\",\n \"cost_report_token\": \"<string>\",\n \"child_budget_tokens\": [\n \"<string>\"\n ],\n \"periods\": [\n {\n \"start_at\": \"2023-12-25\",\n \"amount\": 123,\n \"end_at\": \"2023-12-25\"\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

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

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 \"name\": \"<string>\",\n \"workspace_token\": \"<string>\",\n \"cost_report_token\": \"<string>\",\n \"child_budget_tokens\": [\n \"<string>\"\n ],\n \"periods\": [\n {\n \"start_at\": \"2023-12-25\",\n \"amount\": 123,\n \"end_at\": \"2023-12-25\"\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "token": "bdgt_ea1eaec89d553e34",
  "name": "New Budget Name",
  "workspace_token": "wrkspc_b83e21368ee5fd9d",
  "user_token": null,
  "created_by_token": "team_aea2488160e90528",
  "cost_report_token": null,
  "created_at": "2024-07-11T20:22:52Z",
  "budget_alert_tokens": [],
  "periods": [
    {
      "start_at": "2024-01-01",
      "end_at": "2024-01-31",
      "amount": "100.0"
    },
    {
      "start_at": "2024-02-01",
      "end_at": "2024-02-29",
      "amount": "200.0"
    },
    {
      "start_at": "2024-03-01",
      "end_at": "2024-04-30",
      "amount": "300.0"
    }
  ],
  "performance": [
    {
      "date": "April, 2024",
      "actual": "0%",
      "amount": "300.0"
    },
    {
      "date": "March, 2024",
      "actual": "0%",
      "amount": "300.0"
    },
    {
      "date": "February, 2024",
      "actual": "0%",
      "amount": "200.0"
    },
    {
      "date": "January, 2024",
      "actual": "0%",
      "amount": "100.0"
    }
  ]
}
{
"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 Budget.

name
string
required

The name of the Budget.

workspace_token
string

The token of the Workspace to add the Budget to.

cost_report_token
string

The CostReport token. Ignored for hierarchical Budgets.

child_budget_tokens
string[]

The tokens of any child Budgets when creating a hierarchical Budget.

periods
object[]

The periods for the Budget. The start_at and end_at must be iso8601 formatted e.g. YYYY-MM-DD. Ignored for hierarchical Budgets.

Response

Budget model

token
string
required
name
string | null
required

The name of the Budget.

Example:

"Acme123 Budget"

workspace_token
string
required

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

created_at
string
required

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

Example:

"2024-03-19T00:00:00Z"

budget_alert_tokens
string[]
required

The tokens of the BudgetAlerts associated with the Budget.

child_budget_tokens
string[]
required

The tokens of the child Budgets associated with the hierarchical Budget.

periods
object[]
required

The budget periods associated with the Budget.

user_token
string | null

The token for the User who created this Budget.

created_by_token
string | null

The token of the Creator of the Budget.

cost_report_token
string | null

The token of the Report associated with the Budget.

performance
object[]

The historical performance of the Budget.