Skip to contentSkip to page list

Docs

List budgets applicable to the project

Returns the non-archived budgets in the caller's organization across all seven scope types, with live spent_usd from the spend ledger. Takes a project key or an organization key; requires gatewayBudgets:view at the key's project, or at the organization for a key that names no project.

GET/api/gateway/v1/budgets
Request and response examples
request.py
import osimport requests​origin = "https://app.langwatch.ai"path = "/api/gateway/v1/budgets"api_key = os.environ["LANGWATCH_API_KEY"]headers = {    "X-Auth-Token": api_key,}​response = requests.get(    origin + path,    headers=headers,)print(response.json())

Success

application/json · Generated from schema

{  "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": -9007199254740991,      "spent_usd": "string",      "spent_nano_usd": -9007199254740991,      "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": -9007199254740991,      "end_users_seen": -9007199254740991,      "end_users_over": -9007199254740991,      "scope_reach": "reachable"    }  ],  "spend_available": false,  "next_cursor": "string"}
api-reference/gateway-budgets/list-budgets-applicable-to-the-project

Authorization

X-Auth-Tokenstringheaderrequired

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

cursorstring
Up to 500 characters
limitinteger
Maximum 200
scope_typestring

Comma-separated subset of the scope types, lowercase.

external_idstring

Exact match on the resource's external_id.

Up to 128 characters

Responses

200

Success

application/json

dataobject[]required
idstringrequired
organization_idstringrequired
scope_typestringrequired
One of"organization""team""project""virtual_key""principal""group""attributed_user"
scope_idstringrequired
namestringrequired
descriptionstring | nullrequired
windowstringrequired
One of"minute""hour""day""week""month""total""manual"
on_breachstringrequired
One of"block""warn"
limit_usdstringrequired

Display value. Decimal string, up to 9 fractional digits, trailing zeros trimmed, never exponent notation. Use limit_nano_usd for arithmetic.

limit_nano_usdinteger | nullrequired
spent_usdstring | nullrequired
spent_nano_usdinteger | nullrequired
timezonestring | nullrequired
provider_keystring | nullrequired
external_idstring | nullrequired
metadataobjectrequired
current_period_started_atstringrequired
resets_atstringrequired
cycle_anchor_atstring | nullrequired
last_reset_atstring | nullrequired
archived_atstring | nullrequired
created_atstringrequired
member_countinteger
Minimum -9007199254740991Maximum 9007199254740991
end_users_seeninteger
Minimum -9007199254740991Maximum 9007199254740991
end_users_overinteger
Minimum -9007199254740991Maximum 9007199254740991
scope_reachstring
One of"reachable""unreachable"
spend_availablebooleanrequired
next_cursorstring | nullrequired

Pass back as cursor for the next page. Null means the walk is exhausted.

400

Bad Request

application/json

typestringrequired
codestringrequired
messagestringrequired
retryablebooleanrequired
metaobject
trace_idstring
span_idstring
traceobject
traceIdstring
spanIdstring
traceUrlstring
logsUrlstring
tipsstring[]
docs_urlstring
faultstring
One of"customer""platform""provider""presumed_platform"
reasonsany[]
401

Unauthorized

application/json

typestringrequired
codestringrequired
messagestringrequired
retryablebooleanrequired
metaobject
trace_idstring
span_idstring
traceobject
traceIdstring
spanIdstring
traceUrlstring
logsUrlstring
tipsstring[]
docs_urlstring
faultstring
One of"customer""platform""provider""presumed_platform"
reasonsany[]
403

Forbidden

application/json

typestringrequired
codestringrequired
messagestringrequired
retryablebooleanrequired
metaobject
trace_idstring
span_idstring
traceobject
traceIdstring
spanIdstring
traceUrlstring
logsUrlstring
tipsstring[]
docs_urlstring
faultstring
One of"customer""platform""provider""presumed_platform"
reasonsany[]
500

Internal Server Error

application/json

typestringrequired
codestringrequired
messagestringrequired
retryablebooleanrequired
metaobject
trace_idstring
span_idstring
traceobject
traceIdstring
spanIdstring
traceUrlstring
logsUrlstring
tipsstring[]
docs_urlstring
faultstring
One of"customer""platform""provider""presumed_platform"
reasonsany[]

Documentation