Skip to content
platform

API reference · Contracts · Store Management

Update Contract

Method
PUT
Route
/pricing/contract/:contractId
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

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

It also serves to empty the contract at once, with deleteAllItems and deleteAllCustomers.

Path parameters

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

Request body (JSON)

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

Field Type Required Description
active boolean No Activates or deactivates the contract.
dateStart datetime No New start of the validity period. Same formats as creation.
dateEnd datetime No New end of the validity period.
allCustomers boolean No Makes the contract valid for all of the store's customers, or restricts it again to the customers in the list.
allPartners boolean No Makes the contract valid for all of the store's branches, or restricts it again to the branches in the list.
stateList array No States where the contract is valid. See Adding or replacing filters.
partners array No Ids of the branches where the contract is valid. See Adding or replacing filters.
customerGroupList array No Contract customer groups, each by externalId. See Adding or replacing filters.
deleteAllItems boolean No true removes all products from the contract.
deleteAllCustomers boolean No true removes all customers from the contract.
replaceFilters boolean No Defines how the filters sent combine with the ones that already exist. Default false. See Adding or replacing filters.

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

Business rules

Adding or replacing 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's filters become exactly the ones you sent.

Response · 200

Field Description
id Contract id.
active Contract status after the update.
allCustomers · allPartners Scope after the update.
replaceFilters Echo of the combination mode used on the filters.
priceContractPartners Contract branches after the update, each with id, name and document.
priceContractStates Contract states after the update.
priceContractCustomerGroups Customer group ids after the update.

Errors

Code When
400 The path 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 token's store: {"error":"priceContract.notFound"}.
422 Empty body or none of the fields above filled in. The detail comes in error.
401 Token missing, malformed or expired.

Example request

curl --request PUT 'https://ws.autorei.net/pricing/contract/:contractId' \
  --header 'Authorization: Bearer {{access_token}}' \
  --header 'Content-Type: application/json' \
  --data '{
  "active": true,
  "dateEnd": "2027-06-30",
  "partners": [
    5057
  ],
  "stateList": [
    "RJ"
  ],
  "replaceFilters": true
}'

Example responses

200Success — validity period and filters updated

{
  "id": 4610001,
  "active": true,
  "allCustomers": false,
  "allPartners": false,
  "replaceFilters": true,
  "priceContractPartners": [
    {
      "id": 5057,
      "name": "Loja Exemplo - Filial Campinas",
      "document": "30.424.972/0002-55"
    }
  ],
  "priceContractStates": [
    "RJ"
  ],
  "priceContractCustomerGroups": [
    4610101
  ]
}

Used in

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