POST budget_cell_save
Saves one budget cell: one period on one Budget Line of a Budget Sheet. This is what the Excel add-in's =K.EPMSAVE() function calls (konsol/public/excel-addin/functions.js).
Endpoint
POST /api/method/konsol.api.budget_cell_save
Declared methods=["POST"].
Authentication: logged-in user. Entity, account and dimension write scope are checked as for budget_save.
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
scenario_id | string | Yes | Budget scenario (e.g. BUDGET_2025) |
data_area_id | string | Yes | Entity code |
fiscal_year | integer | Yes | Fiscal year |
main_account | string | Yes | Account code |
fiscal_period | integer | Yes | 1–12 |
amount | number | Yes | Budget amount |
layer | string | Yes | base, challenge, management, board (case-insensitive) |
dimensions | object | No | The budget line's dimensions, e.g. {"dim_region": "EU"}. This is what K.EPMSAVE sends. A name that is not one of the site's budget dimensions is refused (konsol#287) |
dim_<name> | string | No | A value for each in_budget Dimension provisioned on Budget Line, given at the top level. A name given both here and in dimensions must have the same value |
base_modified | string | No | The Budget Sheet modified the client last read; enables the conflict check below |
hierarchy, node / hierarchy_node | string | No | Write to a Reporting Hierarchy member: the member's dimension value is filled in from the hierarchy (refused when the node is not a valid write target for that period) |
What is written
- The Budget Cycle for
(scenario_id, fiscal_year)is found or created Open. A Locked cycle refuses the write with HTTP 423. - The Budget Sheet for
(cycle, data_area_id, layer)is found or created. Sheet names areBSHT-<cycle>-<entity>-<layer>-<sha8>. - The Budget Line matching
(main_account, in_budget dimension values)getsperiod_NNset toamount; a missing line is appended.
Cells of the same sheet serialise on a row lock; a concurrent create of the same new sheet is retried once as an update.
Optimistic locking
Omit base_modified for last-write-wins. With it, the stored sheet's modified is compared to base_modified under a row lock. If they differ, nothing is written and the response is HTTP 409 with a conflict payload so the client can refresh and ask the user again. A successful save returns the new modified to use as the next base_modified.
Example
curl -X POST http://localhost:8069/api/method/konsol.api.budget_cell_save \
-H "Content-Type: application/json" \
-b "cookies.txt" \
-d '{
"scenario_id": "BUDGET_2025",
"data_area_id": "USMF",
"fiscal_year": 2025,
"main_account": "6100",
"fiscal_period": 3,
"amount": 15000,
"layer": "base"
}'
Response
{
"message": {
"status": "ok",
"name": "BSHT-bcyc-budget-2025-2025-usmf-base-1a2b3c4d",
"value": 15000,
"modified": "2026-07-02 10:15:00.000000"
}
}
name is the Budget Sheet the cell landed in.
Errors
Conflict (HTTP 409)
{
"message": {
"status": "conflict",
"name": "BSHT-bcyc-budget-2025-2025-usmf-base-1a2b3c4d",
"fiscal_period": 3,
"layer": "base",
"your_amount": 15000,
"current_amount": 14000,
"current_modified": "2026-07-02 10:18:02.118764"
}
}
current_amount is null (not 0) when the cell has no line yet, so a cleared cell and a real zero can be told apart.
Others
| Message | Status | Cause |
|---|---|---|
Missing required fields: ... | 417 | One of the seven required fields is absent or "" |
Invalid layer '{x}'. Allowed: base, board, challenge, management | 417 | Unknown layer |
fiscal_period must be 1-12 | 417 | Period out of range |
Budget Cycle '{name}' is locked; the budget is final. Cancel the cycle to amend. | 423 | Cycle status Locked |
Could not save budget cell due to concurrent writes; please retry. | 417 | Two concurrent creates of the same new sheet, twice |
Not permitted to access entity '{e}' and the account / dimension equivalents | 403 | Outside the caller's write scope |