> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.coperniq.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.coperniq.io/_mcp/server.

## Bills

### New: Bills endpoints

You can now create, read, update, and delete bills on projects via the public API.

| Method   | Path                          | Description                |
| -------- | ----------------------------- | -------------------------- |
| `GET`    | `/bills`                      | List all bills (paginated) |
| `POST`   | `/bills`                      | Create a bill              |
| `GET`    | `/bills/{billId}`             | Get a bill by ID           |
| `PATCH`  | `/bills/{billId}`             | Update a bill              |
| `DELETE` | `/bills/{billId}`             | Delete a bill              |
| `GET`    | `/projects/{projectId}/bills` | List bills for a project   |

Bills support two calculation methods:

* **`LINE_ITEMS`** — itemised bill with one or more line items. Each line item requires `catalogItemId`, `quantity`, `unitCost` (must be > 0), and `unitPrice` (may be negative for discounts).
* **`PERCENTAGE`** — percentage of the project's base amount (0–100).

#### Create a LINE_ITEMS bill

```
POST /bills
```

```json
{
  "recordId": 789225,
  "calculationMethod": "LINE_ITEMS",
  "lineItems": [
    {
      "catalogItemId": 5884,
      "quantity": 2,
      "unitCost": 100,
      "unitPrice": 150
    }
  ],
  "dueDate": "2026-05-01T00:00:00.000Z",
  "description": "Materials and labor"
}
```

#### Create a PERCENTAGE bill

```
POST /bills
```

```json
{
  "recordId": 789225,
  "calculationMethod": "PERCENTAGE",
  "percentage": 25,
  "dueDate": "2026-05-01T00:00:00.000Z"
}
```

#### Business rules

* `calculationMethod` cannot be changed after creation.
* `PERCENTAGE` bills cannot have `issueDate` or `status`.
* `LINE_ITEMS` bills: when `issueDate` is provided, `status` must also be provided and must not be `DRAFT`.
* `unitCost` must be greater than 0 for all line items.
* `percentage` must be between 0 and 100.

---

## Nullable fields on project, account, and client updates

### Improvement: Clear fields by passing `null`

You can now explicitly clear nullable fields on projects, accounts, and clients by passing `null` in a `PATCH` request. Previously, `null` values were ignored and the existing value was left unchanged.

This applies to the following endpoints:

* `PATCH /projects/{projectId}`
* `PATCH /accounts/{accountId}`
* `PATCH /clients/{clientId}`

#### Clearable fields

| Resource | Fields                                                                                                      |
| -------- | ----------------------------------------------------------------------------------------------------------- |
| Project  | `description`, `primaryEmail`, `primaryPhone`, `value`, `size`, `ownerId`, `salesRepId`, `projectManagerId` |
| Account  | `description`, `primaryEmail`, `primaryPhone`, `ownerId`                                                    |
| Client   | `description`, `primaryEmail`, `primaryPhone`, `ownerId`                                                    |

Custom properties (via the `custom` object) can also be cleared by passing `null` for any key.

#### Example

```
PATCH /projects/{projectId}
```

```json
{
  "description": null,
  "ownerId": null,
  "custom": {
    "pud_incentive": null
  }
}
```

This will clear `description`, unassign the owner, and clear the `pud_incentive` custom property on the project.

Omitting a field entirely still leaves the existing value unchanged.