# CompanyBranch

A company branch: one of the organisation's own locations, used to group the customers a branch is responsible for. Deleting one un-assigns its customers rather than blocking.

## Used by
- GET /api/v2/company-branches: List company branches (CompanyBranchList)
- POST /api/v2/company-branches: Create a company branch (CompanyBranch)
- GET /api/v2/company-branches/{company_branch}: Read a company branch (CompanyBranch)
- PATCH /api/v2/company-branches/{company_branch}: Update a company branch (CompanyBranch)

## CompanyBranch fields
- id (integer, required): Unique identifier.
- name (string ≤ 255, required): Branch name as shown in the UI, e.g. Rotterdam.
- created_at (timestamp (YYYY-MM-DDThh:mm:ssZ), required): Creation timestamp.
- updated_at (timestamp (YYYY-MM-DDThh:mm:ssZ), required): Last-write timestamp; use for incremental sync.
- customers_count (integer ≥ 0, required): Number of customers assigned to this branch.
- links (CompanyBranchLinks, required)
  - self (url, required): The canonical URI of this record.
  - customers (url, required): Customers assigned to this branch.

## Variants

### CompanyBranchList

What a collection returns, and what `?view=summary` returns on a single record.

6 fields.
Identical to the detail object above.

### CompanyBranchSummary

The embedded form: what you get when another resource carries this one and you did not `include` it.

2 fields.
Omits: created_at, updated_at, customers_count, links

### CompanyBranchLinks

The `links` object on this resource.

Keys: self, customers

## Example
```json
{
  "id": 1,
  "name": "Rotterdam",
  "created_at": "2026-03-04T09:15:00Z",
  "updated_at": "2026-03-04T09:15:00Z",
  "customers_count": 1,
  "links": {
    "self": "https://<your-url>/api/v2/work-items/1",
    "customers": "https://<your-url>/api/v2/work-items/1"
  }
}
```
