Get the cost of goods sold for a given period. API returns an array of all sales document rows in the selected period, and the cost for each row.

Erply calculates cost according to FIFO principle.

Usage guidelines: Note that the COGS of any sale may change at any time — Erply does not freeze cost at the moment when sale takes place. Many kinds of operations may adjust it, eg. entering or correcting a purchase invoice at a later date, adding freight costs, deleting other documents etc. Find out what are the accounting principles in your company and pull COGS only when all adjustments for the given period are done — eg. at the end of month.

Input parameters

Parameter nameDescriptionPossible valueRequired
dateFromNote that API's output capacity may be limited. If you experience errors, subdivide your period into smaller chunks and request separately.ISO date (yyyy-mm-dd)
dateToISO date (yyyy-mm-dd)


Field nameTypeDescription
dateDateSales document date, eg. 2010-01-29.
invIDIntegerSales document ID.
invNoStringSales document number.
wrhIDIntegerID of the warehouse from which goods are sold.
prodIDIntegerID of the product.
amountDecimalSold amount.
priceDecimalNet sales total. Does not include VAT / sales tax.
costDecimalThe cost of goods sold.