Create a Budget
curl --request POST \
--url https://api.checkfu.com/v1/budgets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'checkfu-version: <checkfu-version>' \
--data '
{
"scope": {
"kind": "workspace",
"agent_id": "<unknown>",
"principal_id": "<unknown>",
"collaboration_space_id": "<unknown>",
"automation_id": "<unknown>",
"session_id": "<unknown>"
},
"window": {
"kind": "rolling",
"duration_seconds": 123
},
"hard_threshold": {
"limit": 123
},
"soft_threshold": {
"limit": 123,
"action": "notify"
}
}
'import requests
url = "https://api.checkfu.com/v1/budgets"
payload = {
"scope": {
"kind": "workspace",
"agent_id": "<unknown>",
"principal_id": "<unknown>",
"collaboration_space_id": "<unknown>",
"automation_id": "<unknown>",
"session_id": "<unknown>"
},
"window": {
"kind": "rolling",
"duration_seconds": 123
},
"hard_threshold": { "limit": 123 },
"soft_threshold": {
"limit": 123,
"action": "notify"
}
}
headers = {
"checkfu-version": "<checkfu-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'checkfu-version': '<checkfu-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
scope: {
kind: 'workspace',
agent_id: '<unknown>',
principal_id: '<unknown>',
collaboration_space_id: '<unknown>',
automation_id: '<unknown>',
session_id: '<unknown>'
},
window: {kind: 'rolling', duration_seconds: 123},
hard_threshold: {limit: 123},
soft_threshold: {limit: 123, action: 'notify'}
})
};
fetch('https://api.checkfu.com/v1/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.checkfu.com/v1/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([
'scope' => [
'kind' => 'workspace',
'agent_id' => '<unknown>',
'principal_id' => '<unknown>',
'collaboration_space_id' => '<unknown>',
'automation_id' => '<unknown>',
'session_id' => '<unknown>'
],
'window' => [
'kind' => 'rolling',
'duration_seconds' => 123
],
'hard_threshold' => [
'limit' => 123
],
'soft_threshold' => [
'limit' => 123,
'action' => 'notify'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"checkfu-version: <checkfu-version>"
],
]);
$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.checkfu.com/v1/budgets"
payload := strings.NewReader("{\n \"scope\": {\n \"kind\": \"workspace\",\n \"agent_id\": \"<unknown>\",\n \"principal_id\": \"<unknown>\",\n \"collaboration_space_id\": \"<unknown>\",\n \"automation_id\": \"<unknown>\",\n \"session_id\": \"<unknown>\"\n },\n \"window\": {\n \"kind\": \"rolling\",\n \"duration_seconds\": 123\n },\n \"hard_threshold\": {\n \"limit\": 123\n },\n \"soft_threshold\": {\n \"limit\": 123,\n \"action\": \"notify\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("checkfu-version", "<checkfu-version>")
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.checkfu.com/v1/budgets")
.header("checkfu-version", "<checkfu-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scope\": {\n \"kind\": \"workspace\",\n \"agent_id\": \"<unknown>\",\n \"principal_id\": \"<unknown>\",\n \"collaboration_space_id\": \"<unknown>\",\n \"automation_id\": \"<unknown>\",\n \"session_id\": \"<unknown>\"\n },\n \"window\": {\n \"kind\": \"rolling\",\n \"duration_seconds\": 123\n },\n \"hard_threshold\": {\n \"limit\": 123\n },\n \"soft_threshold\": {\n \"limit\": 123,\n \"action\": \"notify\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.checkfu.com/v1/budgets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["checkfu-version"] = '<checkfu-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scope\": {\n \"kind\": \"workspace\",\n \"agent_id\": \"<unknown>\",\n \"principal_id\": \"<unknown>\",\n \"collaboration_space_id\": \"<unknown>\",\n \"automation_id\": \"<unknown>\",\n \"session_id\": \"<unknown>\"\n },\n \"window\": {\n \"kind\": \"rolling\",\n \"duration_seconds\": 123\n },\n \"hard_threshold\": {\n \"limit\": 123\n },\n \"soft_threshold\": {\n \"limit\": 123,\n \"action\": \"notify\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"workspace_id": "<string>",
"scope": {
"kind": "workspace",
"agent_id": "<unknown>",
"principal_id": "<unknown>",
"collaboration_space_id": "<unknown>",
"automation_id": "<unknown>",
"session_id": "<unknown>"
},
"metric": "model_tokens",
"window": {
"kind": "rolling",
"duration_seconds": 123
},
"soft_threshold": {
"limit": 123,
"action": "notify"
},
"hard_threshold": {
"limit": 123,
"breach_action": "block_admission"
},
"state": "active",
"version": 123,
"created_at": "<string>",
"updated_at": "<string>"
}{
"error": {
"type": "validation.malformed",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#validation-malformed"
}
}{
"error": {
"type": "auth.invalid_key",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#auth-invalid-key"
}
}{
"error": {
"type": "auth.disabled_tenancy",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#auth-disabled-tenancy"
}
}{
"error": {
"type": "validation.not_found",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#validation-not-found"
}
}{
"error": {
"type": "validation.conflict",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#validation-conflict"
}
}{
"error": {
"type": "budget.exceeded",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#budget-exceeded"
}
}{
"error": {
"type": "runtime.internal",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#runtime-internal"
}
}Create a Budget
Creates a live guard over the UsageLedger with an immutable scope (workspace, agent_definition, principal, collaboration_space, automation, session, or…
POST
/
v1
/
budgets
Create a Budget
curl --request POST \
--url https://api.checkfu.com/v1/budgets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'checkfu-version: <checkfu-version>' \
--data '
{
"scope": {
"kind": "workspace",
"agent_id": "<unknown>",
"principal_id": "<unknown>",
"collaboration_space_id": "<unknown>",
"automation_id": "<unknown>",
"session_id": "<unknown>"
},
"window": {
"kind": "rolling",
"duration_seconds": 123
},
"hard_threshold": {
"limit": 123
},
"soft_threshold": {
"limit": 123,
"action": "notify"
}
}
'import requests
url = "https://api.checkfu.com/v1/budgets"
payload = {
"scope": {
"kind": "workspace",
"agent_id": "<unknown>",
"principal_id": "<unknown>",
"collaboration_space_id": "<unknown>",
"automation_id": "<unknown>",
"session_id": "<unknown>"
},
"window": {
"kind": "rolling",
"duration_seconds": 123
},
"hard_threshold": { "limit": 123 },
"soft_threshold": {
"limit": 123,
"action": "notify"
}
}
headers = {
"checkfu-version": "<checkfu-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'checkfu-version': '<checkfu-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
scope: {
kind: 'workspace',
agent_id: '<unknown>',
principal_id: '<unknown>',
collaboration_space_id: '<unknown>',
automation_id: '<unknown>',
session_id: '<unknown>'
},
window: {kind: 'rolling', duration_seconds: 123},
hard_threshold: {limit: 123},
soft_threshold: {limit: 123, action: 'notify'}
})
};
fetch('https://api.checkfu.com/v1/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.checkfu.com/v1/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([
'scope' => [
'kind' => 'workspace',
'agent_id' => '<unknown>',
'principal_id' => '<unknown>',
'collaboration_space_id' => '<unknown>',
'automation_id' => '<unknown>',
'session_id' => '<unknown>'
],
'window' => [
'kind' => 'rolling',
'duration_seconds' => 123
],
'hard_threshold' => [
'limit' => 123
],
'soft_threshold' => [
'limit' => 123,
'action' => 'notify'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"checkfu-version: <checkfu-version>"
],
]);
$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.checkfu.com/v1/budgets"
payload := strings.NewReader("{\n \"scope\": {\n \"kind\": \"workspace\",\n \"agent_id\": \"<unknown>\",\n \"principal_id\": \"<unknown>\",\n \"collaboration_space_id\": \"<unknown>\",\n \"automation_id\": \"<unknown>\",\n \"session_id\": \"<unknown>\"\n },\n \"window\": {\n \"kind\": \"rolling\",\n \"duration_seconds\": 123\n },\n \"hard_threshold\": {\n \"limit\": 123\n },\n \"soft_threshold\": {\n \"limit\": 123,\n \"action\": \"notify\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("checkfu-version", "<checkfu-version>")
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.checkfu.com/v1/budgets")
.header("checkfu-version", "<checkfu-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scope\": {\n \"kind\": \"workspace\",\n \"agent_id\": \"<unknown>\",\n \"principal_id\": \"<unknown>\",\n \"collaboration_space_id\": \"<unknown>\",\n \"automation_id\": \"<unknown>\",\n \"session_id\": \"<unknown>\"\n },\n \"window\": {\n \"kind\": \"rolling\",\n \"duration_seconds\": 123\n },\n \"hard_threshold\": {\n \"limit\": 123\n },\n \"soft_threshold\": {\n \"limit\": 123,\n \"action\": \"notify\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.checkfu.com/v1/budgets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["checkfu-version"] = '<checkfu-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scope\": {\n \"kind\": \"workspace\",\n \"agent_id\": \"<unknown>\",\n \"principal_id\": \"<unknown>\",\n \"collaboration_space_id\": \"<unknown>\",\n \"automation_id\": \"<unknown>\",\n \"session_id\": \"<unknown>\"\n },\n \"window\": {\n \"kind\": \"rolling\",\n \"duration_seconds\": 123\n },\n \"hard_threshold\": {\n \"limit\": 123\n },\n \"soft_threshold\": {\n \"limit\": 123,\n \"action\": \"notify\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"workspace_id": "<string>",
"scope": {
"kind": "workspace",
"agent_id": "<unknown>",
"principal_id": "<unknown>",
"collaboration_space_id": "<unknown>",
"automation_id": "<unknown>",
"session_id": "<unknown>"
},
"metric": "model_tokens",
"window": {
"kind": "rolling",
"duration_seconds": 123
},
"soft_threshold": {
"limit": 123,
"action": "notify"
},
"hard_threshold": {
"limit": 123,
"breach_action": "block_admission"
},
"state": "active",
"version": 123,
"created_at": "<string>",
"updated_at": "<string>"
}{
"error": {
"type": "validation.malformed",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#validation-malformed"
}
}{
"error": {
"type": "auth.invalid_key",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#auth-invalid-key"
}
}{
"error": {
"type": "auth.disabled_tenancy",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#auth-disabled-tenancy"
}
}{
"error": {
"type": "validation.not_found",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#validation-not-found"
}
}{
"error": {
"type": "validation.conflict",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#validation-conflict"
}
}{
"error": {
"type": "budget.exceeded",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#budget-exceeded"
}
}{
"error": {
"type": "runtime.internal",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#runtime-internal"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Available options:
2026-08-31 Maximum string length:
255Body
application/json
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
Show child attributes
Show child attributes
Available options:
model_tokens, model_spend, session_runtime_ms, web_search_requests, total_spend - Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
a session_lifetime window only on a session-scoped Budget
Pattern:
^bgt_[0-9a-f]{32}$Pattern:
^wrkspc_[0-9a-f]{32}$- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
Show child attributes
Show child attributes
Available options:
model_tokens, model_spend, session_runtime_ms, web_search_requests, total_spend - Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
active, paused