API reference · Contracts

Create Contract

POSThttps://api.sandbox.cws.digital/priceContract

Description

Creates a price contract: the table of special prices that the store applies to a set of customers during a period.

The creation stores the contract header — validity period, scope and application filters. Customers and products come in later, through Add Customers to the Contract and Add Products to the Contract.

The store is always the token's store. To create the contract of a branch, use Create Branch Contract.

Request body

Content-Typeapplication/jsonRequired
Edit the body with
FieldTypeRequiredDescriptionValue
namestringYes

Contract name.

startDatestringYes

Start of the validity period, in the format 2026-09-01T08:30:00.

endDatestringYes

End of the validity period, in the format 2026-09-01T08:30:00. It must be equal to or later than startDate.

allCustomersbooleanYes

true applies the contract to all customers of the store. See Customer scope.

allPartnersbooleanYes

true applies the contract to all branches of the store. With true, partners is ignored.

activebooleanNo

Active contract. Default true. Only an active contract within its validity period enters the price calculation.

priorityintegerNo

Priority in the dispute between contracts. Default 0. See Which contract wins.

contractTypestringNo

BASIC (default) or COUNTDOWN. See Countdown offer.

priceBeforeAfterbooleanNo

true returns the product list price as the previous price, for the "from/to" display. See Countdown offer.

isDiscountBlockedByAttendantbooleanNo

true prevents the attendant from giving a discount on the contract price in the cart.

stateListarray of stringNo

Abbreviations of the Brazilian states where the contract applies, with two uppercase letters: ["SP","MG"]. Without the list, the contract applies in any state.

Separate values with commas or line breaks.
storeListarray of integerNo

Ids of the stores where the contract applies. Without the list, it applies in any store.

Separate values with commas or line breaks.
partnersarray of integerNo

Ids of the branches where the contract applies. Ignored when allPartners is true.

Separate values with commas or line breaks.
customerGroupListarray of objectNo

Customer groups (price types) that the contract reaches.

Fields in customerGroupList[]

Items of customerGroupList[]
customerGroupList[]
FieldTypeRequiredDescriptionValue
externalIdstringYes

Id of the group in your system, resolved to the platform id.

Business rules

Customer scope

allCustomers: true applies the contract to all customers of the store, and the contract starts rejecting the addition of individual customers with 400.

With allCustomers: false, the contract applies only to the customers you add later, one by one.

Which contract wins

When more than one active contract reaches the same product for the same customer, the one with the highest priority wins. With tied priority, the contract restricted to specific customers wins over the one that applies to all customers. If the tie persists, the oldest contract wins.

Countdown offer

contractType: COUNTDOWN marks the contract as a countdown offer: the returned price starts carrying the discount and the end date of the offer.

The countdown contract only enters the price calculation with priceBeforeAfter: true.

Responses

Try it

Sandbox

Language

Credentials

Access token: saved in this tab and used on every endpoint.

Each token only reaches the partner's own data and that of the branches with an authorized link.

Don't have sandbox credentials yet? See how to request them

Request

cURL
curl --request POST \
  --url 'https://api.sandbox.cws.digital/priceContract' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Tabela Atacado 2026",
  "startDate": "2026-09-01T00:00:00",
  "endDate": "2026-12-31T23:59:59",
  "allCustomers": false,
  "allPartners": false,
  "active": true,
  "priority": 10,
  "contractType": "BASIC",
  "isDiscountBlockedByAttendant": false,
  "stateList": [
    "SP",
    "MG"
  ],
  "customerGroupList": [
    {
      "externalId": "GRUPO-ATACADO"
    }
  ]
}'

Response

Click Try it to see the real response here, or pick a documented example: