Costing
List Cost Entries
Returns a paginated list of cost entries, newest cost date first by default.
Create Cost Entry
Creates a cost entry.
Get Cost Entry
Returns a cost entry with its allocations and amortization schedule (including periods and the resolved allocation target).
Update Cost Entry
Updates a cost entry. All fields are optional; only provided fields are changed.
Delete Cost Entry
Deletes a cost entry and its allocations.
List Cost Entry Allocations
Returns all allocations recorded against the cost entry, including the allocated target (product, brand, supplier, sales channel or sales order line) and any amortization linkage.
Delete Cost Entry Allocations
Deletes all allocations for the cost entry, returning its full amount to unallocated.
Create Amortization Schedule
Creates an amortization schedule for a cost entry, spreading its amount across future periods. Each period, when processed, allocates its share to the configured target. A cost entry can have only one schedule.
List Cost Entry Allocations (Paginated)
Paginated, filterable and sortable allocations of one cost entry — the same rows the cost entry's Allocations table shows. Each row carries the target's natural identifier (`target_reference`: SKU for products, sales order number for order lines, otherwise the name) and display name.
Export Cost Entry Allocations
Downloads one cost entry's allocations (with optional Order Reach, Reached Orders Amount and Order Lines Reached columns) as an XLSX or CSV file, honouring the same filters and sort as the paginated list. Headings (Allocation Type, Allocation Target, Allocation Amount, Allocation Date, Allocation Period Start/End) match the allocation import, so an exported file can be edited and imported back.
Download Cost Entry Allocation Import Template
Downloads an XLSX template for importing allocations onto this cost entry: one allocation per row with Allocation Type (product, brand, supplier or channel), Allocation Target (SKU for products, otherwise the name), Allocation Amount (entry currency) and optional Allocation Date and Period Start / End.
Validate Cost Entry Allocation Import
Validates mapped import rows against the cost entry and returns a per-row preview — no changes are made. Each row resolves its target (SKU / name, case-insensitive) and reports `errors` (row is skipped on import) and `warnings` (e.g. the entry already has an allocation to that target on that date). A blank allocation date defaults to the cost entry's cost date.
Import Cost Entry Allocations
Creates the given allocations on the cost entry, all or nothing, and recalculates the entry's status. Refused with 422 (nothing created) when they add up to more than the entry has left to allocate, or when a target no longer exists.
Bulk Delete Cost Entry Allocations
Removes several allocations of the cost entry: the given `ids` (IDs belonging to other cost entries are ignored), or — with `apply_to_all: true` — every allocation matching `filters` (the list endpoint's filters, e.g. `{'filter_groups': '<base64 tree>', 'search': 'BRK'}`). Allocations created by an amortization schedule are skipped and counted in `skipped_amortized` (delete the schedule instead). The entry's status is recalculated.
List Cost Entry Source Lines
Paginated source lines of one cost entry: one row per charge on the vendor document the entry was booked from, each with how much of it is allocated (through allocations linked to the line) and the basis of its amount. Lines that are not fully allocated explain the entry's unallocated amount.
Record Cost Entry Source Lines
Replaces the cost entry's source lines with the given lines and links or creates allocations, all in one transaction. Allocations linked to replaced lines keep existing and are re-linked when they match again.
Get Cost Entry Source Line Summary
Totals of a cost entry's source lines: coverage (lines vs entry amount), allocation state counts, totals per charge group with their basis, and why the unallocated amount is unallocated — grouped by charge type.
Export Cost Entry Source Lines
Downloads the cost entry's source lines as XLSX or CSV, honouring the same `filter[...]`, `filter_groups` and `sort` parameters as **List Cost Entry Source Lines**. `scope=selected` with `ids` exports only those lines.
Download Cost Entry Source Line Import Template
Downloads an XLSX template for importing a vendor detail file as source lines, with sample rows. Columns: Reference / SKU, Description, Charge Type, Charge, Quantity, Unit, Rate, Amount, Period Start, Period End, Basis, Basis Note, Basis As Of.
Validate Cost Entry Source Line Import
Turns mapped rows of a vendor detail file into source lines and previews them, without writing anything. Each row comes back with its resolved charge type, matched product and per-row errors; `lines` is the normalised payload to send to **Record Cost Entry Source Lines**; `dry_run` reports what recording them would do to allocations (only when no row has errors).
Record Bill Source Lines
Records a whole vendor invoice in one call: the source lines of every cost entry booked from the bill, plus the invoice's detail file, all or nothing. Each entry is named by `cost_entry_id` or `bill_line_id` and must belong to the bill. The file is stored once on the bill and linked to every entry; each line points at it.
Map Cost Entry Source Line to Product
Points a source line (typically an unknown SKU) at a product and makes it a product charge. With `allocate` (default true) its unallocated amount is allocated to that product, linked to the line.
List Cost Allocations
Returns a paginated list of cost allocations. A cost allocation assigns part (or all) of a cost entry's amount to a target entity - a product, brand, supplier, sales channel or sales order line - for landed cost and profitability reporting.
Create Cost Allocation
Creates a single cost allocation directly, assigning part (or all) of a cost entry's amount to a target entity. This is the low-level create: the caller supplies both currency amounts and the proration metadata explicitly. For most integrations the allocate endpoints under /api/cost-entries/{cost_entry}/allocate/... are simpler - they compute the account-currency amount and proration weights automatically.
Get Cost Allocation
Returns a single cost allocation by ID, including a summary of the target entity (allocatable). The summary fields depend on the target type: products include name and sku; brands, suppliers and sales channels include name; sales order lines include sales_order_id, product_id, product_name and quantity. amount is in the parent cost entry's currency and amount_in_tenant_currency is the equivalent in the account currency.
Delete Cost Allocation
Deletes a cost allocation and recalculates the parent cost entry's allocation status, freeing the amount to be allocated again.
Allocate Cost Entry to Product
Allocates part of a cost entry to a specific product. The allocation feeds into landed cost and profitability reporting.
Allocate Cost Entry to Brand
Allocates part of a cost entry to a product brand.
Allocate Cost Entry to Supplier
Allocates part of a cost entry to a supplier.
Allocate Cost Entry to Sales Channel
Allocates part of a cost entry to a sales channel.
Allocate Cost Entry to Sales Order Line
Allocates part of a cost entry to a specific sales order line.
Allocate Cost Entry by Proration
Allocates a cost entry across a custom list of products, splitting the amount by the chosen proration strategy.
Allocate Cost Entry to Purchase Order
Allocates the cost entry across the lines of a purchase order, creating one allocation per product using the chosen proration strategy (default cost_based).
Allocate Cost Entry to Sales Order
Allocates the cost entry across the lines of a sales order, creating one allocation per product using the chosen proration strategy (default revenue_based).
Allocate Cost Entry to Warehouse Transfer
Allocates the cost entry across the lines of a warehouse transfer, creating one allocation per product using the chosen proration strategy (default quantity_based).
Allocate Cost Entry to Inventory Assembly
Allocates the cost entry across the component lines of an inventory assembly, creating one allocation per product using the chosen proration strategy (default cost_based).
Allocate Cost Entry to Stock Take
Allocates the cost entry across the items of a stock take, creating one allocation per product using the chosen proration strategy (default quantity_based).
Get Latest Cost Entry AI Allocation
Returns the cost entry's most recent AI allocation batch with all of its proposals, plus whether AI allocation can run for the calling user.
Propose Cost Entry Allocations with AI
Starts an AI allocation batch for the cost entry. A background job reads the entry's source lines and proposes a product for each line's unallocated amount: deterministic matches first (product on the line, exact SKU, SKU ignoring case, units received on a named purchase order, units returned, earlier confirmations for the supplier), then the AI model picks from close matches for the rest. Every pick is checked against the product's stock and sales in the billed period; lines that cannot be placed are held with a hold code.
Get Cost Entry AI Allocation Batch
Returns one AI allocation batch of the cost entry with all of its proposals and summary figures. Use it to poll a batch you started, or to read an older batch.
Update Cost Entry AI Allocation Proposal
Points a proposal at a different product, or leaves its source line unallocated. Only proposals with status ready, held, or rejected after an edit can be changed, and only while the batch is completed and not stale.
Confirm Cost Entry AI Allocation Proposals
Writes the chosen proposals as cost allocations, linked to their source lines, in one transaction. Every proposal is re-checked first: it must be ready, its product must still exist and pass the stock-and-sales check, and the selected amounts must fit what is left unallocated on each line. If any check fails nothing is written.
Reject Cost Entry AI Allocation Batch
Discards everything the batch still offers: its pending, ready, held and stale proposals become rejected. Proposals already confirmed are untouched (use Undo Cost Entry AI Allocation to remove those). Nothing is allocated.
Undo Cost Entry AI Allocation
Removes the allocations one confirmation wrote and sets those proposals back to rejected. The confirmation is named by its allocation ids, not its proposal ids: a proposal can be undone, edited and confirmed again, and replaying the first Undo must not remove the later confirmation's allocations. Only allocations still tied to an accepted proposal of the batch are removed; an allocation edited, unlinked or deleted since confirming is left alone.
Bulk Allocate Cost Entries with AI
Runs AI allocation across several cost entries at once.
List Cost Entry Types
Returns all cost entry types, ordered alphabetically by name. Cost entry types are user-defined categories used to classify cost entries (for example Freight, Duty, Warehousing) for landed cost and profitability tracking.
Create Cost Entry Type
Creates a new cost entry type.
Get Cost Entry Type
Returns a single cost entry type by ID.
Update Cost Entry Type
Updates the name of an existing cost entry type. Cost entries already assigned to the type keep their assignment and reflect the new name.
Delete Cost Entry Type
Deletes a cost entry type.
Get FIFO Layer
Returns a single FIFO layer by ID with related product and warehouse data.
Archive FIFO Layer
Archives a single FIFO layer. Only fully utilized layers (available_quantity === 0) can be archived.
Unarchive FIFO Layer
Unarchives a previously archived FIFO layer.
Bulk Archive FIFO Layers
Archives multiple FIFO layers by ID. Only fully utilized layers are archived; partially available layers are skipped.
Bulk Unarchive FIFO Layers
Unarchives multiple FIFO layers by ID.
Check FIFO Layers Archivable
Checks whether each specified FIFO layer can be archived (i.e., available_quantity === 0). Returns a per-layer result with archivable flag and reason.
Get FIFO Layer Inventory Movements
Returns a paginated list of inventory movements linked to a specific FIFO layer.
Get FIFO Layer Activity Log
Returns a paginated activity log for a specific FIFO layer. Shows who changed the layer and what was changed.
Recalculate Total Costs
Re-derive the cost of the given FIFO layers from their source documents, through the cost-change review process.
Get FIFO Layer Parents
Returns the immediate (depth-1) parent FIFO layers consumed to produce the given output layer, with the aggregated quantity consumed from each parent. Used by the FIFO Layer detail page's 'Consumed From' panel to render the upstream lots that were assembled into this batch.
List FIFO Layers
Returns a paginated list of FIFO layers. Supports filtering, sorting, and column inclusion/exclusion.
List SKU COGS Health
Returns paginated SKU COGS health metrics. Each item includes unit cost, initial COGS, statistics (min/max/median/avg/variation), and inventory totals.
Search SKU COGS Health
Returns the same paginated per-SKU COGS health table as the GET version of this endpoint, but accepts its parameters in a JSON request body. Each row aggregates a product's cost-of-goods statistics (min, max, median, average, and percentage variation) across its active FIFO cost layers, alongside current inventory totals.
Get SKU COGS Health Summary
Returns aggregate summary statistics for the COGS health dashboard — totals across all SKUs matching the given filters.
Get SKU COGS Health Detail
Returns detailed COGS health metrics for a specific product by product ID.
Get All Value Sources
Returns paginated COGS value sources across all products.
Get Warehouse Breakdown
Returns the COGS warehouse breakdown for a specific product, showing how inventory and cost is distributed across warehouses.
Get Initial Inventory
Returns the initial inventory breakdown by warehouse for a specific product.
Get FIFO Layers
Returns current active FIFO layers for a specific product, optionally filtered by warehouse.
Get FIFO Layers Timeline
Returns paginated FIFO layer parent records (timeline) for a specific product. Used to show the historical sequence of inventory additions.
Get Layer Consumptions
Returns paginated consumption records for a specific FIFO layer. Shows how the layer's quantity was consumed over time.
Get Consumption Timeline
Returns paginated consumption timeline for a specific product — all historical consumption events in chronological order.
Recalculate SKU COGS
Queues a COGS recalculation for all FIFO layers of a specific product as a background job. The request returns immediately with a `tracked_job_log_id` you can use to track progress; the updated costs land once the job completes. Returns a message only (no `tracked_job_log_id`) when the product has no FIFO layers to recalculate.
Export SKU COGS Health
Export SKU COGS health metrics as spreadsheet-ready JSON rows. Unlike file-download exports, this endpoint returns the rows in the JSON response body (keyed by column heading) so the caller can save them as CSV/XLSX. Returns up to 10,000 products.
List Inventory Revaluations
List the inventory revaluation ledger (paginated). Every FIFO-layer cost change writes one dated row here.
Search COGS Revaluations
Returns the same paginated inventory revaluation ledger as the GET version of this endpoint, but accepts filters as a JSON request body instead of the query string. Use this POST variant when the filter set is too large or too complex to fit in a URL (for example, deeply nested AND/OR filter groups or long lists of values).
List Inventory Revaluation Activity
Paginated audit trail for one inventory revaluation — what changed, when, and who changed it. Newest first.
Get Inventory Revaluation
Get one inventory revaluation with its full context: the cost movement, the revalued FIFO layer, the document that layer came from, the product and warehouse, and the accounting ledger entries the revaluation posted.
Get Variation by Product Report
Returns a report of products whose COGS varies significantly across FIFO layers. Products with cost variation above the threshold are flagged for revaluation review.
Get Product COGS Report
Returns a detailed COGS report for a specific product, including all FIFO layers and their costs.
Get FIFO Layer COGS Report
Returns a detailed COGS report for a specific FIFO layer including cost history and revaluation events.
Get Bulk FIFO Layer COGS Report
Returns COGS reports for multiple FIFO layers in a single request.
Revalue FIFO Layer
Revalues a single FIFO layer to a new unit cost, creating an InventoryRevaluation record.
Bulk Revalue FIFO Layers
Revalues multiple FIFO layers in a single request.
Rebuild COGS for Product
Rebuilds COGS (recalculates FIFO layer costs from source documents) for a single product. This is a synchronous operation.
Rebuild COGS for Multiple Products
Rebuilds COGS for multiple specific products synchronously. Returns per-product success/failure summary.
Start Tracked COGS Rebuild
Starts a background tracked COGS rebuild job for all products (or a filtered subset). Returns a tracked_job_id to poll for progress.
Get Tracked Job Status
Polls the status and progress of a tracked COGS rebuild job.
Get Unified Tracking Data
Returns combined job status, recently rebuilt products, FIFO layer changes, and failed products in a single call. Replaces polling multiple endpoints.
Cancel Tracked Rebuild
Cancels a running tracked COGS rebuild job. Cancels all associated batch jobs and marks the tracked job as cancelled.
Get Recently Rebuilt Products
Returns a list of products that have had their COGS rebuilt recently. Used for monitoring rebuild progress.
Export FIFO Layer Changes CSV
Exports FIFO layer cost changes from a tracked rebuild job as a CSV file download.