Recalculate Total Costs
POST/api/fifo-layers/recalculate-total-costs
Re-derive the cost of the given FIFO layers from their source documents, through the cost-change review process.
inventory:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Requires Bearer token.
Body:
- ids (required, array of integers, min 1): FIFO layer IDs to recalculate (each must exist)
- note (optional, string, max 500): Recorded on the resulting cost change as the reason for the recalculation
Layers that were received against a purchase order are grouped by order. For each order whose layers would move, one Data Fix cost change is raised and your cost-change policy for Data Fix decides what happens: with the default review rule the change is staged as a pending cost change and nothing is written until it is resolved (choose Restate to date each layer's revaluation at its own receipt, or Going forward to date it today); with an auto rule the change applies at once. Orders whose layers already carry the cost their documents imply report no_movement and nothing is staged. Layers with no purchase order (opening balances, assemblies, transfers) are recalculated directly and listed in unattached_layer_ids.
Response:
- orders[]: one entry per purchase order —
purchase_order_id,purchase_order_number,layer_count,delta_total(in your base currency),outcome(staged,applied, orno_movement) andcost_change_set_id(set when staged) - unattached_layer_ids[]: layers recalculated directly
- message: a one-line summary of the outcome
Requires permission: inventory.adjust
Request
Responses
- 200
- 401
- 403
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden
Response Headers
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.