curl --request POST \
--url https://api-v2.requesty.ai/v1/manage/budget \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entity_type": "BUDGET_ENTITY_TYPE_GROUP",
"group_id": "123e4567-e89b-12d3-a456-426614174000",
"frequency": "BUDGET_FREQUENCY_MONTHLY",
"amount": 500
}
'import requests
url = "https://api-v2.requesty.ai/v1/manage/budget"
payload = {
"entity_type": "BUDGET_ENTITY_TYPE_GROUP",
"group_id": "123e4567-e89b-12d3-a456-426614174000",
"frequency": "BUDGET_FREQUENCY_MONTHLY",
"amount": 500
}
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({
entity_type: 'BUDGET_ENTITY_TYPE_GROUP',
group_id: '123e4567-e89b-12d3-a456-426614174000',
frequency: 'BUDGET_FREQUENCY_MONTHLY',
amount: 500
})
};
fetch('https://api-v2.requesty.ai/v1/manage/budget', 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-v2.requesty.ai/v1/manage/budget",
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([
'entity_type' => 'BUDGET_ENTITY_TYPE_GROUP',
'group_id' => '123e4567-e89b-12d3-a456-426614174000',
'frequency' => 'BUDGET_FREQUENCY_MONTHLY',
'amount' => 500
]),
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-v2.requesty.ai/v1/manage/budget"
payload := strings.NewReader("{\n \"entity_type\": \"BUDGET_ENTITY_TYPE_GROUP\",\n \"group_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"frequency\": \"BUDGET_FREQUENCY_MONTHLY\",\n \"amount\": 500\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-v2.requesty.ai/v1/manage/budget")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entity_type\": \"BUDGET_ENTITY_TYPE_GROUP\",\n \"group_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"frequency\": \"BUDGET_FREQUENCY_MONTHLY\",\n \"amount\": 500\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-v2.requesty.ai/v1/manage/budget")
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 \"entity_type\": \"BUDGET_ENTITY_TYPE_GROUP\",\n \"group_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"frequency\": \"BUDGET_FREQUENCY_MONTHLY\",\n \"amount\": 500\n}"
response = http.request(request)
puts response.read_body{
"budget_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}Create Budget
Create a budget on an organization, group, member, service account or API key. Set entity_type and the IDs that type needs. An entity can have one budget per frequency. Requires an API key with write manage permissions.
curl --request POST \
--url https://api-v2.requesty.ai/v1/manage/budget \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entity_type": "BUDGET_ENTITY_TYPE_GROUP",
"group_id": "123e4567-e89b-12d3-a456-426614174000",
"frequency": "BUDGET_FREQUENCY_MONTHLY",
"amount": 500
}
'import requests
url = "https://api-v2.requesty.ai/v1/manage/budget"
payload = {
"entity_type": "BUDGET_ENTITY_TYPE_GROUP",
"group_id": "123e4567-e89b-12d3-a456-426614174000",
"frequency": "BUDGET_FREQUENCY_MONTHLY",
"amount": 500
}
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({
entity_type: 'BUDGET_ENTITY_TYPE_GROUP',
group_id: '123e4567-e89b-12d3-a456-426614174000',
frequency: 'BUDGET_FREQUENCY_MONTHLY',
amount: 500
})
};
fetch('https://api-v2.requesty.ai/v1/manage/budget', 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-v2.requesty.ai/v1/manage/budget",
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([
'entity_type' => 'BUDGET_ENTITY_TYPE_GROUP',
'group_id' => '123e4567-e89b-12d3-a456-426614174000',
'frequency' => 'BUDGET_FREQUENCY_MONTHLY',
'amount' => 500
]),
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-v2.requesty.ai/v1/manage/budget"
payload := strings.NewReader("{\n \"entity_type\": \"BUDGET_ENTITY_TYPE_GROUP\",\n \"group_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"frequency\": \"BUDGET_FREQUENCY_MONTHLY\",\n \"amount\": 500\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-v2.requesty.ai/v1/manage/budget")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entity_type\": \"BUDGET_ENTITY_TYPE_GROUP\",\n \"group_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"frequency\": \"BUDGET_FREQUENCY_MONTHLY\",\n \"amount\": 500\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-v2.requesty.ai/v1/manage/budget")
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 \"entity_type\": \"BUDGET_ENTITY_TYPE_GROUP\",\n \"group_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"frequency\": \"BUDGET_FREQUENCY_MONTHLY\",\n \"amount\": 500\n}"
response = http.request(request)
puts response.read_body{
"budget_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}entity_type and the IDs that entity type needs; any other ID returns 400.
entity_type | Required IDs |
|---|---|
BUDGET_ENTITY_TYPE_ORGANIZATION | None |
BUDGET_ENTITY_TYPE_ORGANIZATION_PER_MEMBER | None |
BUDGET_ENTITY_TYPE_ORGANIZATION_MEMBER | user_id |
BUDGET_ENTITY_TYPE_GROUP | group_id |
BUDGET_ENTITY_TYPE_GROUP_PER_MEMBER | group_id |
BUDGET_ENTITY_TYPE_GROUP_MEMBER | group_id, user_id |
BUDGET_ENTITY_TYPE_SERVICE_ACCOUNT | service_account_id |
BUDGET_ENTITY_TYPE_API_KEY | api_key_id |
frequency is one of BUDGET_FREQUENCY_DAILY, BUDGET_FREQUENCY_WEEKLY, BUDGET_FREQUENCY_MONTHLY, BUDGET_FREQUENCY_QUARTERLY or BUDGET_FREQUENCY_FOREVER. amount is in USD, and 0 means no limit. An entity can have one budget per frequency, so creating a second one with the same frequency returns 409. To change a budget, use Update Budget Amount.
Returns 201 with the new budget_id.
403.Body
What a budget is set on. ORGANIZATION and GROUP limit the combined spend of everyone in them. ORGANIZATION_PER_MEMBER and GROUP_PER_MEMBER set the default limit for each member. ORGANIZATION_MEMBER and GROUP_MEMBER set one user's own limit, replacing the per-member default for that user. SERVICE_ACCOUNT and API_KEY limit one service account or API key.
BUDGET_ENTITY_TYPE_ORGANIZATION, BUDGET_ENTITY_TYPE_ORGANIZATION_PER_MEMBER, BUDGET_ENTITY_TYPE_ORGANIZATION_MEMBER, BUDGET_ENTITY_TYPE_GROUP, BUDGET_ENTITY_TYPE_GROUP_PER_MEMBER, BUDGET_ENTITY_TYPE_GROUP_MEMBER, BUDGET_ENTITY_TYPE_SERVICE_ACCOUNT, BUDGET_ENTITY_TYPE_API_KEY How often the budget resets, in UTC: every day, every week starting Monday, every calendar month, every calendar quarter, or never (FOREVER counts all spend).
BUDGET_FREQUENCY_DAILY, BUDGET_FREQUENCY_WEEKLY, BUDGET_FREQUENCY_MONTHLY, BUDGET_FREQUENCY_QUARTERLY, BUDGET_FREQUENCY_FOREVER Was this page helpful?