# Withdraw from Wallet - Go Account (Simple)

Source: https://developers.bitgo.com/docs/withdraw-wallet-type-go-account-simple

## Overview

The simple withdrawal flow for Go Accounts enables you to build and send transactions, all in one call, using BitGo Express. The simple flow suffices for most use cases. If you require more granular control, see the integration guide for the [manual](/docs/withdraw-wallet-type-go-account-manual) flow.

Just like with the manual flow, you can configure wallet policies to require approvals on withdrawals. Once a wallet admin approves the transaction, you send it to BitGo for signing and broadcasting to the blockchain.

## Prerequisites

* [Get Started](/docs/get-started-intro)
* [Create Wallets](/docs/wallets-create-wallets)
* [Deposit Assets](/docs/deposit-assets)

## Cookbook

Need just the steps? Expand the cookbook below to get started:

<Cookbook slug="withdraw-go-account-simple" title="Withdraw - Go Account (Simple)" />

## 1. Get `idHash` (Optional)

This step is required only for withdrawing fiat from your Go Account to a BitGo-approved bank account. Crypto withdrawals skip this step.

>Endpoint: [List Bank Accounts](/reference/v2bankaccountlist)

```shell cURL
export ENTERPRISE_ID="<ENTERPRISE_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"

curl -X GET \
  https://app.bitgo-test.com/api/v2/bankaccounts?enterpriseId=$ENTERPRISE_ID \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```

#### Step Result

BitGo identifies your bank account with a unique `idHash` that you can pass as the `address` value in the next step. You also receive information about the available payment rails and associated bank fees.

```json JSON
{
    "bankAccounts": [
        {
            "type": "wire", // available payment rails vary by bank and region
            "accountNumber": "012345678",
            "address1": "test",
            "address2": "test",
            "enterpriseId": "1032e75c451052000436831deb797af1",
            "id": "60749ab75f8c4500060f5a8b244dd0cb",
            "name": "My Bank",
            "owner": {
                "name": "test",
                "address1": "test",
                "address2": "test"
            },
            "idHash": "c2f4cf5555a66d77",
            "routingNumber": "087654321",
            "shortCountryCode": "US",
            "verificationState": "approved",
            "fee": { // fees vary by payment rail and bank
              "amount": "string",
              "individualFees": [
                {
                  "type": "static",
                  "amount": "string"
                }
              ]
            },
            "feeInfo": {
              "coin": "fiatusd",
              "bank": "silvergate",
              "type": "static",
              "amount": "string"
            },
        }
    ]
}
```

## 2. Build and Send Transaction

Build and send the transaction to BitGo, all in one call. The following example is shows the minimum required parameters for sending bitcoin or fiat.

>Endpoint: [Send Transaction](/reference/expresswalletsendcoins)

```shell cURL
export BITGO_EXPRESS_HOST="<YOUR_LOCAL_HOST>"
export COIN="<OFC_ASSET_ID>"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export ADDRESS="<DESTINATION_ADDRESS_OR_ID_HASH>"
export GO_ACCOUNT="<DESTINATION_WALLET_ID>" // If withdrawing to another Go Account
export AMOUNT="<AMOUNT_IN_BASE_UNITS>"
export WALLET_PASSPHRASE="<YOUR_WALLET_PASSPHRASE>"

curl -X POST \
  http://$BITGO_EXPRESS_HOST/api/v2/$COIN/wallet/$WALLET_ID/sendcoins \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
  "address": "'"$ADDRESS"'",
  "walletId": "'"$GO_ACCOUNT"'",
  // If withdrawing to another Go Account, pass "walletId" instead of "address"
  "amount": "'"$AMOUNT"'",
  "walletPassphrase": "'"$WALLET_PASSPHRASE"'"
}'
```
```js JavaScript
const tx = await fundedWallet.send({
    address: `<DESTINATION_ADDRESS>`,
    amount: `<AMOUNT>`,
    walletPassphrase: process.env.PASSWORD as string,
  });
```

#### Step Result

BitGo uses the data you pass to build an unsigned transaction.

If your withdrawal doesn't require approval, then BitGo receives the unsigned transaction. If you [Create Policy Rules](/docs/wallets-whitelists-create) to require approvals on withdrawals, the transaction remains in a pending-approval status until a wallet admin approves it.

The following examples show a withdrawal of $10,000 TUSD that isn't pending approval and a withdrawal of 10,000 sats of TBTC4 that is pending approval.

