Skip to main content

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.

Required scope: inventory:write

Grant 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, or no_movement) and cost_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​

OK

Response Headers
    Content-Type