Xero: Retrieve a list of budgets
Xero accounting.getBudgets: arguments, response, policy and SDK examples.
← Accounting operations · Get started
Operation xero.getbudgets
Provider route: GET /api.xro/2.0/Budgets. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/xero with npm, or alter-sdk-xero with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { XeroIntegration } from "@alter-ai/xero";
async function execute(input: Parameters<XeroIntegration["accounting"]["getBudgets"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new XeroIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.accounting.getBudgets(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_xero import XeroIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = XeroIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.accounting.get_budgets(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
query | object | Optional | Additional keys: not allowed |
query.IDs | string | Optional | |
query.IDs[] | string | Each item | Format: uuid |
query.DateTo | string | Optional | Format: date |
query.DateFrom | string | Optional | Format: date |
headers | object | Required within parent | Additional keys: not allowed |
headers.xero-tenant-id | string | Required within parent |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Retrieve a list of budgets — response body |
Referenced models: Retrieve a list of budgets — response body
Schemas
Section titled “Schemas”Retrieve a list of budgets — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
Budgets | array | Optional | |
Budgets[] | Model | Each item | Expand Retrieve a list of budgets — response body — Budgets item |
Referenced models: Retrieve a list of budgets — response body — Budgets item
Retrieve a list of budgets — response body — Budgets item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
BudgetID | string | Optional | Xero identifier Format: uuid |
BudgetLines | array | Optional | |
BudgetLines[] | Model | Each item | Expand Retrieve a list of budgets — response body — Budgets item Budget Lines item |
Description | string | Optional | The Budget description Maximum length: 255 |
Tracking | array | Optional | |
Tracking[] | Model | Each item | Expand Create tracking categories — response body — Tracking Categories item |
Type | string | Optional | Type of Budget. OVERALL or TRACKING Known values: OVERALL, TRACKING |
UpdatedDateUTC | string | Optional | UTC timestamp of last update to budget Read only: true |
Referenced models: Retrieve a list of budgets — response body — Budgets item Budget Lines item, Create tracking categories — response body — Tracking Categories item
Retrieve a list of budgets — response body — Budgets item Budget Lines item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
AccountCode | string | Optional | See Accounts |
AccountID | string | Optional | See Accounts Format: uuid |
BudgetBalances | array | Optional | |
BudgetBalances[] | Model | Each item | Expand Retrieve a list of budgets — response body — Budgets item Budget Lines item Budget Balances item |
Referenced models: Retrieve a list of budgets — response body — Budgets item Budget Lines item Budget Balances item
Create tracking categories — response body — Tracking Categories item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
Name | string | Optional | The name of the tracking category e.g. Department, Region (max length = 100) Maximum length: 100 |
Option | string | Optional | The option name of the tracking option e.g. East, West (max length = 100) Maximum length: 100 |
Options | array | Optional | See Tracking Options |
Options[] | Model | Each item | Expand Creates options for a specific tracking category — response body — Options item |
Status | string | Optional | The status of a tracking category Known values: ACTIVE, ARCHIVED, DELETED |
TrackingCategoryID | string | Optional | The Xero identifier for a tracking category e.g. 297c2dc5-cc47-4afd-8ec8-74990b8761e9 Format: uuid |
TrackingOptionID | string | Optional | The Xero identifier for a tracking option e.g. dc54c220-0140-495a-b925-3246adc0075f Format: uuid |
Referenced models: Creates options for a specific tracking category — response body — Options item
Retrieve a list of budgets — response body — Budgets item Budget Lines item Budget Balances item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
Amount | JSON | Optional | |
Amount (anyOf 1) | number | Alternative | LineItem Quantity Format: double |
Amount (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Notes | string | Optional | Any footnotes associated with this balance Maximum length: 255 |
Period | string | Optional | Period the amount applies to (e.g. “2019-08”) |
UnitAmount | JSON | Optional | |
UnitAmount (anyOf 1) | number | Alternative | Budgeted amount Format: double |
UnitAmount (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Creates options for a specific tracking category — response body — Options item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
Name | string | Optional | The name of the tracking option e.g. Marketing, East (max length = 100) Maximum length: 100 |
Status | string | Optional | The status of a tracking option Known values: ACTIVE, ARCHIVED, DELETED |
TrackingCategoryID | string | Optional | Filter by a tracking category e.g. 297c2dc5-cc47-4afd-8ec8-74990b8761e9 Format: uuid |
TrackingOptionID | string | Optional | The Xero identifier for a tracking option e.g. ae777a87-5ef3-4fa0-a4f0-d10e1f13073a Format: uuid |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: xero.getbudgets. Catalog operation: getBudgets. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.