```json JSON
{
  "coin": "ofctusd",
  "transfers": [
    {
      "entries": [
        {
          "address": "c2f4cf5555a66d77",
          "wallet": "5ef523b7ab6b7f7b00b9314a0ac0a4e8",
          "value": -101000,
          "valueString": "-10100"
        },
        {
          "address": "9c1e400b427c13fa",
          "value": 10000,
          "valueString": "10000"
        }
      ],
      "id": "62c5b1de8a0c5200071c9a603bdbadc5",
      "coin": "ofctusd",
      "wallet": "5ef523b7ab6b7f7b00b9513a0ac0a4e8",
      "walletType": "trading",
      "enterprise": "5ef51cc84ba8da93002a7bc2e55882e6",
      "height": 999999999,
      "heightId": "999999999-62c5b1de8a0c5200071c9a603bdbadc5",
      "date": "2023-02-27T15:42:31.403Z",
      "confirmations": 0,
      "type": "send",
      "value": -10100,
      "valueString": "-10100",
      "baseValue": -10000,
      "baseValueString": "-10000",
      "feeString": "1000",
      "payGoFee": 0,
      "payGoFeeString": "0",
      "usd": -1010,
      "usdRate": 1,
      "state": "unconfirmed",
      "instant": false,
      "isReward": false,
      "isFee": false,
      "tags": ["5ef523b7ab6b7f7b00b9513a0ac0a4e8", "5ef51cc84ba8da93002a7bc2e55882e6"],
      "history": [
        {
          "date": "2023-02-27T15:42:31.296Z",
          "user": "5543247a32d9b1f4037cfd782fc4b06d",
          "action": "created"
        }
      ],
      "createdTime": "2023-02-27T15:42:31.296Z",
      "label": ""
    }
  ]
}
```
```json JSON (pending approval)
{
  "error": "triggered all transactions policy",
  "pendingApproval": {
    "id": "62c5b1de8a0c5200071c9a603bdbadc5",
    "coin": "ofctbtc",
    "wallet": "5ef523b7ab6b7f7b00b9314a0ac0a4e8",
    "enterprise": "62c5ae8174ac860007aff138a2d74df7",
    "creator": "5543247a32d9b1f4037cfd782fc4b06d",
    "createDate": "2023-12-01T15:38:09.738Z",
    "info": {
      "type": "transactionRequest",
      "transactionRequest": {
        "coinSpecific": {
          "ofctbtc": {
            "payload": {
              "coin": "ofctbtc",
              "recipients": [
                {
                  "address": "2NAdfzmeeemmbvC162xVvBUAieAvTkQzZAF",
                  "amount": "10000"
                }
              ],
              "fromAccount": "5ef523b7ab6b7f7b00b9513a0ac0a4e8",
              "nonce": "efc73d23-19d6-4493-a4cf-9da054c726c7",
              "timestamp": "2023-12-01T15:38:07.896Z",
              "feeString": "0",
              "shortCircuitBlockchainTransfer": false
            },
            "signature": "1f989926e3fc8ed0138bd0e188e90e2c5321ef86734896886c004005740a005dfd2008142dbc48aee68d1f576c4a9ac558e5b7b4acbd5aa765710ea636aca9d032"
          }
        },
        "verificationItems": [],
        "videoApprovers": [],
        "requestedAmount": "10000",
        "fee": 0,
        "sourceWallet": "5ef523b7ab6b7f7b00b9513a0ac0a4e8",
        "recipients": [
          {
            "_id": "63fcce61313ca5000709496f",
            "address": "2NAdfzmeeemmbvC162xVvBUAieAvTkQzZAF",
            "amount": "10000"
          }
        ],
        "buildParams": {
          "recipients": [
            {
              "address": "2NAdfzmeeemmbvC162xVvBUAieAvTkQzZAF",
              "amount": "10000"
            }
          ]
        },
        "policyUniqueId": "5ef523b7ab6b7f7b00b9513c"
      }
    },
    "state": "pendingApproval",
    "scope": "wallet",
    "userIds": [
      "62ab90e06dfda30007974f0a52a12995",
      "627ff9325a5c1b0007c05a40d15e1522"
    ],
    "approvalsRequired": 1,
    "singleRunResults": [
      {
        "_id": "63fcce61313ca50007094970",
        "ruleId": "Custody Enterprise Transaction ID Verification",
        "triggered": true
      }
    ],
    "resolvers": []
  },
  "triggeredPolicy": "5ef523b7ab6b7f7b00b9513cf05f00d5"
}
```

## 3. Approve Transaction (Optional)

>Endpoint: [Update Pending Approval](/reference/v2approvalupdate)

```shell cURL
export COIN="<ASSET_ID>"
export APPROVAL_ID="<APPROVAL_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export OTP="<OTP>"

curl -X POST \
  http://api/v2/$COIN/pendingapprovals/$APPROVAL_ID
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "state": "approved",
    "otp": "'"$OTP"'"
}'
```
```js JavaScript
const baseCoin = this.bitgoSDK.coin(initialPendingApproval.coin);
const pendingApproval = await baseCoin.pendingApprovals().get({ id: initialPendingApproval.id });
const result = await pendingApproval.approve(params);
```

