# Batch pricelist update

This endpoint allows updating multiple prices at once. Price fields and other attributes from a pricelist of a product (variant) can be updated. Batch update  is processed asynchronously in same way as for example products snapshot, but  it does not have resultUrl with prices to download in response. Instead, you can check attribute log which contains successfully updated prices and errors.

See how Asynchronous requests work on our developer's portal.

File with data for update must be in JSONL (jsonlines) format. Each line must contain one pricelist price in JSON format. Maximum size of file is 100MB.

Structure of JSON row is same as structure of JSON for single pricelist update.  See Pricelist update schema  for more details.

Asynchronous job process jsonl file row by row and try to validate and save data. If there is any error,  row is skipped and error is logged, but it does not stop processing of other rows.

In Log, every product is identified by its position in file (starting from 1).

The request must contain a product variant code code and at least one  of the price, priceWithVat, priceWithoutVat, orderableAmount or sales objects. Send only fields you want to change, the others will stay untouched. Be aware of the difference between

- not providing a field: the field will not be changed

- providing e. g. data.price.buyPrice: null will remove the price

If you set includingVat or vatRate field, current data for product (or variant) will be recalculated.  (even through untouched by your request)

Object price directly sets price of product, without recalculating.

Object priceWithVat sets price of product, respecting it is price with VAT and thus recalculating if needed.

Object priceWithoutVat sets price of product, respecting it is price without VAT and thus recalculating if needed.

Note, that you can change buyPrice only for default price list! For others price lists, value stays null.

For non-vat payer e-shops, vatRate and includingVat fields are forbidden to use and fields price,  priceWithVat and priceWithoutVat all works the same.

In order to change the currency of the prices, you will need to have the Currencies module activated on  the customer's e-shop.

Note that if you change the currency code of the price list, all prices will not be recalculated to  the new currency; only the currency code will be changed.

Endpoint: PATCH /api/pricelists/{id}/batch
Version: 1.0.0
Security: shoptetAccessToken, shoptetPrivateApiToken

## Path parameters:

  - `id` (integer, required)
    Pricelist id
    Example: "1"

## Header parameters:

  - `Content-Type` (string, required)

## Request fields (application/json):

  - `batchFileUrlPath` (string, required)
    Url to batch file with products data. File must be in JSONL format.

## Response 202 fields (application/json):

  - `data` (object, required)

  - `data.jobId` (string, required)
    token of job

  - `errors` (array,null, required)

  - `errors.errorCode` (string, required)
    Short text error identification

  - `errors.message` (string, required)
    Descriptive error message

  - `errors.instance` (string, required)
    Identification of the entity referenced

## Response 409 fields (application/json):

  - `data` (object,null)

  - `errors` (array,null)


## Response 404 fields
