Confirm bill import

POST https://app.speybooks.com/api/v1/bill-imports/{id}/confirm

Confirm a bill import, atomically creating bills with line items, posting contra-wash clearing journal entries, and recording synthetic payments for partially paid bills.

For each valid row:

  1. Auto-creates the supplier contact if unmatched
  2. Creates the bill (status based on payment: sent, partial, or paid)
  3. Posts a clearing journal: DR MC_AP, CR Trade Creditors
  4. If partially paid, posts a synthetic payment: DR Trade Creditors, CR Suspense (9999)

The clearing zero-sum invariant is verified at commit — if MC_AP does not net to zero, the entire transaction is rolled back.

Path parameters

id string required
Data import ID (e.g. dimp_4). Must be in pending status with canConfirm: true.

Response

200 Import confirmed. Returns documentsCreated, syntheticPaymentsCreated, clearingBalance (should be 0), direction, and engineVersion.
Show response fields
clearingBalance integer
direction string
documentsCreated integer
engineVersion string
syntheticPaymentsCreated integer

Error codes

404 Pending bill import not found.
409 An active bill import was confirmed concurrently (singleton violation).
422 Import not confirmable: canConfirm is false, missing accounts, or clearing imbalance on commit.