Skip to main content

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​

ParameterTypeRequiredDescription
scenario_idstringYesBudget scenario (e.g. BUDGET_2025)
data_area_idstringYesEntity code
fiscal_yearintegerYesFiscal year
main_accountstringYesAccount code
fiscal_periodintegerYes1–12
amountnumberYesBudget amount
layerstringYesbase, challenge, management, board (case-insensitive)
dimensionsobjectNoThe 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>stringNoA 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_modifiedstringNoThe Budget Sheet modified the client last read; enables the conflict check below
hierarchy, node / hierarchy_nodestringNoWrite 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​

  1. The Budget Cycle for (scenario_id, fiscal_year) is found or created Open. A Locked cycle refuses the write with HTTP 423.
  2. The Budget Sheet for (cycle, data_area_id, layer) is found or created. Sheet names are BSHT-<cycle>-<entity>-<layer>-<sha8>.
  3. The Budget Line matching (main_account, in_budget dimension values) gets period_NN set to amount; 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​

MessageStatusCause
Missing required fields: ...417One of the seven required fields is absent or ""
Invalid layer '{x}'. Allowed: base, board, challenge, management417Unknown layer
fiscal_period must be 1-12417Period out of range
Budget Cycle '{name}' is locked; the budget is final. Cancel the cycle to amend.423Cycle status Locked
Could not save budget cell due to concurrent writes; please retry.417Two concurrent creates of the same new sheet, twice
Not permitted to access entity '{e}' and the account / dimension equivalents403Outside the caller's write scope