import requests
url = "https://app.langwatch.ai/api/gateway/v1/budgets"
headers = {"X-Auth-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Auth-Token': '<api-key>'}};
fetch('https://app.langwatch.ai/api/gateway/v1/budgets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.langwatch.ai/api/gateway/v1/budgets \
--header 'X-Auth-Token: <api-key>'{
"data": [
{
"id": "<string>",
"organization_id": "<string>",
"scope_type": "organization",
"scope_id": "<string>",
"name": "<string>",
"description": "<string>",
"window": "minute",
"on_breach": "block",
"limit_usd": "<string>",
"limit_nano_usd": 123,
"spent_usd": "<string>",
"spent_nano_usd": 123,
"timezone": "<string>",
"provider_key": "<string>",
"external_id": "<string>",
"metadata": {},
"current_period_started_at": "<string>",
"resets_at": "<string>",
"cycle_anchor_at": "<string>",
"last_reset_at": "<string>",
"archived_at": "<string>",
"created_at": "<string>",
"member_count": 123,
"end_users_seen": 123,
"end_users_over": 123,
"scope_reach": "reachable"
}
],
"spend_available": true,
"next_cursor": "<string>"
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}List budgets applicable to the project
Returns the non-archived budgets in the caller’s organization across all seven scope types (organization / team / project / virtual_key / principal / group / attributed_user), with live spent_usd from the spend ledger. Newest first, paged by cursor: follow next_cursor until it comes back null. Filter with scope_type (comma-separated), which is applied in the query, so limit counts rows returned. group rows are per-member allowances: limit_usd is what EACH member may spend, while spent_usd is the group’s summed spend, and member_count says how many members the allowance currently covers. attributed_user rows are per-person templates: limit_usd is what EACH end user may spend, end_users_seen counts the end users with spend this period, and end_users_over how many of them are at or over that limit. A template’s own spent_usd and spent_nano_usd are null because one allowance per person has no single total to report; each person’s figure is in GET /spend-summaries and the seat buckets. spend_available: false means spend could not be totalled at all, and both fields are null for that reason instead, rather than a stale figure a caller could read as real money. Every amount is published twice: _usd is the display string, _nano_usd is the canonical integer in the same nano-USD unit the spend events carry, so a budget and its spend reconcile without parsing decimals.
import requests
url = "https://app.langwatch.ai/api/gateway/v1/budgets"
headers = {"X-Auth-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Auth-Token': '<api-key>'}};
fetch('https://app.langwatch.ai/api/gateway/v1/budgets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.langwatch.ai/api/gateway/v1/budgets \
--header 'X-Auth-Token: <api-key>'{
"data": [
{
"id": "<string>",
"organization_id": "<string>",
"scope_type": "organization",
"scope_id": "<string>",
"name": "<string>",
"description": "<string>",
"window": "minute",
"on_breach": "block",
"limit_usd": "<string>",
"limit_nano_usd": 123,
"spent_usd": "<string>",
"spent_nano_usd": 123,
"timezone": "<string>",
"provider_key": "<string>",
"external_id": "<string>",
"metadata": {},
"current_period_started_at": "<string>",
"resets_at": "<string>",
"cycle_anchor_at": "<string>",
"last_reset_at": "<string>",
"archived_at": "<string>",
"created_at": "<string>",
"member_count": 123,
"end_users_seen": 123,
"end_users_over": 123,
"scope_reach": "reachable"
}
],
"spend_available": true,
"next_cursor": "<string>"
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"meta": {},
"trace_id": "<string>",
"span_id": "<string>"
}
}Authorizations
Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.
Query Parameters
500x <= 200Comma-separated subset of the scope types, lowercase, e.g. virtual_key,principal.
Exact match on the resource's external_id.
128Was this page helpful?