Multisig Withdrawal

On-chain multisig withdrawal flow: fetch signing data, build a PSBT, and broadcast it once co-signed.

Get withdrawal parameters

POSThttps://api.gobtcpay.com/public/api/v1.2/multisig/onchain/get-data-to-withdraw

Returns everything needed to build a withdrawal PSBT client-side: the multisig descriptor (m/n, witness script), spendable UTXOs, recommended fee rates (low / medium / high), change script details, and virtual-size parameters for fee estimation.

Authorization: walletAuth

Responses

idstringrequired
Example:3fa85f64-5717-4562-b3fc-2c963f66afa6
resultobjectrequired
POST /multisig/onchain/get-data-to-withdraw
cURL
curl -X POST "$BASE_URL/multisig/onchain/get-data-to-withdraw" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN"
200 Successful response
JSON
{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "result": {
    "$case": "success",
    "success": {
      "multisig": {
        "m": 2,
        "n": 3,
        "witnessScript": "0014751e76e8199196d454941c45d1b3a323f1433bd6"
      },
      "utxos": [
        {
          "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
          "vout": 0,
          "value": 50000,
          "scriptPubKey": "02a1633cafcc01ebfb6d78e39f687a1f0995c62fc95f51ead10a02ee0be551b5dc"
        }
      ],
      "feeRateSatVb": {
        "law": 12,
        "medium": 12,
        "high": 12
      },
      "change": {
        "scriptPubKeyHex": "02a1633cafcc01ebfb6d78e39f687a1f0995c62fc95f51ead10a02ee0be551b5dc",
        "dustThreshold": 546
      },
      "params": {
        "vSizeP2wsh20f3In": 140,
        "vSizeP2wpkhOut": 140,
        "vSizeP2wshOut": 140,
        "txOverhead": 140
      }
    }
  }
}

Build withdrawal transaction

POSThttps://api.gobtcpay.com/public/api/v1.2/multisig/onchain/build-psbt-to-withdraw

Builds an unsigned withdrawal PSBT to toAddress. Provide either amountSats or sendMax, plus a fee.feeRateSatVb. Optionally pin inputs with selectUtxos and enable replace-by-fee with rbf. Returns the jobId, psbtBase64, and a summary (fee, vsize, change, inputs). Co-sign, then submit via Broadcast withdrawal.

Authorization: walletAuth

Body required

application/json
toAddressstringrequired

Destination Bitcoin address for the funds.

Example:bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq
amountSatsstring | number

Amount in satoshis.

sendMaxboolean

If true, sweeps the entire spendable balance to toAddress and ignores the amount.

Example:true
feeobjectrequired
selectUtxosobject[]

Optional list of specific UTXOs to spend. If omitted, coins are selected automatically.

rbfboolean

Enable Replace-By-Fee (BIP-125) so the transaction can be fee-bumped later.

Example:true

Responses

idstringrequired
Example:3fa85f64-5717-4562-b3fc-2c963f66afa6
resultobjectrequired
POST /multisig/onchain/build-psbt-to-withdraw
cURL
curl -X POST "$BASE_URL/multisig/onchain/build-psbt-to-withdraw" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
  "toAddress": "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
  "amountSats": "string",
  "sendMax": true,
  "fee": {
    "feeRateSatVb": 50000
  },
  "selectUtxos": [
    {
      "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
      "vout": 0
    }
  ],
  "rbf": true
}'
200 Successful response
JSON
{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "result": {
    "$case": "success",
    "success": {
      "jobId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "psbtBase64": "cHNidP8BAHECAAAAAfYI0kF1pQ0i3xL0AAAAAAD9////AsBdAQAAAAAAFgAUdR5",
      "summary": {
        "toAddress": "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
        "amountSats": "string",
        "feeSats": "string",
        "feeRateSatVb": 50000,
        "vsize": 140,
        "change": {
          "valueSats": "string"
        },
        "inputs": [
          {
            "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
            "vout": 0,
            "value": 50000
          }
        ]
      }
    }
  }
}

Broadcast withdrawal

POSThttps://api.gobtcpay.com/public/api/v1.2/multisig/onchain/confirm-withdraw

Broadcasts a co-signed withdrawal. Submit the jobId from Build withdrawal PSBT and the signedPsbtBase64. Returns the broadcast txid (and txHex when available).

Authorization: walletAuth

Body required

application/json
jobIdstringrequired

The jobId from Build withdrawal transaction (/multisig/onchain/build-psbt-to-withdraw).

Example:3fa85f64-5717-4562-b3fc-2c963f66afa6
signedPsbtBase64stringrequired

The withdrawal PSBT, co-signed, base64-encoded.

Example:cHNidP8BAHECAAAAAfYI0kF1pQ0i3xL0AAAAAAD9////AsBdAQAAAAAAFgAUdR5

Responses

idstringrequired
Example:3fa85f64-5717-4562-b3fc-2c963f66afa6
resultobjectrequired
POST /multisig/onchain/confirm-withdraw
cURL
curl -X POST "$BASE_URL/multisig/onchain/confirm-withdraw" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
  "jobId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "signedPsbtBase64": "cHNidP8BAHECAAAAAfYI0kF1pQ0i3xL0AAAAAAD9////AsBdAQAAAAAAFgAUdR5"
}'
200 Successful response
JSON
{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "result": {
    "$case": "success",
    "success": {
      "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
      "txHex": "02000000000101a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f6071829ffffffff"
    }
  }
}