API reference · Contracts · Head Office Management
Add Customers to Branch Contract
- Method
- PUT
- Route
-
/pricing/contract/:contractId/customers/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 add customers to a contract of one of its branches, by the document of each one. The customers start receiving the contract prices.
The body and the response are identical to those of the addition 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 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 |
|---|---|---|---|
customers |
array | Yes | Customer documents, as strings. From 1 to 100 per request, with at least one filled in. |
Business rules
A contract for all customers does not accept individual customers
A contract created with allCustomers: true already applies to all of the branch's customers and rejects the addition with 400 and priceContract.customers.addNotAllowed. To build a list of customers, the contract must have allCustomers: false.
A document that does not exist in the database comes back in notFound
The customer must exist on the platform, but does not need to have bought from your store. A document that does not resolve does not interrupt the request: it comes back in notFound.customers and the rest are saved. The response is 200 even when no document resolved.
Response · 200
| Field | Description |
|---|---|
id |
Contract id. |
customers |
Documents that were linked to the contract. |
notFound.customers |
Documents you sent that were not found on the platform. |
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"}. |
| 400 | The contract applies to all customers and does not accept individual customers: {"error":"priceContract.customers.addNotAllowed"}. |
| 422 | customers missing, empty, with more than 100 entries or with only empty strings. 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/customers/store/:partnerId' \
--header 'Authorization: Bearer {{access_token}}' \
--header 'Content-Type: application/json' \
--data '{
"customers": [
"29893264000101",
"70041364856"
]
}' Example responses
200Success — one customer linked and one not found
{
"id": 4610002,
"customers": [
"29893264000101"
],
"notFound": {
"customers": [
"70041364856"
]
}
} 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.