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.
| Parameter | Type | Required | Description |
|---|---|---|---|
scenario_id | string | Yes | Budget scenario (e.g. BUDGET_2025) |
data_area_id | string | Yes | Entity code (e.g. USMF) |
fiscal_year | integer | Yes | Fiscal year |
main_account | string | Yes | Account code |
periods | array | Yes | Non-empty list of period objects (below) |
dim_<name> | string | No | A value for each Dimension flagged in_budget and provisioned on Budget Line, e.g. dim_cost_center |
Period object
| Field | Type | Required | Description |
|---|---|---|---|
period | integer | Yes | Fiscal period 1–12 (the wide period_NN columns on Budget Line) |
amount | number | Yes | Budget amount |
layer | string | No | base (default), challenge, management, board. Case-insensitive. |
What is written
Doctypes: Budget Cycle, Budget Sheet, Budget Line (konsol/epm/doctype).
- The Budget Cycle for
(scenario_id, fiscal_year)is looked up; if absent it is created with status Open. - 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. - 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. - 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
| Message | Status | Cause |
|---|---|---|
Missing required fields: ... | 417 | One of scenario_id, data_area_id, fiscal_year, main_account, periods is missing or empty |
periods must be a non-empty array | 417 | periods is not a list, or is empty |
Invalid layer '{x}'. Allowed: base, board, challenge, management | 417 | Unknown layer |
Budget Cycle '{name}' is locked; ... | 423 | Cycle status Locked |
Not permitted to access entity '{e}' and the account / dimension equivalents | 403 | Outside the caller's write scope |