If you are getting a 400: Insufficient Funds error even though you are certain that you have sufficient funds in your wallet to cover the transaction amount (including fees), this may occur due to a number of reasons.

This might occur if you have very few unspents in your wallet, and those unspents are currently tied up in unconfirmed transactions. Essentially, the amount of funds that are CURRENTLY available in your wallet are not sufficient to complete the transaction. You can use the List Wallet Unspents endpoint in the API (https://www.bitgo.com/api/v2/#list-wallet-unspents) to view the unspents in your wallet. There are a couple of options available to you in the API that can help you to prevent this situation moving forward:

  1. You can create more unspents in your wallet by using the Fanout endpoint (https://www.bitgo.com/api/v2/#fanout-wallet-unspents) to break apart larger unspents into smaller ones. This is especially useful if you have a large balance in your wallet but very few unspents, and you need to be able to generate a high volume of transactions out of the wallet.
  2. You can use the Send Many endpoint (https://www.bitgo.com/api/v2/#send-transaction-to-many) to create a single transaction that sends to multiple recipients. This is useful if you need to send several transactions in a relatively short period of time, and it is generally more cost-effective, as the overall fees payable to send one transaction to multiple recipients are less than sending multiple separate transactions.

Conversely, you might receive an insufficient funds error if you have a high number of unspents in your wallet. A transaction can only consume a maximum of 200 unspents to build the transaction, and if the sum of your 200 highest-value unspents is not sufficient to cover the transaction amount (plus fees), you will receive an "insufficient funds" error. You will need to consolidate your unspents using our consolidate unspents API endpoint (https://www.bitgo.com/api/v2/#consolidate-wallet-unspents). You can also send out transactions with a small amount of BTC. This process is not done automatically due to the nature of multi-signature wallets, as we do not have access to your private keys.