The calculate → review → recalculate flow
1
Calculate
POST /v1/payroll/calculate returns a calculation with an id.2
Review
Your team, or your customer, finds something wrong — a missing bonus, a wrong risk
class, an overtime bucket that was not loaded.
3
Recalculate, pointing at the original
Send the corrected request with
options.supersedes set to the original id.id, and record.supersedes_id pointing at
the original.
What this guarantees
- The original is untouched. It keeps its amounts, its audit trail and its
content_digest. If someone asks eight months from now what you first answered, the answer still exists. - The listing marks it. A superseded calculation is flagged
is_supersededinGET /v1/payroll/calculations, so you can filter it out of a current view without deleting it. - A correction is a new record, always. Immutability here is enforced by database
permission, not by convention: the application role has no
UPDATEand noDELETEon calculations.
Validation
options.supersedes must point at a calculation for the same employee, the same
employer and the same period. Anything else is rejected with 422 SUPERSEDES_MISMATCH.
The point is that a correction corrects something specific. A chain that jumps employees
or periods is not a correction, it is a mistake.
supersedes takes an id up to 64 characters and must reference a calculation belonging to
your own client. An id you cannot see returns 404 CALCULATION_NOT_FOUND.