{
  "$schema": "../rpc-schema-draft.json",
  "type": "object",
  "rpc": "multiwithdraw",
  "title": "Command for withdrawing to multiple addresses",
  "description": [
    "The **multiwithdraw** RPC command sends funds from Core Lightning's internal wallet to the addresses specified in *outputs*."
  ],
  "request": {
    "required": [
      "outputs"
    ],
    "additionalProperties": false,
    "properties": {
      "outputs": {
        "type": "array",
        "items": {
          "type": "outputdesc"
        },
        "description": [
          "An array containing objects of the form `{address: amount}`. The `amount` may be the string *all*, indicating that all onchain funds be sent to the specified address. Otherwise, it is in satoshi precision; it can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*."
        ]
      },
      "feerate": {
        "type": "feerate",
        "description": [
          "Feerate used for the withdrawals. See NOTES in lightning-feerates(7) for possible values."
        ],
        "default": "*normal*"
      },
      "minconf": {
        "type": "u32",
        "description": [
          "Minimum number of confirmations that used outputs should have."
        ],
        "default": 1
      },
      "utxos": {
        "type": "array",
        "items": {
          "type": "outpoint",
          "description": [
            "Utxos to be used to be withdrawn from, as an array of `txid:vout`. These must be drawn from the node's available UTXO set."
          ]
        }
      }
    }
  },
  "response": {
    "required": [
      "tx",
      "txid"
    ],
    "additionalProperties": false,
    "properties": {
      "tx": {
        "type": "hex",
        "description": [
          "The raw transaction which was sent."
        ]
      },
      "txid": {
        "type": "txid",
        "description": [
          "The txid of the **tx**."
        ]
      }
    }
  },
  "errors": [
    "On failure, an error is reported and the withdrawal transaction is not created.",
    "",
    "- -1: Catchall nonspecific error.",
    "- 301: There are not enough funds in the internal wallet (including fees) to create the transaction.",
    "- 302: The dust limit is not met."
  ],
  "author": [
    "ZmnSCPxj [ZmnSCPxj@protonmail.com](mailto:ZmnSCPxj@protonmail.com) is mainly responsible."
  ],
  "see_also": [
    "lightning-listfunds(7)",
    "lightning-fundchannel(7)",
    "lightning-newaddr(7)",
    "lightning-txprepare(7)",
    "lightning-withdraw(7)"
  ],
  "resources": [
    "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
  ],
  "examples": [
    {
      "request": {
        "id": "example:multiwithdraw#1",
        "method": "multiwithdraw",
        "params": {
          "outputs": [
            {
              "bcrt1q84payf4ucfcpnt0994arm3f20tqmu29cna738w": "2222000msat"
            },
            {
              "bcrt1q64wyjwvrmdj3uyz8w32mr4qgcv08a833zepjm3": "3333000msat"
            }
          ]
        }
      },
      "response": {
        "tx": "02000000000155multiw55000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000550005500055000",
        "txid": "txid5500055000550005500055000550005500055000550005500055000"
      }
    },
    {
      "request": {
        "id": "example:multiwithdraw#2",
        "method": "multiwithdraw",
        "params": {
          "outputs": [
            {
              "bcrt1p97zrhgxgm6wscsdx8gjafj4jyqetunat7fynrk4cyg2rz6lzrr9q6dlrp2": 1000
            },
            {
              "bcrt1qm7k64cvd2ljw758ptwrrm8ny30u67ea3cfkxpn": 1000
            },
            {
              "bcrt1qdgvytwcw58uwlf3lqrej2eqaku6smn2mdvkycp": 1000
            },
            {
              "bcrt1q68wfpfam8tu3a457jv7u8r64tdvqltgfs0kj84": 1000
            },
            {
              "bcrt1qq7g9ccvfcxhg4lcj2e4s8u6l75tdzl5y7krmtl": 1000
            },
            {
              "bcrt1pp9uw53lnrtt9v8vkemhpf6z3jfex2dkyu8je6z0jzlem2a3tqccqvseg2y": 1000
            },
            {
              "bcrt1q5sacyx5hjrugpcgn5w2mw9aq7d2tnkwxmmjp06": 1000
            }
          ]
        }
      },
      "response": {
        "tx": "02000000000155multiw56000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000560005600056000",
        "txid": "txid5600056000560005600056000560005600056000560005600056000"
      }
    }
  ]
}