#### Step Result

Once approved, BitGo rebuilds the unsigned transaction, applying the most up-to-date fees.

```json JSON
{
  "id": "655686880765186f0b3e9e88e1bdd0f4",
  "coin": "tbtc4",
  "wallet": "6553e933288be490293ae748efafeaaf",
  "enterprise": "62c5ae8174ac860007aff138a2d74df7",
  "creator": "62ab90e06dfda30007974f0a52a12995",
  "createDate": "2023-11-16T21:15:52.703Z",
  "info": {
    "type": "transactionRequest",
    "transactionRequest": {
      "requestedAmount": "10000",
      "fee": 45242,
      "sourceWallet": "6553e933288be490293ae748efafeaaf",
      "policyUniqueId": "6553e933288be490293ae753",
      "recipients": [
        {
          "address": "2N3sBpM1RnWRMXnEVoUWnM7xtYzL756JE2Q",
          "amount": "10000",
          "_id": "655686880765186f0b3e9e8a"
        }
      ],
      "buildParams": {
        "recipients": [
          {
            "address": "2N3sBpM1RnWRMXnEVoUWnM7xtYzL756JE2Q",
            "amount": "10000"
          }
        ]
      },
      "coinSpecific": {
        "tbtc4": {
          "txHex": "01000000000101eac5e7d68acfc2349672fb99094e79c2006e5fd663475c8f1eb6f29095970b740100000000ffffffff02102700000000000017a914747e6b7f5db53794b0fc01d95878e0f9b6db96738746c1020000000000220020efb9deaabeab5d62cecc363f24cd6deafcdd14d93d8734f7f01ed3953e732a640500483045022100cd6c221e4cefbb51aa82087d86e7d089b2473eb21ae809dba89eb9f13c4caf19022000f3b7f1b7fec2dc49cbfce35baa69ca37ab9ee8e51c779cde5b98a653f3e142010000695221029bde55661e4f359cf9ca2d1846c235e752f760ed6d65e2018f821253e78b3c722103f2b4a813ab79e4fb46edf3a6a87fb154a85b45810158e949f41a3fce3c9bf574210399a6d766f6d3a3843f8479446ee766b5745dc15c24d1db5149214d27987bd29453ae00000000"
        }
      },
      "validTransaction": "01000000000101eac5e7d68acfc2349672fb99094e79c2006e5fd663475c8f1eb6f29095970b740100000000ffffffff02102700000000000017a914747e6b7f5db53794b0fc01d95878e0f9b6db96738746c1020000000000220020efb9deaabeab5d62cecc363f24cd6deafcdd14d93d8734f7f01ed3953e732a640400483045022100cd6c221e4cefbb51aa82087d86e7d089b2473eb21ae809dba89eb9f13c4caf19022000f3b7f1b7fec2dc49cbfce35baa69ca37ab9ee8e51c779cde5b98a653f3e14201473044022002b246c43722fec49858caf6b0605a0d01a6b6c13c964b84bf272604fd3951780220324ee44ba3ce8febb154c317e688a5f6ed410ad8e2bd77c5678bf1f7f3eb45f601695221029bde55661e4f359cf9ca2d1846c235e752f760ed6d65e2018f821253e78b3c722103f2b4a813ab79e4fb46edf3a6a87fb154a85b45810158e949f41a3fce3c9bf574210399a6d766f6d3a3843f8479446ee766b5745dc15c24d1db5149214d27987bd29453ae00000000",
      "validTransactionHash": "ff40ccd5c8ba75ffdce27d8584b6e8ee625cb3f71f7cbb6d072a445a97c2c8c3"
    }
  },
  "state": "approved",
  "scope": "wallet",
  "userIds": [
    "62ab90e06dfda30007974f0a52a12995",
    "627ff9325a5c1b0007c05a40d15e1522"
  ],
  "approvalsRequired": 1,
  "singleRunResults": [
    {
      "ruleId": "Custody Enterprise Transaction ID Verification",
      "triggered": false,
      "_id": "655686880765186f0b3e9e89"
    }
  ],
  "resolvers": [
    {
      "user": "627ff9325a5c1b0007c05a40d15e1522",
      "date": "2023-11-16T21:33:24.644Z",
      "resolutionType": "pending"
    }
  ]
}
```

## Next

You can view your completed withdrawal in BitGo or on a blockchain explorer.

## See Also

* [API Reference: Send to Many](/reference/expresswalletsendmany)
* [API Reference: Send Transaction](/reference/expresswalletsendcoins)
* [API Reference: Update Pending Approval](/reference/v2approvalupdate)
