> 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.

## Integrations and their sync history

### New: `GET /integrations`

Lists your company's native integration connections: accounting (QuickBooks, NetSuite, Xero, Sage Intacct), proposal tools (Aurora, OpenSolar, Solargraf), distributors (ABC Supply, SRS), measurement reports (EagleView), financiers (LightReach) and CRM (Salesforce). It takes no parameters.

```json
[
  {
    "id": 31,
    "type": "QUICKBOOKS",
    "category": "ACCOUNTING",
    "environment": "PRODUCTION",
    "invoiceEnabled": true,
    "createdAt": "2026-03-12T16:20:41.000Z",
    "updatedAt": "2026-11-02T09:15:03.000Z"
  }
]
```

* `type` and `category` are strings. New types are added over time, so don't treat them as a closed list.
* Credentials and connection settings are never returned.

### New: `GET /integration-logs`

Lists the Integration History Log, the same sync attempts you see under Company Settings, so you can build your own alerts when a sync fails. Paginated and limited to your company.

* **Filters:** `integration_id` (an `id` from `GET /integrations`), `status` (`SUCCESS`, `FAILED` or `IN_PROGRESS`), `created_after` and `created_before` (ISO 8601 with an offset, for example `2026-11-01T00:00:00Z`).
* **Paging and order:** `page`, `page_size` (default 20, max 100) and `order_by` (`asc` or `desc` on `createdAt`, default `desc`).
* An `integration_id` that doesn't exist, or belongs to another company, returns an empty list.

```bash
curl "https://api.coperniq.io/v1/integration-logs?status=FAILED&created_after=2026-11-01T00:00:00Z" \
  -H "x-api-key: YOUR_API_KEY"
```

```json
[
  {
    "id": 90412,
    "integrationId": 31,
    "integrationType": "QUICKBOOKS",
    "status": "FAILED",
    "createdAt": "2026-11-02T17:04:11.000Z",
    "record": { "id": 10452, "title": "Smith Residence", "type": "Project" },
    "errorMessage": "Account period closed",
    "trigger": { "event": "INVOICE_CREATED", "entity": "INVOICE", "id": 5821 }
  }
]
```

* `record` is the project, account or opportunity the sync ran for, or `null`.
* `errorMessage` is the error text of a failed invoice or payment sync, up to 500 characters. It is `null` for other statuses, and for failures that carry no error text (for example a failed customer or job creation).
* `trigger` says what started the sync: `event` (for example `INVOICE_CREATED` or `PAYMENT_RECORD_CREATED`), the `entity` and its `id`. For proposal tools, `event` is the proposal event and `entity` and `id` are `null`. It is `null` when nothing is recorded.
* **Failed syncs:** a sync stays `IN_PROGRESS` while it is being retried and becomes `FAILED` only after the last retry, so `status=FAILED` is safe to alert on.
* **Invoice updates:** invoice failures are always labeled `INVOICE_CREATED` in `trigger.event`, even when the sync was triggered by an invoice update.
* Raw sync payloads are never returned.

## Deleting invoices and bills

### Fixed: `DELETE /invoices/{invoice_id}` and `DELETE /bills/{bill_id}`

* **Wrong document type:** each endpoint now checks the document type first. Sending a bill ID to `DELETE /invoices/{invoice_id}`, or an invoice ID to `DELETE /bills/{bill_id}`, returns `404` and deletes nothing. Before, it deleted the other document.
* **Active invoices:** `DELETE /invoices/{invoice_id}` now archives the invoice before deleting it, as `DELETE /bills/{bill_id}` already did, so an active invoice no longer fails with `400 Only archived financial documents can be deleted`.
* **Refused deletes:** if the delete is refused after the archive (for example your role lacks the delete permission), the document is restored to active and you get the original error.
* **Material orders:** `DELETE /material-orders/{material_order_id}` restores the material order the same way when its delete is refused, and no longer archives one that is already archived.