LedgerHQ
Guides

API Integration

Build the current partner integration flow against LedgerHQ REST.

This guide covers the public REST flow that exists today for partner developers. It does not document older app modules or unvalidated internal routes.

Setup

Read the OpenAPI contract

https://app.ledgerhq.pro/api/openapi.json

Connect once with OAuth

Partner apps should use account-level OAuth from a LedgerHQ firm owner/admin. The connected token represents the firm account, not one client file:

GET  /api/oauth/authorize
POST /api/oauth/token

Map client companies

List client companies managed by the connected firm, then store the selected organization against the partner client record:

GET /api/v1/organizations?limit=250&type=client&cursor=...
Authorization: Bearer mcp_at_your_token

Resolve accounts

Call /api/v1/accounts and /api/v1/bank-accounts with the mapped x-organization-id to connect external source accounts to chart accounts and bank accounts.

Preferred Posting Flow

Use resource posting endpoints for normal accounting events:

  1. Resolve the account IDs, contact IDs, tax codes, and bill IDs needed by the source transaction.
  2. Send the transaction to /api/v1/purchases, /api/v1/deposits, /api/v1/transfers, /api/v1/bill-payments, or /api/v1/journal-entries.
  3. Include an Idempotency-Key generated from the source system transaction ID.
  4. Store the returned journalEntryId and any bankTransactionIds against the source transaction.
  5. Retry safely with the same idempotency key when the network or client process fails before receiving the receipt.

Posting endpoints create posted accounting entries immediately and create bank-register rows when a bank-linked account is involved.

Bank Activity Flow

Bank and card activity arrives through Plaid-connected feeds that sync internally on a webhook-driven basis. There is no public "import rows" endpoint; synced rows land as bank transactions with sourceType: "plaid_bank_feed".

  1. List bank accounts (/api/v1/bank-accounts) and bank feeds (/api/v1/bank-feeds) to confirm connected activity.
  2. List synced rows from /api/v1/bank-transactions or the bank-account transaction list.
  3. Reclassify account/contact/tax fields when review changes a category.
  4. Match, split, reconcile, or exclude transactions.
  5. Pull /api/v1/reports/financial-packet for report rendering.

Reclassify

curl -X POST \
  -H "Authorization: Bearer mcp_at_your_token" \
  -H "x-organization-id: org_id" \
  -H "Content-Type: application/json" \
  -d '{
    "accountId": "expense_account_id",
    "journalLineId": "journal_line_id",
    "reason": "Account review"
  }' \
  https://app.ledgerhq.pro/api/v1/bank-transactions/bank_transaction_id/reclassify

Behavior:

  • Updates the bank transaction classification fields.
  • Updates the selected editable non-bank journal line when a linked entry exists.
  • Requires journalLineId for multi-line linked entries.
  • Rejects period-locked or void entries.

Financial Packet JSON

curl -H "Authorization: Bearer mcp_at_your_token" \
  -H "x-organization-id: org_id" \
  "https://app.ledgerhq.pro/api/v1/reports/financial-packet?startDate=2026-01-01&endDate=2026-06-30"

The API returns report packet JSON with integer-cent amounts. Partner apps render PDF or HTML packets from that JSON.

On this page