/v1/insights/productsWhat was sold or bought, by product, from the lines of each invoice, by invoice date over 7, 30 or 90 days ending on the company’s today. One currency at a time. A product is the seller’s item id, else its GTIN, else its name. Only the newest version of each invoice counts, and a credit note counts as minus. Rejected invoices, pro formas and suspected duplicates not kept are left out and counted in left. Invoice-level allowances and charges are totals of their own, never added into the lines. Every amount and quantity is a decimal string. The numbers are cipher’s and the API passes cipher’s status and body on unchanged. Cipher’s own refusals have the shape {detail: {code, message}}.
Query parameters
- daysstring
The window, in days. Default 30.
One of7,30,90. - sidestring
sales, the invoices made, orpurchases, the invoices received. Defaultsales.One ofsales,purchases. - currencystring
An ISO 4217 code. Empty or absent, the currency with the most invoices in the window.
Status codes
| Status | Meaning |
|---|---|
200 |
{basis, currencies, currency, totals, left, products, more}. basis names the date, the window, the time zone, the side and the definition’s version and date. products lists the hundred largest; more says how many are not listed. |
400 |
Cipher’s answer: the window, side or currency is not one it takes (bad_window, bad_side, bad_currency). |
401 |
No usable credential was sent (invalid_credentials). |
403 |
Cipher’s answer: the company has not switched the insights add-on on (addon_off). |
503 |
Cipher or its database could not answer (insights_unavailable). Invoicing is not affected. |
/v1/insights/productscurl https://api.certinvo.com/v1/insights/products \
-H "Authorization: Bearer $CERTINVO_API_KEY"const response = await fetch(`https://api.certinvo.com/v1/insights/products`, {
headers: {
Authorization: `Bearer ${process.env.CERTINVO_API_KEY}`,
},
})
console.log(response.status, await response.json())import os
import requests
response = requests.get(
"https://api.certinvo.com/v1/insights/products",
headers={"Authorization": f"Bearer {os.environ['CERTINVO_API_KEY']}"},
)
print(response.status_code, response.text)