API reference · Contracts · Head Office Management
Update Branch Contract
- Method
- PUT
- Route
-
/pricing/contract/:contractId/store/:partnerId - Base URL
https://ws.autorei.net- Path parameters
:contractId:partnerId- Token
- Requires Bearer token
Opens this request in the public API documentation, the official source of the reference.
Description
Allows a head office account to update part of the header of a contract of one of its branches: status, validity period, coverage and application filters. It is a partial update — send only the fields you want to change, and at least one of them.
The body and the response are identical to those of the update in 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 on creation. |
partnerId |
integer | Yes | Id of the branch that owns the contract. It must be linked to the token's head office. |
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 validity start. Same formats as creation. |
dateEnd |
datetime | No | New validity end. |
allCustomers |
boolean | No | Makes the contract apply to all of the branch's customers, or restricts it again to the customers on the list. |
allPartners |
boolean | No | Makes the contract apply to all of the head office's branches, or restricts it again to the branches on the list. |
stateList |
array | No | States (UF) where the contract applies. See Add or replace filters. |
partners |
array | No | Ids of the branches where the contract applies. See Add or replace filters. |
customerGroupList |
array | No | Contract customer groups, each by externalId. See Add or replace 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 Add or replace 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
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's filters become exactly the ones you sent.
Response · 200
| Field | Description |
|---|---|
id |
Contract id. |
active |
Contract status after the update. |
allCustomers · allPartners |
Coverage 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 (UF) after the update. |
priceContractCustomerGroups |
Ids of the customer groups after the update. |
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 given branch: {"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: {"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 right — what is missing is the link. |
Example request
curl --request PUT 'https://ws.autorei.net/pricing/contract/:contractId/store/:partnerId' \
--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": 4610002,
"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
Related endpoints
- DELETE Remove Customers from Branch Contract
/pricing/contract/:contractId/customers/store/:partnerId
Generated from the public API collection, published on 2026-09-04: api-docs.cws.digital.