Transfer from Wallet

Transfer exact amount or percent from whole balance to one or a couple of receivers.

Send Bitcoins icon

Contents

Request:

{WalletID}, string Wallet Identificator. Required
{transfer_key}, string Key for payment transfer (withdrawal). Required
{destinations}, array The dictionary of destination addresses and amounts. Required
{subtract-fee-from-amount}, boolean If it takes "true", then the fee will be proportionally subtracts from the each destination's amount. Optional
{fee}, string Network fee strategy. Can take the value "normal", "priority" (Network Fee) or "custom". With custom fee strategy you can specify an network fee using the additional field {fee-rate}. Optional
{fee-rate}, integer The parameter is only used when "custom" is set to {fee}. It's used to set the value of the network fee in satoshi/byte. Optional
Request example:
{
"transfer_key": "key_for_withdrawal",
"destinations": [
{
"address": "receiver_address",
"amount": <amount_in_satoshies|"percent"> },
... #up to 255 receivers
],
"fee": "custom",
"fee-rate": 1.0,
"subtract-fee-from-amount": true
}

Success Response Reference:

{txs}, array The array of transactions hash. Required
{change-address}, string If a sent transaction has a change, then it will be sent to the new wallet address. We create new clear address without any callbacks in same wallet. Optional
Response example:
{
  "wallet": "btc-5484e54ec0bb35c95b79d7338399900f",
  "created": "2020-12-20T12:20:20.193984",
  "type": "payment",
  "id": "2cbb0471d74319511db26e483a5f4a5fc84ebea5d9521021901ef6dd1d5fe046",
  "txs": ["f697a5e33e8becc00cb48761299dbe9e29b8665fd4983a0a8c04aee814bd1ff4"],
  "destinations": [
    {
      "address": "1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH",
      "amount": 1328886
    }
  ],
  "amount": 1349264,
  "total": 1349264,
  "fee": {
    "processing": {
      "address": "1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH",
      "amount": 20000,
    },
    "subtract-from-amount":true,
    "network": {
      "strategy": "custom",
      "rate": 1.0,
      "amount": 378
    }
  },
  change-address: "33aPysEqZwhAKwA5oPsvkhM2JWLPqxFras"
}

Error Response:

Playground and Code examples:

Parameter Experiment with a value
Wallet ID
Transfer key
Subtract fee from amount
Fee policy
Destinations
Address Amount

+

Execute
Response from server:
{"change-address": "1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH", "txid": "f697a5e33e8becc00cb48761299dbe9e29b8665fd4983a0a8c04aee814bd1ff4", "currency": "btc", "created": "2020-12-20T12:20:20.193984", }
{  
   "transfer_key":"42HWdOw5qlm9ioGjrXaU4c02R3KcZxmn",

    "fee": "normal",
    "subtract-fee-from-amount":	"true"
}
<?php
  $WalletID = "2a96097067fbc62b00c02d49495f8ad9";
  $json_data =
  array ( 
    'transfer_key' => "42HWdOw5qlm9ioGjrXaU4c02R3KcZxmn",,
    'fee' => "normal",
    'subtract-fee-from-amount' => "true"
  );
  $api_endpoint = "https://apirone.com/api/v2/wallets/" .
        $WalletID . "/transfer";
  $curl = curl_init($api_endpoint);
  curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
  curl_setopt($curl, CURLOPT_POST, 1);
  curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($json_data));
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  $response = curl_exec($curl);
  $http_status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
  curl_close($curl);
 
  if ($http_status_code==200){
    $decoded = json_decode($response, true);
    echo "Transaction sent. Hash: " . $decoded["txs"][0];
  } else {
      var_dump($response);
  }
?>