Skip to content
platform

API reference · Contracts · Head Office Management

Add Products to Branch Contract

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

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

Description

Allows a head office account to add products to the contract of one of its branches with the price of each, or update the price of those already in it. Each product is processed independently: the result for each one comes in the status field of the response.

The body and the response are identical to those of the submission for the store itself — the difference is the branch that owns the contract, which comes in the route and is validated against your head office's links.

Path parameters

Parameter Type Required Description
contractId integer Yes Contract id, returned in id at creation.
partnerId integer Yes Id of the branch that owns the contract. Must be linked to the token's head office.

Request body (JSON)

Field Type Required Description
items array Yes From 1 to 100 products.
Product identification — not a field, it is 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 Product target margin 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 the products by attribute. 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 rest are saved.

A product repeated in the same submission is not processed

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

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

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

Response · 200

Field Description
id Contract id.
items[].skuId SKU id resolved by the platform. Absent in a rejected product that carried no identification.
items[].price Price saved.
items[].targetMargin · items[].totalCost Target margin and cost saved. Come as 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 branch catalog, or that were repeated in the submission.

Errors

Code When
400 The route's partnerId is not numeric: {"error":"Invalid target partner ID"}.
400 The route's contractId 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 branch informed: {"error":"priceContract.notFound"}.
422 items missing, empty or with more than 100 entries. The detail comes in error.
401 Token missing, malformed or expired: {"error":"Authentication required for this route"}.
403 The branch is not linked to your head office: {"error":"Access denied: Invalid partnership"}. Unlike 400, here the payload is correct — what is missing is the link.

Example request

curl --request PUT 'https://ws.autorei.net/pricing/contract/:contractId/items/store/:partnerId' \
  --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": 4610002,
  "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 rejected item

{
  "id": 4610002,
  "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.