Skip to content
platform

API reference · Contracts · Store Management

Add Products to Contract

Method
PUT
Route
/pricing/contract/:contractId/items
Base URL
https://ws.autorei.net
Path parameters
:contractId
Token
Requires Bearer token
Test in Postman

Opens this request in the public API documentation, the official source of the reference.

Description

Adds products to the contract with the price of each one, or updates the price of those already in it. Each product is processed independently: the result of each one comes in the status field of the response.

Send from 1 to 100 products per request.

Path Parameters

Parameter Type Required Description
contractId integer Yes Contract id, returned in id on creation.

Request Body (JSON)

Field Type Required Description
items array Yes From 1 to 100 products.
Product identification — not a field, a group — Yes One of the two forms in the How to identify the product section: items[].partnerPartCode · items[].skuAttributeValue with skuAttributeName.
items[].price number No Product price in the contract. Cannot be negative.
items[].targetMargin number No Target margin of the product in the contract, from 0 to 100.
items[].totalCost number No Total cost of the product. Cannot be negative.
items[].priceTypeId integer No Price type to which this product is restricted within the contract.
skuAttributeName string Conditional Name of the attribute used to resolve items[].skuAttributeValue. Required when you identify products by attribute. It applies to the whole submission, not per item.

items[].value is the legacy name of items[].price and is still accepted, with the same effect. If you send both in the same item, price prevails.

How to identify the product

Each product must carry one of the two forms, in this order of precedence:

Form Fields When to use
By partner code partnerPartCode You identify the product by your own code.
By attribute skuAttributeValue with skuAttributeName in the envelope You have contracted the product catalog service with your own attribute.

Unlike the inventory submission, different forms can coexist in the same submission: each product is resolved by the form it carries.

Business rules

The product must belong to the store

The product is resolved within the catalog of the store that owns the contract. Whatever does not resolve comes back in notFound.items and the others are stored.

A product repeated in the same submission is not processed

Two products in the same submission that resolve to the same SKU — through the repeated code or through the attribute — both go to notFound.items and neither is stored. Send each product only once per request.

A product rejected for its value comes back in the list, it does not bring down the submission

Negative price, negative cost, margin outside 0 to 100 and a product without any form of identification are rejected item by item: the product comes back in items with status: ERROR and the reason in error, and the others are stored. The response is 200.

Response · 200

Field Description
id Contract id.
items[].skuId SKU id resolved by the platform. It is absent in a rejected product that carried no identification.
items[].price Stored price.
items[].targetMargin · items[].totalCost Stored target margin and cost. They come back null when you do not send them.
items[].status inserted new product in the contract · updated product that was already there and changed value · unchanged product that was already there with the same values · ERROR rejected product.
items[].error Reason for the rejection. Present only when status is ERROR.
items[].partnerPartCode · items[].skuAttributeValue Echo of the identification you sent, in the rejected product.
notFound.items Products you sent that were not resolved in the store catalog, or that were repeated in the submission.

Errors

Code When
400 The contractId in the path is not a number greater than zero: {"error":"invalid contract id: \"...\""}.
400 The body is not valid JSON. The detail comes in error.
400 The contract does not exist or does not belong to the store of the token: {"error":"priceContract.notFound"}.
422 items missing, empty or with more than 100 entries. The detail comes in error.
401 Token missing, malformed or expired.

Example request

curl --request PUT 'https://ws.autorei.net/pricing/contract/:contractId/items' \
  --header 'Authorization: Bearer {{access_token}}' \
  --header 'Content-Type: application/json' \
  --data '{
  "items": [
    {
      "partnerPartCode": "SKU-A-001",
      "price": 149.9,
      "targetMargin": 18.5,
      "totalCost": 120.0
    },
    {
      "partnerPartCode": "SKU-B-002",
      "price": 89.9
    }
  ]
}'

Example responses

200Success — identification by partner code

{
  "id": 4610001,
  "items": [
    {
      "skuId": 500101,
      "price": 149.9,
      "targetMargin": 18.5,
      "totalCost": 120,
      "status": "inserted"
    },
    {
      "skuId": 500102,
      "price": 89.9,
      "targetMargin": null,
      "totalCost": null,
      "status": "inserted"
    }
  ],
  "notFound": {
    "items": []
  }
}

200Success — identification by attribute, with a rejected item

{
  "id": 4610001,
  "items": [
    {
      "skuId": 500101,
      "price": 139.9,
      "targetMargin": null,
      "totalCost": null,
      "status": "updated"
    },
    {
      "price": 50,
      "targetMargin": null,
      "totalCost": null,
      "status": "ERROR",
      "error": "must provide skuId, partnerPartCode, or skuAttributeValue"
    }
  ],
  "notFound": {
    "items": [
      {
        "skuAttributeValue": "SKU-Z-999",
        "price": 10,
        "targetMargin": null,
        "totalCost": null
      }
    ]
  }
}

Used in

Generated from the public API collection, published on 2026-09-04: api-docs.cws.digital.