---
title: "Merge a duplicate bank account into the account being kept"
method: POST
path: "/accounts/{accountId}/merge"
tags: ["Accounting"]
---

# Merge a duplicate bank account into the account being kept

`POST /accounts/{accountId}/merge`

## Request

- Base URL: `https://ledgerhq.pro/api/v1`
- URL: `https://ledgerhq.pro/api/v1/accounts/{accountId}/merge`
- Auth: one of:
  - HTTP bearer and API key in header `x-organization-id`
  - HTTP bearer and API key in header `x-organization-id`

Moves the duplicate chart account's journal lines, bank transactions, statements, and check evidence to the target account and its register, adds the duplicate register's cached balance (integer cents) to the target register, clears the duplicate's statement-request settings, and soft-deletes the duplicate account and register in one transaction with an audit record. Both accounts need one active register with the same type and currency. Refuses reconciliations, a bank feed on the duplicate, other linked records, and activity in a closed fiscal year. dryRun=true validates and returns the same counts without saving.

## Path parameters

- `accountId` string, uuid, required

## Request body

- object
  - `targetAccountId` string, uuid, required: Chart account UUID to keep
  - `reason` string, required
  - `dryRun` boolean

## Response `200`

data: source, target (priorBalanceCents, sourceBalanceCents, balanceCents), counts, dryRun

## Other responses

- `409`: Accounts are incompatible, the duplicate has records a merge cannot move, or activity falls in a closed fiscal year
- `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)
