API reference · Contracts

Update Contract

PUThttps://api.sandbox.cws.digital/pricing/contract/{contractId}

Description

Updates part of the header of a contract: status, validity period, scope and application filters. It is a partial update — send only the fields you want to change.

It also empties the contract at once, with deleteAllItems and deleteAllCustomers.

All fields are optional, but the body must bring at least one of them filled in.

The name, the type and the products and customers of the contract are not part of this body: the validity period is updated through dateStart and dateEnd, and customers and products through their own endpoints.

Parameters

Path parameters

FieldTypeRequiredDescriptionValue
contractIdintegerYes

Contract id, returned in id on creation.

Request body

Content-Typeapplication/jsonRequired
Edit the body with
FieldTypeRequiredDescriptionValue
activebooleanNo

Activates or deactivates the contract.

dateStartstringNo

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

dateEndstringNo

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

allCustomersbooleanNo

Makes the contract apply to all customers of the store, or restricts it back to the customers in the list.

allPartnersbooleanNo

Makes the contract apply to all branches of the store, or restricts it back to the branches in the list.

stateListarray of stringNo

States where the contract applies. See Add or replace filters.

Separate values with commas or line breaks.
partnersarray of integerNo

Ids of the branches where the contract applies. See Add or replace filters.

Separate values with commas or line breaks.
customerGroupListarray of objectNo

Customer groups of the contract, each one by externalId. See Add or replace filters.

Fields in customerGroupList[]

deleteAllItemsbooleanNo

true removes all products from the contract.

deleteAllCustomersbooleanNo

true removes all customers from the contract.

replaceFiltersbooleanNo

Defines how the filters sent are combined with the existing ones. Default false. See Add or replace filters.

Items of customerGroupList[]
customerGroupList[]
FieldTypeRequiredDescriptionValue
externalIdstringYes

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

Business rules

Add or replace filters

With replaceFilters: false (the default), the states, branches and groups sent are added to the ones the contract already has.

With replaceFilters: true, the contract filters become exactly the ones you sent.

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 PUT \
  --url 'https://api.sandbox.cws.digital/pricing/contract/{contractId}' \
  --globoff \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "active": true,
  "dateEnd": "2027-06-30T23:59:59",
  "partners": [
    5057
  ],
  "stateList": [
    "RJ"
  ],
  "replaceFilters": true
}'

Response

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