> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bachs.io/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Money is always a decimal string at the currency's precision (for example "29.00"), paired with an ISO 4217 currency field. Never use minor units.
> Build against the sandbox first: base URL https://sandbox-api.bachs.io with sk_sandbox_ keys. Production is https://api.bachs.io with sk_live_ keys; going live is a key swap.
> Treat webhooks (for example collection.succeeded) as the source of truth for fulfilment, never client-side events or redirects.
> Subscriptions are created by completing a checkout for a recurring product. There is no direct create-subscription endpoint.
> IDs carry resource prefixes (cust_, prod_, sub_, chk_, inv_, ref_) and timestamps are ISO 8601 UTC.

# Remove a connected account

> Check an account's balances and obligations, then close it while retaining its records and financial history.

In this guide you check whether a platform-owned account can close, resolve any
outstanding obligations, and remove it through the dashboard or API. Removal is
always a soft deletion: access and new activity stop, while the account and its
financial history remain stored. It does not request personal-data erasure.

> [!WARNING]
>
> You cannot restore the account from the dashboard. Confirm the account ID and
> clear its balances and obligations before you remove it.

## Prerequisites

* Your platform's secret key from the same environment as the account.
* `connected_accounts:read` to check eligibility and `connected_accounts:write`
  to remove the account. See [Permissions](https://docs.bachs.io/api-reference/permissions.md).
* An account owned directly by your platform. OAuth access to an independent
  business does not give you permission to close it.

## Remove through the API

These examples use sandbox. Use your own sandbox account and key; no real money
moves. The full contracts are [Check account closure](https://docs.bachs.io/api-reference/accounts/check-account-closure.md)
and [Delete a connected account](https://docs.bachs.io/api-reference/accounts/delete-a-connected-account.md).

**1. Check whether the account can close**

Read every blocker before asking for confirmation.

```bash cURL theme={"dark"}
curl https://sandbox-api.bachs.io/v1/accounts/acct_3Wq8ZfT1yHnJ5sVe/closure-check \
  -H "Authorization: Bearer $PLATFORM_SECRET_KEY"
```

```json Response theme={"dark"}
{
  "organization_id": "acct_3Wq8ZfT1yHnJ5sVe",
  "can_close": true,
  "closed_at": null,
  "blockers": []
}
```

If `can_close` is false, resolve each listed obligation and check again. Nonzero
balances, unfinished payouts or refunds, open disputes or holds, settlements,
renewing subscriptions and payable invoices can prevent closure. A preview does
not reserve the account: removal checks the conditions again.

**2. Remove the account**

Send the exact account name when you include `confirm_name`. For an unnamed
account, use its account ID. The API body is optional; dashboard removal always
requires typed confirmation.

```bash cURL theme={"dark"}
curl -X DELETE https://sandbox-api.bachs.io/v1/accounts/acct_3Wq8ZfT1yHnJ5sVe \
  -H "Authorization: Bearer $PLATFORM_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "confirm_name": "Ada Stores",
    "reason": "Store no longer uses the platform."
  }'
```

```json Response theme={"dark"}
{
  "organization_id": "acct_3Wq8ZfT1yHnJ5sVe",
  "closed_at": "2026-11-23T18:00:00.000Z",
  "reason": "Store no longer uses the platform.",
  "confirmation_email_sent": true,
  "personal_data_erasure_scheduled": false
}
```

A successful removal returns `200`, with `closed_at` set. The account is excluded
from active account lists. Its past payments, payouts and other financial records
remain stored.

**3. Verify the result or retry safely**

Keep the returned account ID and closure time. If the response is lost, repeat
the same DELETE request. An account already closed by your platform returns the
original closure and timestamp without repeating the closure actions.

If obligations appeared after your preview, removal returns
`409 ACCOUNT_HAS_CLOSURE_BLOCKERS` with a `blockers` array, and the account stays
open. Resolve those blockers before retrying. See the
[error response](https://docs.bachs.io/api-reference/accounts/delete-a-connected-account.md).

## Remove through the dashboard

Open **Connect → Connected accounts** and select the account. Choose
**Remove account** from its three-dot menu beside **Copy ID**, or open
**Settings → Account removal** at the bottom of the page. Review the blockers,
type the exact name or the displayed account ID, and confirm **Remove account**.

The action requires permission to manage Connect. A blocked account cannot be
confirmed. A request failure keeps the dialog open for retry; success returns you
to the active account list.

## Handle a refusal

* `400 ACCOUNT_NAME_CONFIRMATION_MISMATCH`: check the exact name, including case
  and spaces, or the ID for an unnamed account.
* `401` or `403`: check the platform key, environment and required scopes.
* `404`: check the ID, direct platform ownership and environment. An unrelated
  account and an unknown ID are both refused.
* `409 ACCOUNT_HAS_CLOSURE_BLOCKERS`: read every blocker, clear the obligations
  and check again.

Use your parent platform key directly. `X-Account-Id` does not change which
platform owns the key or grant permission to remove another platform's account.

## Next steps

* [Accounts](https://docs.bachs.io/connect/accounts.md)
* [Balances](https://docs.bachs.io/connect/balances.md)
* [Bachs Apps](https://docs.bachs.io/apps/overview.md), for access to an existing independent business


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.