Consolidate unspents

post/api/v2/{coin}/wallet/{walletId}/consolidateunspents

Consolidate unspents on a wallet

Path Parameters

  • coinstringRequired
    A cryptocurrency or token ticker symbol.
    Example: "btc"
  • walletIdstringRequired
    Example: "59cd72485007a239fb00282ed480da1f"
    Pattern: ^[0-9a-f]{32}$

Request Body

walletPassphrase string
Passphrase to decrypt the user key on the wallet
xprv string
Private key in string form, if walletPassphrase is not available
feeRateOne of
Custom minimum fee rate in a coin's base unit per kilobyte (or virtual kilobyte)--for example, satoshis per kvByte or microAlgos per kByte. If the applied "feeRate" does not meet a coin's required minimum transaction fee amount, the minimum is still applied (for example, 1000 sat/kvByte or a flat 1000 microAlgos).
maxFeeRateOne of
Custom upper limit for fee rate in a coin's base unit per kilobyte (or virtual kilobyte)--for example, satoshis per kvByte or microAlgos per kByte. "maxFeeRate" can be used to limit a fee rate estimate generated with "numBlocks".
maxFeePercentage integer
Maximum relative portion that can be spent towards fees
feeTxConfirmTarget integer
Block target for fee estimation
bulk boolean
Build multiple transactions at the same time. This enables you to increase the maximum number of unspents on the "limit" parameter up to 2,000. If true, you must pass the "txFormat" as "psbt" and you can't pass the "targetAddress" or "numUnspentsToMake" parameters.
minValueOne of
Minimum value of unspents to use in base units (e.g. satoshis). Can be used to skip very small unspents when consolidating at higher fee rates. For doge, only string is allowed.
maxValueOne of
Maximum value of unspents to use in base units (e.g. satoshis). Should be used to prevent larger unspents from being consolidated needlessly, and that some funds remain available for spending while the consolidation transactions are in flight. For doge, only string is allowed.
minHeight integer
Minimum height of unspents on the block chain to use
minConfirms integer
Minimum confirmation threshold for external inputs
enforceMinConfirmsForChange boolean
Flag for enforcing minConfirms for change inputs
limit integer
Maximum number of unspents to use in the transaction
numUnspentsToMake integer
Number of new unspents to make
targetAddress string
address to use for generated outputs. Must be wallet address.
txFormat string
Format of the returned transaction hex serialization. "legacy" for serialized transaction in custom bitcoinjs-lib format. "psbt" for BIP174 serialized transaction
Allowed values: legacy psbt
Default: legacy
Example: legacy
javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 let params = { numUnspentsToMake: 2, minValue: 100000, maxValue: 47000000, minHeight: 1, minConfirms: 2, limit: 100, walletPassphrase: 'secretpassphrase1a5df8380e0e30', }; wallet.consolidateUnspents(params).then(function (transactionInfo) { // print transaction info console.dir(transactionInfo); });

200 Response

transfer object
New transfer
coin string required
A cryptocurrency or token ticker symbol.
Example: btc
id string required
Example: 59cd72485007a239fb00282ed480da1f
Match pattern: ^[0-9a-f]{32}$
wallet string required
Example: 59cd72485007a239fb00282ed480da1f
Match pattern: ^[0-9a-f]{32}$
enterprise string
Example: 59cd72485007a239fb00282ed480da1f
Match pattern: ^[0-9a-f]{32}$
txid string required
The on-chain transaction id
Example: b8a828b98dbf32d9fd1875cbace9640ceb8c82626716b4a64203fdc79bb46d26
txidType string
The type of the transaction id
Allowed values: transactionHash blockHash
height integer required
The height of the block this Transfer was confirmed in (999999999 if unconfirmed)
heightId string
The unique height id of the block
date string <date-time>required
The date this Transfer was last updated
confirmations integer required
The number of blocks that have been confirmed since this Transfer's block was confirmed
type string required
Defines whether or not this Transfer was sent or received by the user
Allowed values: send receive
value integer
The total value (in base units) sent by this Transfer (may be approximate for ETH and other coins where amounts in base units can exceed 2^53 - 1)
valueString string required
The total value (in base units) sent by this Transfer represented as a String
Example: 2000000
Match pattern: ^-?\d+$
intendedValueString string
A string representation (in base units) of the initial value for the transfer. This is present because when a transaction fails on chain, its value is mutated to be zero. This string is immutable and will always be the intended value of the initial transfer regardless of the final state of the transaction.
Example: 2000000
Match pattern: ^-?\d+$
baseValue integer
The value (in base units) sent by this transfer, excluding network fees. BitGo is deprecating this field in the future. Instead, use baseValueWithoutFees.
baseValueString string
The value (in base units) sent by this transfer, excluding network fees represented as a string. BitGo is deprecating this field in the future. Instead, use baseValueWithoutFees.
Example: 2000000
Match pattern: ^-?\d+$
baseValueWithoutFees integer
The value (in base units) sent by this transfer excluding network fees.
baseValueWithoutFeesString string
The value (in base units) sent by this transfer, excluding network fees, represented as a string
Example: 2000000
Match pattern: ^-?\d+$
feeString string
The Transfer's fee (in base units) represented as a String
payGoFee integer
The Transfer's BitGo fee (in base units)
payGoFeeString string
The Transfer's BitGo fee (in base units) represented as a String
usd number required
The amount of USD of this Transfer (will be negative if it's a send)
usdRate number required
The USD price at the time this Transfer was created
state string required
The status of this Transfer
Allowed values: signed unconfirmed confirmed pendingApproval removed failed rejected replaced
Example: confirmed
tags array[string] required
The tags to be used on this Transfer (used in Policies)
history array[object] required
An audit log of events that have happened to the Transfer during its lifecycle
comment string required
A comment from the user
vSize integer
The size of the transaction
coinSpecific object required
Transfer fields specific to each coin type
sequenceId string
A "sequenceId" is a unique and arbitrary wallet identifier applied to transfers and transactions at creation. It is optional but highly recommended. With a "sequenceId" you can easily reference transfers and transactions&mdash;for example, to safely retry sending. Because the system only confirms one send request per "sequenceId" (and fails all subsequent attempts), you can retry sending without the risk of double spending. The "sequenceId" is only visible to users on the wallet and is not shared publicly.
entries array[object]
An array of objects describing the change in address balances made as a result of this Transfer
usersNotified boolean
Whether BitGo already sent notifications to the users of the transfer wallet
label string
Address labels (if any) from entries concatenated.
replaces array[string]
Transaction IDs that this transfer replaces.
replacedBy array[string]
Transaction IDs that replace this transfer.
txid string
Unique transaction identifier
txOne of
Encoded transaction hex (or base64 for XLM)
status string
Transfer status
Allowed values: signed signed (suppressed) pendingApproval

400 Response

One of
error string required
Human-readable error message
requestId string required
Client request id
context object
Properties that apply to a specific error name
name string required
Error code