# Branches for Customer Records

[Web version](https://docs.eis.it/en/changelog/2026/11/11)

## Main seats and branches

To create a new branch location with `POST /v1/customers/add`, use `type: BRANCH` and `mainCustomerId` with the ID of the main office. The fields already required to create a customer record remain necessary. With multi-site enabled, the locations must have the same VAT number.

To connect existing customer records, use `PUT /v1/customers/update/{id}/{organizationId}/main-customer/branches`, where `id` is the headquarters:

```json
{
  "secondaryCustomerIds": [102, 103]
}
```

The operation maintains the other branches already connected. The IDs must be distinguished and different from the main office; the customer records must belong to the same organization and do not have their own branches.

They are also documented:

- `GET /v1/customers/{id}/{organizationId}/branches`: list of visible branches; returns 404 even if they are not present.
- `POST /v1/customers/{id}/{organizationId}/main-customer/branches/check-duplicates`: Preliminary control with the same body, without modification. Report duplicates, existing links and incompatibility.
- `PUT /v1/customers/update/{id}/{organizationId}/main-customer/branches/replace`: replacement of the whole list. Excluded locations are disconnected; a blank list attempts to disconnect them all.
- `PUT /v1/customers/update/{id}/{organizationId}/main-customer`: connection of a single branch, with `id` of the branch and body `{"mainCustomerId": 101}`.
- `DELETE /v1/customers/update/{id}/{organizationId}/main-customer`: removal of the link of the indicated branch, if permitted by multi-site rules.

Preliminary consultation and control require `customers_view`; changes require `customers_edit`. The answers of the customer records document now also `type` and the canonical field `mainCustomerId`.
