Retrieve one budget definition using its ID and the API key for the business unit that owns it. Use this when you already have a BudgetDefinitionId from Get All Budgets.
Request
GET https://api.myzahara.net/api/{businessUnitApiKey}/BusinessBudget/Get/{budgetId}
Send Accept: application/json. No request body appears in the supplied API definition.
The verified request accepted a modern BudgetDefinitionId and returned the same structured budget model documented in article 178. Do not substitute a budget name, business-unit ID or legacy migration ID.
Authentication and scope
| Parameter | Location | Meaning |
|---|---|---|
| businessUnitApiKey | URL path | Business-unit API key; never a numeric ID. |
| budgetId | URL path | Integer ≥ 1. Use an authorised reference from the same context. |
Keep credentials in an environment variable or secret store. The API key appears in the request path, so redact URLs in logs, proxy traces and error reporting. Do not give real keys to a coding agent in a prompt or documentation URL. Use the correct key scope; do not assume a tenancy key works in a business-unit method.
Working examples
All three clients were executed successfully against the production API on 25 November 2026. Their JSON root shape and, where applicable, item counts matched the direct request.
| Environment variable | Purpose |
|---|---|
| ZAHARA_BUSINESS_UNIT_API_KEY | Required API key; store privately. |
| ZAHARA_BUDGET_ID | budgetId. |
cURL
Requires cURL 7.76.0+ for --fail-with-body. It prints the complete response, including error JSON on an HTTP failure. Use a secure development terminal.
# cURL 7.76.0+. Set the environment variables documented below.
# Treat response data as confidential. Keep keys out of logs.
curl --fail-with-body --silent --show-error --max-time 30 \
--request GET \
--header 'Accept: application/json' \
"https://api.myzahara.net/api/${ZAHARA_BUSINESS_UNIT_API_KEY:?Set ZAHARA_BUSINESS_UNIT_API_KEY}/BusinessBudget/Get/${ZAHARA_BUDGET_ID:?Set ZAHARA_BUDGET_ID}"
JavaScript (Node.js 22+)
Uses built-in fetch and a 30-second timeout; no extra packages are needed. Check the HTTP status and inspect the parsed result before accessing fields.
// Node.js 22+. Standard library only.
function required(name) {
const value = process.env[name];
if (!value) throw new Error('Set ' + name);
return value;
}
const key = required('ZAHARA_BUSINESS_UNIT_API_KEY');
const base = 'https://api.myzahara.net';
let path = "BusinessBudget/Get/{budgetId}";
const budgetId = required('ZAHARA_BUDGET_ID');
if (!/^\d+$/.test(budgetId) || !Number.isSafeInteger(Number(budgetId)) || Number(budgetId) < 1) throw new Error('Invalid ZAHARA_BUDGET_ID');
path = path.replace('{budgetId}', encodeURIComponent(budgetId));
const url = new URL(base + '/api/' + encodeURIComponent(key) + '/' + path);
let response;
try {
response = await fetch(url, {
method: 'GET', headers: { Accept: 'application/json' },
signal: AbortSignal.timeout(30000), redirect: 'error'
});
} catch { throw new Error('Zahara request failed or timed out; URL omitted to protect the key'); }
if (!response.ok) throw new Error('Zahara returned HTTP ' + response.status);
const text = await response.text();
// Some methods may return an empty successful body. Do not assume a JSON shape.
const result = text.trim() ? JSON.parse(text) : null;
// Use a secure console; response fields may include financial or business data.
console.log(JSON.stringify(result, null, 2));
Python 3 (standard library)
Rejects redirects and reports HTTP errors without including the credential-bearing URL.
# Python 3. Standard library only.
import json
import os
from urllib.parse import quote, urlencode
from urllib.request import Request, build_opener, HTTPRedirectHandler
from urllib.error import HTTPError, URLError
class NoRedirect(HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
def required(name):
value = os.environ.get(name)
if not value:
raise SystemExit('Set ' + name)
return value
key = required('ZAHARA_BUSINESS_UNIT_API_KEY')
base = 'https://api.myzahara.net'
path = "BusinessBudget/Get/{budgetId}"
budgetId = required('ZAHARA_BUDGET_ID')
if not budgetId.isascii() or not budgetId.isdigit() or int(budgetId) < 1:
raise SystemExit('Invalid ZAHARA_BUDGET_ID')
path = path.replace('{budgetId}', quote(budgetId, safe=''))
url = base + '/api/' + quote(key, safe='') + '/' + path
request = Request(url, method='GET',
headers={'Accept': 'application/json'})
try:
with build_opener(NoRedirect).open(request, timeout=30) as response:
text = response.read().decode('utf-8')
except HTTPError as error:
raise SystemExit('Zahara returned HTTP ' + str(error.code)) from None
except URLError:
raise SystemExit('Zahara request failed; URL omitted to protect the key') from None
result = json.loads(text) if text.strip() else None
# Use a secure console: the result may contain confidential data.
print(json.dumps(result, indent=2))
Successful response
The valid-ID test returned HTTP 200 and one JSON object, not a one-item array. A nonexistent ID returned HTTP 200 with JSON null. Handle both cases: a successful HTTP status alone does not mean a budget was found.
Representative response example
This is a shortened example with fictional business identifiers, text and dates. The currency names and symbols, where shown, are reference labels. Array length is illustrative; omitted data is not a promise that it will be absent.
{
"BudgetDefinitionId": 1001,
"Active": true,
"Void": false,
"UpdatedDate": null,
"DeletedDate": null,
"BudgetHolder": null,
"BusinessUnitId": 101,
"BudgetName": "Example purchasing budget",
"TenancyId": 1,
"Description": null,
"BudgetPeriodGroupId": 201,
"RolloverEnabled": false,
"EnforceSpendControl": false,
"AutoRenew": false,
"CurrencyId": 1,
"OrderSpendDateType": 0,
"InvoiceSpendDateType": 1,
"AllocateMatchedInvoiceDate": 1,
"AllocateMultipleTierInvoiceMatchesToDateRule": 0,
"UsePurchaseOrderDatesForMatchedInvoices": false,
"LegacyMigrationBudgetId": 0,
"LegacyLockApplied": false,
"BudgetPeriodGroup": {
"BudgetPeriodGroupId": 201,
"GroupName": "Example periods",
"IntervalType": 4,
"IsGlobalDefault": false,
"BudgetCustomPeriodGroupDefinitions": [
{
"BudgetCustomPeriodGroupDefinitionId": 301,
"BudgetPeriodGroupId": 201,
"PeriodName": "Example period",
"PeriodNumber": 1,
"StartDate": "2026-01-01T00:00:00Z",
"EndDate": "2026-01-31T23:59:59Z"
}
]
},
"Rows": [
{
"BudgetDefinitionRowId": 401,
"BudgetDefinitionId": 1001,
"RolloverEnabled": false,
"RolloverValue": 0,
"BudgetBasisConditionGroupId": 501,
"BudgetPeriodGroupId": 201,
"PeriodNumber": 1,
"PeriodStart": "2026-01-01T00:00:00Z",
"PeriodEnd": "2026-01-31T23:59:59Z",
"PeriodBudgetAmount": 10000,
"RunningTotalNet": 1000,
"RunningTotalGross": 1200,
"PendingRunningTotalNet": 200,
"PendingRunningTotalGross": 240,
"CurrencyId": 1,
"Enabled": true
}
],
"BudgetBasisConditionGroup": [
{
"BudgetBasisConditionGroupId": 501,
"BudgetBasisConditions": [
{
"BudgetBasisConditionId": 601,
"BasisId": 701,
"BudgetBasisTypeId": 4,
"BasisCondition": 0,
"CustomTypeId": null,
"CustomValue": "",
"BudgetBasisConditionGroupId": 501
}
]
}
]
}
Top-level field reference
Types below describe the tested response. They are not a complete schema or a guarantee of requiredness or nullability in every configuration.
| Field | Observed JSON type | Meaning / integration use |
|---|---|---|
| BudgetDefinitionId | number | Identifier for the returned budget definition. This is not the legacy BudgetId field. |
| BusinessUnitId | number | Business unit associated with the budget. |
| TenancyId | number | Associated tenancy ID, not an API key. |
| BudgetName | string | Budget name for display or selection. Do not assume names are unique. |
| Active | boolean | Top-level budget activity flag. Inactive-budget inclusion was not verified. |
| Void | boolean | Void flag. Inclusion of void budgets was not verified. |
| UpdatedDate / DeletedDate | null | These were null in the test. Do not assume they are always null or that their non-null format is established. |
| BudgetHolder / Description | null | These were null in every tested object. Their populated shapes were not established. |
| BudgetPeriodGroupId | number | Identifier for the associated period group. |
| BudgetPeriodGroup | object | Period-group configuration and custom period definitions. |
| Rows | array of objects | Budget rows combining periods and matching-condition groups, with amounts and recorded totals. |
| BudgetBasisConditionGroup | array of objects | Matching-condition groups referenced by the rows. The property name is singular even though its value is an array. |
| RolloverEnabled | boolean | Budget-level rollover setting. Rows also carry their own rollover fields. |
| EnforceSpendControl | boolean | Spend-control configuration flag. This response does not itself evaluate a proposed purchase. |
| AutoRenew | boolean | Auto-renewal configuration flag; renewal execution was not tested. |
| CurrencyId | number | Currency identifier. Do not infer an ISO currency code from the numeric value. |
| OrderSpendDateType / InvoiceSpendDateType | number | Date-selection configuration codes. Exact enum mappings were not verified. |
| AllocateMatchedInvoiceDate / AllocateMultipleTierInvoiceMatchesToDateRule | number | Matched-invoice date-allocation configuration codes. Exact mappings were not verified. |
| UsePurchaseOrderDatesForMatchedInvoices | boolean | Configuration flag for use of purchase-order dates with matched invoices. |
| LegacyMigrationBudgetId / LegacyLockApplied | number / boolean | Legacy migration reference and lock flag. A full migration-state contract was not verified. |
Period-group fields
| Field | Observed JSON type | Meaning / integration use |
|---|---|---|
| BudgetPeriodGroup.BudgetPeriodGroupId | number | Identifier of the period group. |
| BudgetPeriodGroup.GroupName | string | Period-group name. |
| BudgetPeriodGroup.IntervalType | number | Interval configuration code. Do not reuse an enum mapping from the legacy budget example. |
| BudgetPeriodGroup.IsGlobalDefault | boolean | Flag identifying a global-default group. |
| BudgetPeriodGroup.BudgetCustomPeriodGroupDefinitions | array of objects | Custom period definitions observed in the response. |
| …BudgetCustomPeriodGroupDefinitionId | number | Custom period definition identifier. |
| …BudgetPeriodGroupId | number | Associated period-group identifier. |
| …PeriodName / PeriodNumber | string / number | Period label and number. |
| …StartDate / EndDate | string | Observed ISO 8601 UTC date-time strings. Boundary inclusivity was not verified. |
Row fields
Rows form a matrix of periods and matching conditions. Do not treat Rows.length as the number of unique periods: different condition groups can produce multiple rows for a period.
| Field in Rows[] | Observed JSON type | Meaning / integration use |
|---|---|---|
| BudgetDefinitionRowId | number | Budget row identifier. |
| BudgetDefinitionId | number | Associated budget definition. |
| BudgetBasisConditionGroupId | number | Link to the matching group in BudgetBasisConditionGroup[]. |
| BudgetPeriodGroupId / PeriodNumber | number | Period-group reference and period number. |
| PeriodStart / PeriodEnd | string | Observed ISO 8601 UTC period boundaries. A null end date was not observed; do not assume universal non-nullability. |
| PeriodBudgetAmount | number | Budget amount recorded for the row. |
| RunningTotalNet / RunningTotalGross | number | Recorded net and gross running totals. |
| PendingRunningTotalNet / PendingRunningTotalGross | number | Recorded pending net and gross running totals. |
| RolloverEnabled / RolloverValue | boolean / number | Row-level rollover configuration and value. |
| CurrencyId | number | Currency reference for the row. |
| Enabled | boolean | Row-level enabled flag, distinct from the top-level Active flag. |
Do not present a simple subtraction of these fields as Zahara's authoritative available-budget calculation. Matching, pending spend, rollover, currency and date rules affect interpretation. This method returns recorded data; spend validation and applying documents to budgets are separate operations.
Condition-group fields
| Field | Observed JSON type | Meaning / integration use |
|---|---|---|
| BudgetBasisConditionGroup[].BudgetBasisConditionGroupId | number | Group identifier referenced by budget rows. |
| BudgetBasisConditionGroup[].BudgetBasisConditions | array of objects | Conditions in the group. |
| …BudgetBasisConditionId | number | Individual condition identifier. |
| …BudgetBasisConditionGroupId | number | Parent group reference. |
| …BasisId / BudgetBasisTypeId / BasisCondition | number | Matching target, basis type and condition codes. Target semantics, enum mappings and evaluation rules were not verified. |
| …CustomTypeId | null | Null in the test; its populated form was not established. |
| …CustomValue | string | Custom-value field; the test does not establish every possible value or format. |
The nested period groups, period definitions, rows, condition groups and conditions also included tenancy/business-unit references and audit properties such as Void, CreatedDate, UpdatedDate and DeletedDate. Observed dates were strings or null depending on the object. These fields are omitted from the shortened example above.
Handling failures
A deliberately invalid key returned HTTP 401 with:
{
"ApiMessage": "The API key is missing or not recognised.",
"StatusCode": 401
}
A known-absent ID in the tested business unit returned HTTP 200 with JSON null. Treat this as a missing result, not a populated object or a transport error.
Check the HTTP status before using the response. Handle timeouts, unexpected content types and unknown result shapes. Do not convert a failed request into an empty successful result. The supplied clients make a single request and do not automatically retry it.
Integration notes
Check result === null before accessing BudgetDefinitionId or nested Rows.
The response contains period configuration, financial running totals and matching conditions; avoid logging the whole object in shared systems.
Use article 178 for the complete structured-budget explanation. Fields such as DetailsXml and legacy BudgetId were not present in the verified object.
Inactive/void inclusion, cross-business access, comprehensive nullability, rate limits and other budget implementations remain unverified.
These observations apply to the tested configuration, not every version or tenant. Do not infer undocumented response fields, permission rules or limits.
Verification
Verified on 25 November 2026 against the production API with an authorised business-unit key. Direct request: HTTP 200. cURL, Node.js and Python each completed successfully. A known-absent identifier returned HTTP 200 with null.