> ## 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.

# Delete a connected account

> Soft deletes a directly owned account after balances and obligations clear. Retains all records and disables access. Returns 200 with the closure, including on retries; a blocked deletion returns 409 without partial closure. Requires `connected_accounts:write`. See [Delete a connected account](/connect/guides/remove-an-account).



## OpenAPI

````yaml /docs/openapi/openapi.json delete /v1/accounts/{account_id}
openapi: 3.0.3
info:
  title: Bachs API
  version: 1.0.0
  description: >-
    The Bachs API lets you accept payments, manage subscriptions, and move money
    across African markets.


    - **Authentication:** pass your secret key as `Authorization: Bearer
    sk_...`. See [Authentication](/authentication) for keys, scopes, and sandbox
    vs production.

    - **Errors:** errors use `detail` and `error_code`; `doc_url` and
    field-level `errors` are optional. See [Errors](/errors).

    - **Pagination:** list endpoints return `{ items, pagination }`. See
    [Pagination](/guides/pagination).

    - **Idempotency:** use `Idempotency-Key` on public `POST` and `PATCH`;
    reconcile uncertain write outcomes before retrying. See
    [Idempotency](/guides/idempotency).

    - **Base URLs and rate limits:** see the
    [Introduction](/api-reference/overview).
  contact:
    name: Bachs Support
    url: https://bachs.io
servers:
  - url: https://api.bachs.io
    description: Production
  - url: https://sandbox-api.bachs.io
    description: Sandbox
security:
  - ApiKeyAuth: []
tags:
  - name: Payments
    description: Accept payments from customers
  - name: Refunds
    description: Create and manage customer refunds
  - name: Disputes
    description: Respond to chargebacks and manage dispute evidence
  - name: Balances
    description: View balances and account information
  - name: Conversions
    description: Quote, execute, and query currency conversions
  - name: Payouts
    description: Withdraw funds to external accounts
  - name: Webhooks
    description: Receive real-time payment notifications
  - name: Authentication
    description: API key management and authentication
  - name: Customers
    description: Create and manage customers
  - name: Products
    description: Define and manage your billing catalog
  - name: Product Groups
    description: Bundle products for multi-plan checkout
  - name: Media
    description: Upload files and get an upload_id to attach to products
  - name: Checkouts
    description: Create and manage API-driven checkouts without products
  - name: Subscriptions
    description: >-
      Recurring billing. Subscriptions are created through checkout; manage them
      here.
  - name: Customer sessions
    description: >-
      Open a hosted portal session so a customer can manage their own
      subscriptions, invoices and cards.
  - name: Accounts
    description: >-
      Create the accounts your platform onboards, request their capabilities,
      walk them through their requirements, and read what they still owe.
  - name: Transfers
    description: Move funds between your platform and the accounts you own.
  - name: Platform Fees
    description: Read the platform's cut of an account's sale.
  - name: Virtual Accounts
    description: Create and read fixed bank account numbers for receiving deposits.
  - name: Files
paths:
  /v1/accounts/{account_id}:
    delete:
      tags:
        - Accounts
      summary: Delete a connected account
      description: >-
        Soft deletes a directly owned account after balances and obligations
        clear. Retains all records and disables access. Returns 200 with the
        closure, including on retries; a blocked deletion returns 409 without
        partial closure. Requires `connected_accounts:write`. See [Delete a
        connected account](/connect/guides/remove-an-account).
      operationId: deleteConnectedAccount
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: string
          description: >-
            The account to act on. It must be one of your own accounts; any
            other ID returns `404` so the response never confirms that an
            unrelated account exists.
          example: acct_3Wq8ZfT1yHnJ5sVe
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteConnectedAccountRequest'
            example:
              confirm_name: Ada Stores
              reason: Store no longer uses the platform.
      responses:
        '200':
          description: Account soft deleted, or the existing closure on retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectedAccountClosed'
              example:
                organization_id: acct_3Wq8ZfT1yHnJ5sVe
                closed_at: '2026-11-23T18:00:00Z'
                reason: Store no longer uses the platform.
                confirmation_email_sent: true
                personal_data_erasure_scheduled: false
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            Outstanding balances or obligations prevent closure; the account
            remains active.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectedAccountClosureBlocked'
              example:
                detail: This account cannot be closed yet.
                error_code: ACCOUNT_HAS_CLOSURE_BLOCKERS
                blockers:
                  - kind: pending_balance
                    detail: 'Pending balance is not zero: USD 10.00.'
        '422':
          $ref: '#/components/responses/ValidationError'
      security:
        - ApiKeyAuth:
            - connected_accounts:write
