Fenicia calculates your inventory's cost using cost layers (lots). Costing is FIFO (first in, first out) for every tenant: the NONE and AVERAGE methods no longer exist. A lot is born when merchandise is released to sellable stock: when a purchase order receipt is released (see Receipts and receiving tray) or when a transfer is received. When stock is consumed (for example, an order's sale), Fenicia depletes the oldest lots first. If the variant has inventoryTracking.trackExpiration, the sale uses FEFO (first expired, first out).
There is no public endpoint to create a lot
Lots are generated internally when merchandise is released from a receipt or when a transfer is received — not from this API. Queries require the inventory:read permission. The only write on this page is a lot's cost correction, which requires inventory:manage.
Most /inventory/* listings (stock, transfers, adjustments, counts) paginate 1-indexed (page=1 by default). GET /inventory/lots is the exception within the inventory domain itself: it paginates 0-indexed (page=0 by default), just like /locations/*. Its response shape is also flat — { data, total, page, limit, totalPages, hasMore } — different from the { items, pagination: {...} } used by stock, transfers, adjustments, and counts. If you share a pagination helper across inventory resources, this silently breaks the page count.
Valuation of a location in three lines: lots at their cost, stock without a lot at unitCost (estimated), and in-process merchandise at its cost. Requires inventory:read.
Lots are valued at their cost and only lots with status: 'active' count. Stock without a lot is valued at the product's unitCost and flagged estimated: true, because it has no real cost layer. costMissingSkus counts the SKUs with no lot and no unitCost: they are worth 0 and the valuation is partial. In-process merchandise (positions of a receiving flow) is valued at its position's cost.
This COGS is calculated from the InventoryLotMovement records with referenceType: 'order' and type: 'sale' associated with the order — not from a separate summary table.
{ "code": "not-found", "message": "Lot not found" }
Returns the lot with its previous and new cost. Inventory publishes the io.fenicia.inventory.lot-cost-corrected event and the orders service recalculates every line that consumed that lot, including its reversals. The line's original cogs is never touched: each correction is appended to cogsAdjustments[]. Replaying the same event does not duplicate corrections.
Returns the expired lots in data. An expired lot is not sold. To write it off, create an adjustment with the lot's lotId and the expired reason: it is recorded as scrap.
Returns the differences in data. The rule is that the sum of the lots' currentQuantity never exceeds Inventory.stock. This query is read-only: it warns, it does not fix. In a marketplace warehouse the difference has a tolerance, because the marketplace writes its own stock there.
Lot consumption follows ascending receivedAt order (the oldest lot is depleted first) within {tenantId, sku, locationId}. If the variant requires expiration (inventoryTracking.trackExpiration), the order is ascending expirationDate and, on a tie, receivedAt. Only lots with status: 'active' count: an expired lot is not sold.
Consumption is partial: it spends what the lots hold and the rest of the sale comes out of stock without a lot, costed at the product's unitCost. If there is neither a lot nor a unitCost, the line is flagged costMissing: true and excluded from the order's total COGS until the cost is entered. Lots are spent once per line: retrying the same line of the same order does not spend twice.
A return does not create a lot: it puts the pieces back into the original lot, and a depleted lot that receives a return becomes active again. Stock reservation no longer lives on the lot: the reservedQuantity field was removed.
Not exposed as an endpoint
FIFO consumption is triggered internally (an order's sale, a transfer's receipt) — there is no public POST to invoke it directly. Do not document it as an operation you can execute yourself via the API.