Overview
The budgets client manages per-grant spending budgets. Allocate budgets when issuing grants, debit as agents consume resources, check remaining balances, and review transaction history.
Access the budgets client via client.budgets.
Allocate
Allocate a spending budget for a grant. Threshold alerts are automatically triggered at 50% and 80% consumption.
AllocateBudgetParams
BudgetAllocation
Debit
Debit an amount from a grant’s budget. Uses atomic operations to prevent overdraft. Raises a GrantexApiError with status 402 and code INSUFFICIENT_BUDGET if the balance is insufficient.
DebitBudgetParams
DebitResponse
If the remaining budget is less than the debit amount, a GrantexApiError is raised with HTTP status 402 and code INSUFFICIENT_BUDGET. Debits are all-or-nothing — no partial debits.
Balance
Check the current budget balance for a grant.
Parameters
Response
Returns a BudgetAllocation — see above for field descriptions.
Transactions
List all transactions for a grant’s budget. Supports pagination.
Parameters
TransactionsResponse
BudgetTransaction
Example: Budget Lifecycle