components:
  schemas:
    DeleteConnectedAccountRequest:
      type: object
      properties:
        confirm_name:
          type: string
          description: >-
            When supplied, must match the exact account name, or the account ID
            when the account is unnamed.
          example: Ada Stores
          nullable: true
          minLength: 1
        reason:
          type: string
          description: Your optional reason for closing the account.
          example: Store no longer uses the platform.
          nullable: true
          maxLength: 1000
    ConnectedAccountClosed:
      type: object
      required:
        - organization_id
        - closed_at
        - confirmation_email_sent
        - personal_data_erasure_scheduled
      properties:
        organization_id:
          type: string
          description: The account that was soft deleted.
          example: acct_3Wq8ZfT1yHnJ5sVe
        closed_at:
          type: string
          description: When the account was closed; retries return the original time.
          example: '2026-11-23T18:00:00Z'
          format: date-time
        reason:
          type: string
          description: The stored reason for closure, if one was supplied.
          example: Store no longer uses the platform.
          nullable: true
        confirmation_email_sent:
          type: boolean
          description: Whether the account closure confirmation email was sent.
          example: true
        personal_data_erasure_scheduled:
          type: boolean
          description: >-
            Always false for platform closure: the account and its records are
            retained.
          example: false
    ConnectedAccountClosureBlocked:
      type: object
      required:
        - detail
        - error_code
        - blockers
      properties:
        detail:
          type: string
          description: Explains that the account cannot yet be closed.
          example: This account cannot be closed yet.
        error_code:
          type: string
          description: >-
            The machine-readable error identifying outstanding closure
            obligations.
          example: ACCOUNT_HAS_CLOSURE_BLOCKERS
        blockers:
          type: array
          description: Every obligation that must clear before the account can be removed.
          items:
            $ref: '#/components/schemas/ConnectedAccountClosureBlocker'
    Error:
      type: object
      description: Standard error response format used across all API endpoints
      properties:
        detail:
          type: string
          description: Human-readable error message explaining what went wrong.
          example: Invalid request parameters
        error_code:
          type: string
          description: >-
            Machine-readable error code. Use this to handle errors
            programmatically. Common codes: VALIDATION_ERROR, UNAUTHORIZED,
            FORBIDDEN, NOT_FOUND, CONFLICT, TOO_MANY_REQUESTS,
            INTERNAL_SERVER_ERROR, BAD_GATEWAY, SERVICE_UNAVAILABLE.
          example: VALIDATION_ERROR
        errors:
          type: array
          description: >-
            Optional field-level details on some validation errors. Other
            validation responses contain only detail and error_code. Entry
            fields depend on the validation source.
          items:
            type: object
            properties:
              field:
                type: string
                description: The field that failed validation.
                example: amount
              message:
                type: string
                description: Description of the validation failure.
                example: Amount must be a positive decimal string
              type:
                type: string
                description: Error type identifier.
                example: value_error
              code:
                type: string
                description: >-
                  Optional requirement-field rejection code. Some validation
                  entries provide code instead of type.
                example: currency_not_supported
            required:
              - field
              - message
        doc_url:
          type: string
          description: Optional link to documentation for this error; some errors omit it.
          example: https://docs.bachs.io/api-reference/error-reference#general
      required:
        - detail
        - error_code
    ConnectedAccountClosureBlocker:
      type: object
      required:
        - kind
        - detail
      properties:
        kind:
          type: string
          description: >-
            The outstanding obligation preventing closure, such as an available
            balance or unfinished withdrawal.
          example: withdrawal_in_progress
        detail:
          type: string
          description: Explains the obligation that must be cleared before closure.
          example: 1 withdrawal not finished yet.
  responses:
    BadRequest:
      description: >-
        Bad Request - Validation errors or invalid request format. Check the
        `details` object for field-specific validation errors. Common causes:
        missing required fields, invalid data types, values outside allowed
        ranges, or invalid formats.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: Invalid request parameters
            error_code: VALIDATION_ERROR
            errors:
              - field: amount
                message: Amount must be a positive decimal string
                type: value_error
      headers:
        X-RateLimit-Limit:
          description: Maximum number of requests allowed per minute
          schema:
            type: integer
            example: 100
        X-RateLimit-Remaining:
          description: Number of requests remaining in the current window
          schema:
            type: integer
            example: 95
        X-RateLimit-Reset:
          description: Unix timestamp when the rate limit window resets
          schema:
            type: integer
            example: 1706102400
    Unauthorized:
      description: >-
        Unauthorized - Invalid, missing, or expired API key. Verify your API key
        is correctly formatted and included in the Authorization header as
        `Bearer sk_sandbox_...` or `Bearer sk_live_...`. Check that your key
        hasn't been revoked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: Invalid API key
            error_code: UNAUTHORIZED
      headers:
        X-RateLimit-Limit:
          description: Maximum number of requests allowed per minute
          schema:
            type: integer
            example: 100
        X-RateLimit-Remaining:
          description: Number of requests remaining in the current window
          schema:
            type: integer
            example: 95
        X-RateLimit-Reset:
          description: Unix timestamp when the rate limit window resets
          schema:
            type: integer
            example: 1706102400
    Forbidden:
      description: >-
        Forbidden - API key does not have permission for the requested resource.
        Verify you're using the correct account's API key and that you're not
        trying to access another account's data.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: API key does not have permission for this operation
            error_code: FORBIDDEN
      headers:
        X-RateLimit-Limit:
          description: Maximum number of requests allowed per minute
          schema:
            type: integer
            example: 100
        X-RateLimit-Remaining:
          description: Number of requests remaining in the current window
          schema:
            type: integer
            example: 95
        X-RateLimit-Reset:
          description: Unix timestamp when the rate limit window resets
          schema:
            type: integer
            example: 1706102400
    NotFound:
      description: >-
        Not Found - The requested resource does not exist. Verify the resource
        ID is correct and that it belongs to your account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: Resource not found
            error_code: NOT_FOUND
      headers:
        X-RateLimit-Limit:
          description: Maximum number of requests allowed per minute
          schema:
            type: integer
            example: 100
        X-RateLimit-Remaining:
          description: Number of requests remaining in the current window
          schema:
            type: integer
            example: 95
        X-RateLimit-Reset:
          description: Unix timestamp when the rate limit window resets
          schema:
            type: integer
            example: 1706102400
    ValidationError:
      description: >-
        Validation Error - one or more fields failed validation. Inspect
        `errors[]` for the field, the message, and the failure type, correct
        them, and retry.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: Validation failed for one or more fields
            error_code: VALIDATION_ERROR
            doc_url: https://docs.bachs.io/api-reference/error-reference#general
            errors:
              - field: name
                message: This field is required
                type: missing
      headers:
        X-RateLimit-Limit:
          description: Maximum number of requests allowed per minute
          schema:
            type: integer
            example: 100
        X-RateLimit-Remaining:
          description: Number of requests remaining in the current window
          schema:
            type: integer
            example: 95
        X-RateLimit-Reset:
          description: Unix timestamp when the rate limit window resets
          schema:
            type: integer
            example: 1706102400
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Bearer token authentication. Pass your API key as `Authorization: Bearer
        sk_...`. See [Authentication](/authentication) for keys, scopes, and
        sandbox vs production.

````

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