The API allows you to view posted allocations, cost accounting statements, and their reconciliation with general ledger accounting. It also allows you to configure dimensions, correct a recorded line, and reclassify a share after closing.
The operations below use the REST API session. The rights of the logged-in user apply to the requested company, document, dimensions, and values.
View Figures #
| GET Operation | Result |
|---|---|
analytic_entry |
Recorded shares of an accounting entry, with their dimensions, values, and origin. Parameter: id, the Webservice ID of the entry. |
analytic_axis_totals |
Debit, credit, and net amount per dimension value. Parameters: organizationId, dateFrom, dateTo, axisId, accountPrefix optional. |
analytic_cross_axis |
Cross-tabulation of two dimensions, with “Unallocated,” totals, and reconciliation indicators. Parameters: company, dates, rowAxisId, columnAxisId. |
analytic_profit_and_loss |
Cost accounting income statement and comparison with the general ledger total. Parameters: company, dates, axisId, analyticValueId optional. |
analytic_general_ledger |
General ledger lines filtered by dimension, value, account, and optionally a second dimension. Parameters: company, dates, axisId, analyticValueId, accountPrefix, secondAxisId, secondValueId. |
analytic_key_distribution |
Shares of a fixed key and available values. Parameter: id, the Webservice ID of the key. |
The income statement, general ledger, cross-tabulation, and dashboard all accept allocationView: after (default) includes validated closing allocations, before gives the amounts before allocation.
In reporting operations, company and dimension IDs are the numeric record identifiers; document and key IDs use the Webservice Nx123 format. Dates are in AAAA-MM-JJ format.
Amounts are expressed in the company’s accounting currency. “Unallocated” is included in the cost accounting totals; a coverage gap separately indicates general ledger entries that do not yet have recorded shares. For two companies with different accounting currencies, request two separate reports.
Enter or Correct a Line Allocation #
Use the POST update_analytic_line_choice operation to change a dimension on an already recorded line. The operation updates the selection, regenerates the entries, and returns the recorded allocation. It requires an open accounting period and the right to modify both the document and the cost allocation.
| Parameter | Value |
|---|---|
sourceId |
Webservice ID of the supplier invoice or manual entry. |
lineKey |
Stable key of the line, returned with the recorded line. |
axisId |
Webservice ID of the dimension. |
mode |
automatic, value, key, or unallocated. |
targetId |
Webservice ID of the value for value, or of the allocation key for key; empty string in other cases. |
curl -X POST 'https://apps.kafinea.com/YourKafinea/webservice.php' \
-d 'operation=update_analytic_line_choice' \
-d 'sessionName=YOUR_SESSION_ID' \
-d 'sourceId=81x123' \
-d 'lineKey=00000000-0000-4000-8000-000000000001' \
-d 'axisId=82x456' \
-d 'mode=value' \
-d 'targetId=83x789'
The line key must come from the API response for the relevant document. On a supplier invoice, it appears with the document lines; on a manual entry, with its accounting lines. The line’s sequence number and account number do not replace this key.
To revert to the company’s rules, send mode=automatic and an empty targetId. To keep the amount in the analysis without a value on this dimension, send mode=unallocated. A fixed key can split the same line across several values; the shares are calculated from the amount actually posted.
Reclassify After Closing #
For a closed period, the POST reclassify_analytic_allocation operation records a correction dated the current day in an open period. It creates two cost accounting entries with opposite amounts: the allocation for the closed period and the general ledger entry remain unchanged.
| Parameter | Value |
|---|---|
allocationId |
Webservice ID of the share, provided in analytic_entry under portions[].id. |
axisId |
Webservice ID of the dimension to correct. |
targetValueId |
Webservice ID of the new value; empty string for “Unallocated.” |
reason |
Explicit reason, 5 to 255 characters. |
The operation requires a period open as of the current date, full accounting rights, and the same accounting currency for both periods. A share that has already been reclassified requires an accounting review before another correction. The cost accounting ledger shows both entries at their respective dates; cross-tabulations and the income statement reflect their net effect.
Allocate Shared Amounts at Closing #
Cycles, keys, and indicators are created and modified like ordinary records. The following operations read, simulate, and validate allocations. IDs are written in Webservice format; unallocated designates amounts with no value on the dimension. Amounts are decimal strings in the company’s accounting currency.
| Operation | Method | Role | Parameters |
|---|---|---|---|
analytic_closing_cycles |
GET | The company’s cycles in their order, with their key, their allocated values, and what remains to be corrected. | organizationId |
analytic_closing_simulation |
POST | Simulation of an allocation, without posting: amount to allocate, already allocated in the fiscal year, amount moved, recipients with base, percentage and amount, warnings. postable indicates whether validation will pass. |
organizationId, dateFrom, dateTo, cycleIdsJson optional (JSON list), replaceBatchId optional |
post_analytic_closing |
POST | Validates the simulated allocation with the same parameters, dated dateTo. |
same parameters |
analytic_closing_history |
GET | The company’s allocations, from most recent to oldest, and the “up to date” status of the latest one. | organizationId, limit optional |
analytic_closing_batch |
GET | Detail of an allocation by cycle. | batchId |
cancel_analytic_closing |
POST | Cancels the company’s most recent allocation, as long as its period is open. | batchId |
analytic_indicator_quantities |
GET | Quantities of an indicator for a company and a year, by month, quarter, or year. | indicatorId, organizationId, year, granularity optional |
update_analytic_indicator_quantities |
POST | Records quantities; an empty quantity clears the period. | indicatorId, organizationId, quantitiesJson: list of {value_id, start, end, quantity} |
update_analytic_cycle_senders |
POST | Replaces the values across which a cycle allocates amounts. | id, valueIdsJson: list of value IDs and unallocated |
A validation is rejected, with an explicit message, if a cycle has an error, if there is nothing new to allocate, if the accounting period is closed, or if the cycle has already been allocated as of that date. replaceBatchId reruns the last allocation, replacing it. Each warning carries a code: indicator_partial (quantities do not cover the entire period) or senders_excluded (values allocated by the cycle are excluded from the recipients). The detail of an allocation retains, for each cycle, the key and its description, the period read, the warnings, and, for each recipient, its base, percentage, and amount at the time of validation. The full process is described in Allocate Shared Amounts at Closing.
Configuring Dimensions and Keys #
Dimensions, values, mappings, rules, and keys are settings accessible through the usual read and write operations, depending on the user’s rights. Check the available fields and the company scope before writing. The update_analytic_key_distribution operation replaces all shares of a fixed key at once; the total must be exactly 100%.
The MCP server and the Kafinea Assistant provide access to these same statements, to line-level corrections, dated reclassification, and closing allocations, subject to their data modification controls. A setting change does not rewrite amounts already posted.