Skip to content

Invoices · How-to guide

Import and export products

Learn how to download your products as a CSV, Excel or JSON file, fill in the sample, and import a file of products.

Your products can go out as a file and come back in as one: CSV, Excel (.xlsx) or JSON. Use it to move a product list from another system, to change many prices at once in a spreadsheet, or to keep a copy.

An import always shows what it would do first. Nothing is saved until you confirm. It works the way the buyers file does; this page says where products differ.

Download the products or the sample

In the console, open Products, then Import and export. Under Download and Example file, choose CSV, Excel or JSON. Through the API, any key may download:

curl -s -o products.csv -H "Authorization: Bearer cvo_live_sk_..." "https://<api-host>/v1/data-files/products?format=csv"
curl -s -o products-sample.xlsx -H "Authorization: Bearer cvo_live_sk_..." "https://<api-host>/v1/data-files/products/sample?format=xlsx"

The sample holds the lines of a few invoices the validator accepted. Its products have no id, so importing it adds them.

The columns

Column What it holds
id The product’s id, as the API made it. Empty for a new product.
name The product’s name. Needed.
description Optional.
sellerItemId Your item number. Optional. Excel keeps a leading zero, such as 0042.
unitCode A code of the official unit list, such as C62 (one) or HUR (hour). Needed.
unitPrice A decimal with a point, such as 65.00. A discount item may be negative. Needed.
priceBasis net or gross. Needed.
vatCategory A VAT category code, such as S or AE. Needed.
vatRate A percentage, such as 19 or 0. Needed.

The CSV and the Excel sheet are written as for buyers: semicolons and a byte order mark, every Excel cell as text, and a ' in front of a cell starting with =, +, - or @. The JSON is a list of products; an import also takes {"products": [...]}.

Import a file

  1. On Products, open Import and export, choose Import a file and pick the file.
  2. The import page counts the rows as new, changed, the same and not imported, and names each row it will not import, with its row number, its column and why.
  3. Choose Import. All new and changed products are saved in one step.

How a row finds its product:

  • A row with an id is that product. An id no product has is not imported: leave it empty to add a product.
  • A row with no id is the one product with that name, or a new product. If several have the name, give the row an id.

A column the file has sets that field, and an empty cell clears it. A column the file lacks keeps what is saved. A new product needs every column marked “Needed” above. A product the file leaves out is kept: delete one on its own page.

Import through the API

Any key may preview and import, as any key may save a product.

curl -s -X POST -H "Authorization: Bearer cvo_live_sk_..." -H "Content-Type: application/json" \
  -d "{\"data\": \"$(base64 < products.csv)\"}" "https://<api-host>/v1/data-files/products/previews"

The answer has counts, one entry per row in rows, and basedOn: a short text that stands for the products the preview saw. Send the same file with that basedOn to POST /v1/data-files/products/imports.

Status Code What happened
400 invalid_data_file The file is no products file, or it has a column no product has. The message names it. Nothing was read.
400 invalid_format format is not csv, xlsx or json.
409 list_changed A product was added, changed or deleted since the preview. Preview the file again. Nothing was saved.
409 request_in_progress Another import of the same list is being saved at this moment. Preview the file again once it is done. Nothing was saved.
Navigation

Type to search…

↑↓ navigate↵ selectEsc close