Enable Bulk ERC20 Withdrawals

Approve the batcher smart contract to enable bulk ERC20 token withdrawals. Includes flows for Custody MPC, Custody Multisig, Self-Custody MPC (Hot and Cold), and Self-Custody Multisig (Hot and Cold) wallets. See the Guide.

  1. Before approving tokens, you can check if your wallet has already approved the batcher contract. The large number shown in the response (2^256-1) is the maximum approval amount (unlimited).

    Approving the batcher smart contract is a one-time operation, but each token requires a separate approval in each wallet.

    Prerequisites: Complete Get Started, Create Wallets, and Deposit Assets (you must have the ERC20 token in the wallet).

    API Reference

  2. For Custody MPC wallets, build an approval transaction for the ERC20 token to authorize the batcher smart contract to transfer tokens on your behalf. Use sendMany with isTss: true and type: 'tokenApproval'.

    Since no assets are withdrawing in this transaction, BitGo automatically bypasses any policies to require additional admin approval. Once approved, you can Bulk Withdraw ERC20 Tokens.

    API Reference

  3. For Custody Multisig wallets, build an approval transaction for the ERC20 token to authorize the batcher smart contract to transfer tokens on your behalf. Use sendMany with type: 'tokenApproval' (no isTss flag needed).

    Since no assets are withdrawing in this transaction, BitGo automatically bypasses any policies to require additional admin approval. Once approved, you can Bulk Withdraw ERC20 Tokens.

    API Reference

  4. For self-custody MPC wallets, build an approval transaction for the ERC20 token to authorize the batcher smart contract to transfer tokens on your behalf. Use sendMany with isTss: true, type: 'tokenApproval', walletPassphrase, and feeOptions.

    Transactions for approving the batcher smart contract follow the transaction flow of the wallet type, and must receive all required signatures and approvals before broadcasting to the blockchain. Once you sign and broadcast your approval transaction, you can Bulk Withdraw ERC20 Tokens.

    API Reference

  5. For BitGo Offline Vault MPC wallets, build an approval transaction for the ERC20 token to authorize the batcher smart contract to transfer tokens on your behalf. Use sendMany with isTss: true, type: 'tokenApproval', and feeOptions. You will need to sign the transaction offline.

    Transactions for approving the batcher smart contract follow the transaction flow of the wallet type, and must receive all required signatures and approvals before broadcasting to the blockchain. Once you sign and broadcast your approval transaction, you can Bulk Withdraw ERC20 Tokens.

    API Reference

  6. For self-custody multisignature wallets, build an approval transaction for the ERC20 token to authorize the batcher smart contract to transfer tokens on your behalf. Use buildErc20TokenApproval with the tokenName and walletPassphrase to build, sign, and send in one operation.

    Transactions for approving the batcher smart contract follow the transaction flow of the wallet type, and must receive all required signatures and approvals before broadcasting to the blockchain. Once you sign and broadcast your approval transaction, you can Bulk Withdraw ERC20 Tokens.

    API Reference

  7. For BitGo Offline Vault multisignature wallets, build an approval transaction for the ERC20 token to authorize the batcher smart contract to transfer tokens on your behalf. Use buildErc20TokenApproval to get the unsigned transaction, sign offline using the OVC, then send the half-signed transaction with sendTransaction.

    Transactions for approving the batcher smart contract follow the transaction flow of the wallet type, and must receive all required signatures and approvals before broadcasting to the blockchain. Once you sign and broadcast your approval transaction, you can Bulk Withdraw ERC20 Tokens.

    API Reference

// 1. (Optional) Check Token Allowance
export COIN="<ASSET_ID_OF_NATIVE_COIN>"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"

curl -X GET \
  https://app.bitgo-test.com/api/v2/$COIN/wallet/$WALLET_ID/allowance \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN"
// 2. Custody MPC: Approve Batcher Smart Contract
export COIN="<ASSET_ID_OF_NATIVE_COIN>"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export TOKEN_NAME="<ASSET_ID_OF_TOKEN>"

curl -X POST \
  https://app.bitgo-test.com/api/v2/$COIN/wallet/$WALLET_ID/token/approval/build \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "intent": {
      "intentType": "tokenApproval",
      "tokenName": "'"$TOKEN_NAME"'"
    }
  }'
// 3. Custody Multisig: Approve Batcher Smart Contract
curl -X POST \
  https://app.bitgo-test.com/api/v2/$COIN/wallet/$WALLET_ID/token/approval/build \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "type": "tokenApproval"
    "tokenName": "'"$TOKEN_NAME"'"
  }'
// 4. Self-Custody MPC: Approve Batcher Smart Contract
curl -X POST \
  https://app.bitgo-test.com/api/v2/$COIN/wallet/$WALLET_ID/token/approval/build \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "intent": {
      "intentType": "tokenApproval",
      "tokenName": "'"$TOKEN_NAME"'",
      "feeOptions": {
        "maxFeePerGas": "30000000001",
        "maxPriorityFeePerGas": "30000000000"
      },
      "type": "tokenApproval"
    }
  }'
// 5. BitGo Offline Vault MPC: Approve Batcher Smart Contract
curl -X POST \
  https://app.bitgo-test.com/api/v2/$COIN/wallet/$WALLET_ID/token/approval/build \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "intent": {
      "intentType": "tokenApproval",
      "tokenName": "'"$TOKEN_NAME"'",
      "feeOptions": {
        "maxFeePerGas": "30000000001",
        "maxPriorityFeePerGas": "30000000000"
      }
    }
  }'
// 6. Self-Custody Multisig: Approve Batcher Smart Contract
curl -X POST \
  https://app.bitgo-test.com/api/v2/$COIN/wallet/$WALLET_ID/token/approval/build \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "tokenName": "'"$TOKEN_NAME"'"
  }'
// 7. BitGo Offline Vault Multisig: Approve Batcher Smart Contract
curl -X POST \
  https://app.bitgo-test.com/api/v2/$COIN/wallet/$WALLET_ID/token/approval/build \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "tokenName": "'"$TOKEN_NAME"'"
  }'
Response
// 1. (Optional) Check Token Allowance Response
{
  "allowance": "115792089237316195423570985008687907853269984665640564039457584007913129639935"
}

// Approve Batcher Smart Contract Response (applies to all wallet types)
{
  "pendingApproval": {
    "id": "63727a81cdbc820007b27caa7b76016d",
    "coin": "eth",
    "wallet": "63726fde0a3c94000758f2790536041d",
    "state": "pendingFinalApproval",
    "scope": "wallet",
    "info": {
      "type": "transactionRequest",
      "transactionRequest": {
        "coinSpecific": {
          "eth": {
            "eip1559": {
              "maxPriorityFeePerGas": 1500000000,
              "maxFeePerGas": 133302263906
            },
            "recipients": [
              {
                "amount": "0",
                "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
                "data": "0x095ea7b3000000000000000000000000..."
              }
            ]
          }
        }
      }
    }
  }
}