API reference · Stock and Price
Update or Create Stock in Batch
https://api.sandbox.cws.digital/v1/stock/batchDescription
Creates or updates the stock and price of up to 50 products per request, in your own store.
Each item is processed independently: the result of each one comes in the status field of the response, and a rejected item does not prevent the others.
The store is always the token's store. To send stock for a branch, use Update or Create Stock in Batch for Branch.
How to identify the product
Each item must carry one of these two forms:
| Form | Fields |
|---|---|
| By manufacturer data | brand, mfrPartCode and composition, all three together. |
| By attribute | skuAttributeName and skuAttributeValue, both together. Available to those who have contracted the product catalog service with their own attribute. |
All items in the same batch must use the same form. A batch that mixes both is rejected entirely with 400: send one request for each form.
The examples use the sandbox test product, which is already registered: only replace the warehouseId with a warehouse of your store.
Request body
application/jsonRequired| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| stockRequest | array of object | Yes | From 1 to 50 items. Fields in stockRequest[] |
stockRequest[]| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| warehouseId | integer | Yes | Warehouse where the stock is allocated. | |
| price | number | Yes | Sale price. Cannot be negative. | |
| quantity | integer | Yes | Stock quantity. Cannot be negative. | |
| virtualQuantity | integer | Yes | Virtual stock. Cannot be negative. Send | |
| leadTime | integer | Yes | Preparation time in days. Cannot be negative. | |
| brand | string | No | Name of the manufacturer's brand, such as | |
| mfrPartCode | string | No | Product code at the manufacturer. Goes together with | |
| composition | string | No | Product composition, always in uppercase. Goes together with Allowed values: UNITARYPAIRKITWARRANTYSET | |
| skuAttributeName | string | No | Name of your own attribute in the product catalog. Goes together with | |
| skuAttributeValue | string | No | Value of the attribute for this product. Goes together with | |
| byRequest | boolean | No | Product available for quotation. | |
| leadTimeByRequest | boolean | No | Preparation time upon request. See Lead time and virtual stock. | |
| leadTimeDate | string | No | Expected availability date of the product, with full date and time in Brasília time — | |
| profitMargin | number | No | Profit margin, from 0 to 100. | |
| targetMargin | number | No | Target margin, from 0 to 100. | |
| totalCost | number | No | Total cost of the item. Cannot be negative. | |
| multipleQuantity | integer | No | Sales multiple. | |
| partnerPartCode | string | No | Your product code. | |
| partnerPartCodeUnique | boolean | No | Makes the | |
| priceRuleTags | array of object | No | Price rule tags to link to the product: Fields in stockRequest[].priceRuleTags[] | |
| deleteTag | boolean | No |
|
stockRequest[].priceRuleTags[]| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| name | string | No |
Business rules
Lead time and virtual stock
The preparation time can be provided in two ways:
- In days: send the number of days in
leadTime. If you sendleadTimeByRequest, it must befalse. - Upon request: send
leadTimeByRequest: truewithleadTime: 0.
With virtual stock (virtualQuantity greater than zero) and leadTimeByRequest: false, leadTime must be greater than zero.
An item outside these combinations is rejected, with status: ERROR.
Availability date
Send leadTimeDate with the full date and time, in Brasília time: 2026-09-10T00:00:00-03:00.
A date without time (2026-09-10) or in another format (10/09/2026) rejects the entire request with 400.
With the date filled in and the real quantity at zero, the virtual stock starts being offered.
The submission is always complete
Resend the whole item on every update. The optional fields you do not resend go back to empty: leadTimeDate, leadTimeByRequest, profitMargin, totalCost and targetMargin.
partnerPartCode and multipleQuantity are the exception: they only change when you send them.
Repeated items in the same batch
Send each product only once per request. Items with the same warehouse and the same product are treated as repeated:
- with the same values, only the first one is processed;
- with different values, none of them is processed.
Unique product code in the warehouse
Use partnerPartCodeUnique: true when you reuse a product code for another SKU.
With it, the stocks in the same warehouse that already have that code in partnerPartCode are zeroed (price, quantity and virtual stock), and the old code receives the _i suffix.