Update per-line COGS from unit cost
Applies cost_per_unit to matching sales lines: sets line total cost (quantity × unit cost), updates linked
sales item cost layers, and rolls up parent order item costs. This is the same behavior as the admin
Transaction COGS SKU-to-period import.
Exactly one of three modes is selected via mode:
Mode: sales_item_ids
Directly target specific sales item IDs with a given cost per unit.
Mode: sku_date_range
Matches lines with the product SKU whose parent order ship date falls within
from_date–to_date (inclusive).
Mode: order_ids
Targets specific internal sales order IDs. Optional sku limits to that product on those orders.
Authorizations
Authenticate using a bearer token. To create a token, navigate to /settings/api-tokens and click Create API Token.
Body
Response
Number of sales lines updated
Number of sales lines that were updated
x >= 0