# Split

## Split UTXO

<mark style="color:green;">`POST`</mark> `/utxo/split`&#x20;

This endpoint handles the creation of a PSBT that splits a Bitcoin address's UTXOs into smaller ones. It validates the request, constructs the transaction, and returns the result.

* Splits UTXOs into the specified number of outputs with equal value.
* Returns the unsigned PSBT (base64) ready for signing and broadcasting.

**Body**

| Name                                        | Type                                                 | Description                                                                         |
| ------------------------------------------- | ---------------------------------------------------- | ----------------------------------------------------------------------------------- |
| inAddress<mark style="color:red;">\*</mark> | string                                               | Bitcoin address to get the UTXOs from                                               |
| outAddress (optional)                       | string                                               | Bitcoin address to send the splits. If not set then UTXOs will be sent to inAddress |
| splits<mark style="color:red;">\*</mark>    | <p>array:</p><p>{ value: number, count: number }</p> | Array containing split objects                                                      |
| value<mark style="color:red;">\*</mark>     | number                                               | Value of each UTXO split                                                            |
| feeRate<mark style="color:red;">\*</mark>   | number                                               | Fee rate in sats/vByte                                                              |
| publicKey                                   | string                                               | Address associated public key, needed for p2sh only                                 |
| excludeUTXOs                                | array of outpoints ("txid:vout")                     | Array containing UTXOs not to spend                                                 |
| ignorePadding                               | boolean                                              | If true padding outputs (600sats) will be ignored (Default = true)                  |

**Example:**

```json
{
  "inAddress": "tb1qr4...",
  "outAddress": "tb1qr4sw...",
  "splits": [
    {
        "value": 600,
        "count": 2
    },
    {
        "value": 1000,
        "count": 3
    }
  ],
  "feeRate": "10",
  "publicKey": "03725d3f189...",
  "excludeUTXOs": [
    "b591b8b5ba6c54ce65bc72ea20a9e0ed4f50eccaaa8669b542932b8687b2ef37:0",
    "b591b8b5ba6c54ce65bc72ea20a9e0ed4f50eccaaa8669b542932b8687b2ef37:0"
  ],
  "ignorePadding": true
}
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "psbt": "cHNidP8BAJACAAAA..."
}
```

{% endtab %}

{% tab title="500" %}

```
{
  "error": "Internal server error"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}
