Budgets
Update a budget
Replaces a budget’s settings. Thresholds already crossed this period are not alerted again.
PUT
/
api
/
v1
/
tenant
/
budgets
/
{id}
Update a budget
curl --request PUT \
--url https://api.costgraph.ai/api/v1/tenant/budgets/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>' \
--data '
{
"amount": 123,
"currency": "<string>",
"name": "<string>",
"filters": [
"<string>"
],
"forecastAlert": true,
"ownerUserIds": [
"<string>"
],
"thresholds": [
123
]
}
'import requests
url = "https://api.costgraph.ai/api/v1/tenant/budgets/{id}"
payload = {
"amount": 123,
"currency": "<string>",
"name": "<string>",
"filters": ["<string>"],
"forecastAlert": True,
"ownerUserIds": ["<string>"],
"thresholds": [123]
}
headers = {
"X-CostGraph-Tenant-ID": "<x-costgraph-tenant-id>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'X-CostGraph-Tenant-ID': '<x-costgraph-tenant-id>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 123,
currency: '<string>',
name: '<string>',
filters: ['<string>'],
forecastAlert: true,
ownerUserIds: ['<string>'],
thresholds: [123]
})
};
fetch('https://api.costgraph.ai/api/v1/tenant/budgets/{id}', 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.costgraph.ai/api/v1/tenant/budgets/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 123,
'currency' => '<string>',
'name' => '<string>',
'filters' => [
'<string>'
],
'forecastAlert' => true,
'ownerUserIds' => [
'<string>'
],
'thresholds' => [
123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>"
],
]);
$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.costgraph.ai/api/v1/tenant/budgets/{id}"
payload := strings.NewReader("{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"name\": \"<string>\",\n \"filters\": [\n \"<string>\"\n ],\n \"forecastAlert\": true,\n \"ownerUserIds\": [\n \"<string>\"\n ],\n \"thresholds\": [\n 123\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
req.Header.Add("Authorization", "<api-key>")
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.put("https://api.costgraph.ai/api/v1/tenant/budgets/{id}")
.header("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"name\": \"<string>\",\n \"filters\": [\n \"<string>\"\n ],\n \"forecastAlert\": true,\n \"ownerUserIds\": [\n \"<string>\"\n ],\n \"thresholds\": [\n 123\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/tenant/budgets/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-CostGraph-Tenant-ID"] = '<x-costgraph-tenant-id>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"name\": \"<string>\",\n \"filters\": [\n \"<string>\"\n ],\n \"forecastAlert\": true,\n \"ownerUserIds\": [\n \"<string>\"\n ],\n \"thresholds\": [\n 123\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"amount": 123,
"basis": "gross",
"createdAt": "<string>",
"currency": "<string>",
"evaluation": {
"actual": 123,
"excludedCurrencies": [
"<string>"
],
"forecast": {
"method": "regression",
"point": 123,
"reason": "<string>"
},
"pctUsed": 123,
"periodEnd": "<string>",
"periodStart": "<string>",
"status": "on_track"
},
"filters": [
"<string>"
],
"forecastAlert": true,
"id": "<string>",
"layer": "billed",
"name": "<string>",
"ownerUserIds": [
"<string>"
],
"period": "monthly",
"thresholds": [
123
],
"updatedAt": "<string>"
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}Authorizations
Enter "Bearer {token}"
Headers
Tenant ID
Path Parameters
Budget ID
Body
application/json
Budget
Maximum string length:
200Available options:
monthly, quarterly, annual Available options:
gross, net Maximum array length:
50Available options:
billed, allocation, ci Maximum array length:
50Maximum array length:
10Was this page helpful?
⌘I
Update a budget
curl --request PUT \
--url https://api.costgraph.ai/api/v1/tenant/budgets/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>' \
--data '
{
"amount": 123,
"currency": "<string>",
"name": "<string>",
"filters": [
"<string>"
],
"forecastAlert": true,
"ownerUserIds": [
"<string>"
],
"thresholds": [
123
]
}
'import requests
url = "https://api.costgraph.ai/api/v1/tenant/budgets/{id}"
payload = {
"amount": 123,
"currency": "<string>",
"name": "<string>",
"filters": ["<string>"],
"forecastAlert": True,
"ownerUserIds": ["<string>"],
"thresholds": [123]
}
headers = {
"X-CostGraph-Tenant-ID": "<x-costgraph-tenant-id>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'X-CostGraph-Tenant-ID': '<x-costgraph-tenant-id>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 123,
currency: '<string>',
name: '<string>',
filters: ['<string>'],
forecastAlert: true,
ownerUserIds: ['<string>'],
thresholds: [123]
})
};
fetch('https://api.costgraph.ai/api/v1/tenant/budgets/{id}', 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.costgraph.ai/api/v1/tenant/budgets/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 123,
'currency' => '<string>',
'name' => '<string>',
'filters' => [
'<string>'
],
'forecastAlert' => true,
'ownerUserIds' => [
'<string>'
],
'thresholds' => [
123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>"
],
]);
$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.costgraph.ai/api/v1/tenant/budgets/{id}"
payload := strings.NewReader("{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"name\": \"<string>\",\n \"filters\": [\n \"<string>\"\n ],\n \"forecastAlert\": true,\n \"ownerUserIds\": [\n \"<string>\"\n ],\n \"thresholds\": [\n 123\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
req.Header.Add("Authorization", "<api-key>")
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.put("https://api.costgraph.ai/api/v1/tenant/budgets/{id}")
.header("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"name\": \"<string>\",\n \"filters\": [\n \"<string>\"\n ],\n \"forecastAlert\": true,\n \"ownerUserIds\": [\n \"<string>\"\n ],\n \"thresholds\": [\n 123\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/tenant/budgets/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-CostGraph-Tenant-ID"] = '<x-costgraph-tenant-id>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"name\": \"<string>\",\n \"filters\": [\n \"<string>\"\n ],\n \"forecastAlert\": true,\n \"ownerUserIds\": [\n \"<string>\"\n ],\n \"thresholds\": [\n 123\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"amount": 123,
"basis": "gross",
"createdAt": "<string>",
"currency": "<string>",
"evaluation": {
"actual": 123,
"excludedCurrencies": [
"<string>"
],
"forecast": {
"method": "regression",
"point": 123,
"reason": "<string>"
},
"pctUsed": 123,
"periodEnd": "<string>",
"periodStart": "<string>",
"status": "on_track"
},
"filters": [
"<string>"
],
"forecastAlert": true,
"id": "<string>",
"layer": "billed",
"name": "<string>",
"ownerUserIds": [
"<string>"
],
"period": "monthly",
"thresholds": [
123
],
"updatedAt": "<string>"
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}