Skip to main content

POST budget_save

Saves one budget line (one account, one or more periods) into the Budget Sheet for its cycle, entity and layer.

Endpoint​

POST /api/method/konsol.api.budget_save

Declared methods=["POST"].

Authentication: logged-in user. The write is checked against the caller's entity allow-list, and, where configured, the account's responsibility category and permission-controlled dimensions (PermissionError, HTTP 403).

Request body​

A JSON object.

ParameterTypeRequiredDescription
scenario_idstringYesBudget scenario (e.g. BUDGET_2025)
data_area_idstringYesEntity code (e.g. USMF)
fiscal_yearintegerYesFiscal year
main_accountstringYesAccount code
periodsarrayYesNon-empty list of period objects (below)
dim_<name>stringNoA value for each Dimension flagged in_budget and provisioned on Budget Line, e.g. dim_cost_center

Period object​

FieldTypeRequiredDescription
periodintegerYesFiscal period 1–12 (the wide period_NN columns on Budget Line)
amountnumberYesBudget amount
layerstringNobase (default), challenge, management, board. Case-insensitive.

What is written​

Doctypes: Budget Cycle, Budget Sheet, Budget Line (konsol/epm/doctype).

  1. The Budget Cycle for (scenario_id, fiscal_year) is looked up; if absent it is created with status Open.
  2. If the cycle is Locked, the write is refused with HTTP 423 and Budget Cycle '{name}' is locked; the budget is final. Cancel the cycle to amend.
  3. Each period is written into the Budget Sheet for (cycle, data_area_id, layer), created if new. A payload that mixes layers writes to several sheets.
  4. Inside a sheet, the Budget Line is matched by (main_account, in_budget dimension values). Only the supplied periods are set; other months on an existing line are kept.

Sheet names are BSHT-<cycle>-<entity>-<layer>-<sha8> (digest_name in budget_sheet.py).

Example​

curl -X POST http://localhost:8069/api/method/konsol.api.budget_save \
-H "Content-Type: application/json" \
-b "cookies.txt" \
-d '{
"scenario_id": "BUDGET_2025",
"data_area_id": "USMF",
"fiscal_year": 2025,
"main_account": "6100",
"dim_cost_center": "CC001",
"periods": [
{"period": 1, "amount": 10000, "layer": "base"},
{"period": 2, "amount": 12000, "layer": "base"},
{"period": 3, "amount": 11000, "layer": "base"}
]
}'

Response​

{
"message": {
"sheets": ["BSHT-bcyc-budget-2025-2025-usmf-base-1a2b3c4d"],
"name": "BSHT-bcyc-budget-2025-2025-usmf-base-1a2b3c4d"
}
}

sheets lists every Budget Sheet the payload touched (one per layer); name is the first, kept for older clients.

Errors​

MessageStatusCause
Missing required fields: ...417One of scenario_id, data_area_id, fiscal_year, main_account, periods is missing or empty
periods must be a non-empty array417periods is not a list, or is empty
Invalid layer '{x}'. Allowed: base, board, challenge, management417Unknown layer
Budget Cycle '{name}' is locked; ...423Cycle status Locked
Not permitted to access entity '{e}' and the account / dimension equivalents403Outside the caller's write scope