API reference · Contracts

Add Customers to the Branch Contract

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

Description

Allows a parent account to add customers to a contract of one of its branches, by each one's document. The customers start receiving the contract prices.

The body and the response are identical to those of the addition in your own store — the difference is the branch that owns the contract, which comes in the route and is validated against the links of your parent account.

Parameters

Path parameters

FieldTypeRequiredDescriptionValue
contractIdintegerYes

Contract id, returned in id on creation.

partnerIdintegerYes

Id of the branch that owns the contract. It must be linked to the token's parent account.

Request body

Content-Typeapplication/jsonRequired
Edit the body with
FieldTypeRequiredDescriptionValue
customersarray of stringYes

Customer documents, as strings with the mask (CPF 000.000.000-00, CNPJ 00.000.000/0000-00). From 1 to 100 per request, with at least one filled in.

Separate values with commas or line breaks.

Business rules

A contract for all customers does not take individual customers

A contract created with allCustomers: true already applies to all customers of the branch and rejects the addition with 400 and priceContract.customers.addNotAllowed. To build a customer list, 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.

The document goes with the mask — CPF 000.000.000-00, CNPJ 00.000.000/0000-00: with digits only it is not found and comes back in notFound.customers, even if the customer exists.

A document that does not resolve does not interrupt the request: it comes back in notFound.customers and the others are stored. The response is 200 even when no document resolved.

Responses

  • 403

    Branch not linked to your parent account.

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}/customers/store/{partnerId}' \
  --globoff \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "customers": [
    "57.578.030/0001-05",
    "466.935.373-08"
  ]
}'

Response

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