# Bulk update sweep threshold configurations

Upserts multiple sweep thresholds in a single transaction: a threshold row is created on first configuration of an asset and updated thereafter. Each (tickerId, ledgerId) pair must exist in the Custody catalog. All updates are applied atomically (all-or-nothing); if any update fails, the entire request is rolled back.  Optimistic locking: send the version from the corresponding GET row in each update. If any submitted version no longer matches the stored row (or a version is sent for an asset that has since been configured), the whole request is rejected with 409 and nothing is written.

Endpoint: PUT /v1/domains/{domainId}/sweep-thresholds

## Path parameters:

  - `domainId` (string, required)

## Request fields (application/json):

  - `updates` (array, required)
    List of threshold updates to apply atomically

  - `updates.tickerId` (string, required)
    Ticker UUID to update

  - `updates.ledgerId` (string, required)
    Ledger ID to update

  - `updates.minSweepAmount` (string, required)
    New minimum sweep amount in smallest unit. Must be a non-negative integer string (e.g., "10000000000000000" for 0.01 ETH).

  - `updates.version` (integer)
    Optimistic-lock version from the GET row being edited. Required to update an already-configured asset. Omit (or null) only when configuring an asset for the first time (no stored row yet); sending a version for such an asset is treated as a conflict.

## Response 200 fields (application/json):

  - `updatedCount` (integer, required)
    Number of thresholds successfully updated

  - `message` (string)
    Success message

## Response 409 fields (application/json):

  - `reason` (string)
    HTTP reason phrase (e.g., "Conflict")

  - `message` (string)
    Human-readable summary of the conflict

  - `errorCode` (string, required)
    Stable machine code identifying this as a stale-version conflict. Distinguishes it from other 409s (e.g., data-integrity violations) that do not carry this code and should not trigger a refresh-and-reverify flow.
    Enum: "STALE_SWEEP_THRESHOLD_VERSION"

  - `conflicts` (array, required)
    The rows that conflicted, with their current stored values. Present and non-empty only for stale-version 409s.

  - `conflicts.tickerId` (string, required)
    Ticker UUID of the conflicting asset

  - `conflicts.ledgerId` (string, required)
    Ledger ID of the conflicting asset

  - `conflicts.currentVersion` (integer)
    The stored row's current optimistic-lock version. Absent if the asset has no stored row yet (a version was sent for a first-time configuration).

  - `conflicts.currentMinSweepAmount` (string, required)
    The stored row's current minimum sweep amount in the ticker's smallest unit. "0" if the asset has no stored row yet.

  - `conflicts.currentMinSweepAmountFormatted` (string)
    Human-readable formatted current amount (e.g., "0.1 BTC"), mirroring the SweepThresholdConfig field so the client can display it directly.


