---
title: "Import open invoices as opening balances"
method: POST
path: "/bulk/invoices/import"
tags: ["Imports"]
---

# Import open invoices as opening balances

`POST /bulk/invoices/import`

## Request

- Base URL: `https://ledgerhq.pro/api/v1`
- URL: `https://ledgerhq.pro/api/v1/bulk/invoices/import`
- Auth: one of:
  - HTTP bearer and API key in header `x-organization-id`
  - HTTP bearer and API key in header `x-organization-id`

Import unpaid invoices from a raw QBO Open Invoices / A/R Aging Detail CSV (csvContent) or pre-mapped rows. NOTHING POSTS to the ledger: each invoice becomes an opening-balance detail row (status sent, openingBalance true, no journal entry) carrying its open balance — the A/R itself arrives with the company's GL/opening balances. Invoice numbers are kept as-is. Customer-capable contacts must already exist for every new invoice (manual customers count); if any required customer is missing, the whole import is refused with HTTP 409 and code open_invoice_customers_missing before any mutation. Re-running skips already-imported numbers without requiring those old customers again. Response includes importedBalanceCents to compare against the Accounts Receivable account.

## Request body

- object
  - `fileName` string, required
  - `csvContent` string: Raw QBO Open Invoices / A/R Aging Detail CSV export as of the switch date, unchanged
  - `rows` object[]: Alternative to csvContent: pre-mapped rows in integer cents
    - `invoiceNumber` string, required
    - `contactName` string, required
    - `issueDate` string, date, required
    - `dueDate` string, date
    - `totalCents` integer
    - `openBalanceCents` integer, required

## Response `201`

Import job result with importedBalanceCents

## Other responses

- `409`: Customer prerequisite missing. No import job or invoices were created. Body includes code open_invoice_customers_missing, missingCustomers, missingCustomerCount, matchedCustomerCount, candidateInvoiceRows, and nextAction.
- `default`: Error response

---

[API](https://skmtc.dev/ledgerhq-pro/apis/ledgerhq-bookkeeping-api.md) · [All operations](https://skmtc.dev/ledgerhq-pro/apis/ledgerhq-bookkeeping-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ledgerhq-pro/apis/ledgerhq-bookkeeping-api/revisions/9a8269f0a586?raw)
