# Airdrop

The airdrop consists of two steps:&#x20;

1. PSBT construction
2. Order creation & broadcast

## 1. PSBT Construction

<mark style="color:green;">`POST`</mark> `https://api.ordinalsbot.com/runes/airdrop`

Receives the airdrop data and returns the PSBT to be signed

**Headers**

**Body**

| Name                                                | Type                              | Description                                                                      |
| --------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------- |
| runeName<mark style="color:red;">\*</mark>          | String                            | Rune name with spacers                                                           |
| perAddressAmount<mark style="color:red;">\*</mark>  | Number                            | Amount to distribute to each address                                             |
| runeSenderAddress<mark style="color:red;">\*</mark> | String                            | Bitcoin address containing the necessary rune amount                             |
| runeSenderPublicKey                                 | String                            | Public key corresponding to the runeSenderAddress (needed for taproot)           |
| btcSenderAddress<mark style="color:red;">\*</mark>  | String                            | Bitcoin address containing the necessary btc amount for network fees and postage |
| btcSenderPublicKey                                  | String                            | Public key corresponding to the btcSenderAddress (needed for taproot)            |
| receiverAddresses<mark style="color:red;">\*</mark> | Array                             | Array of addresses to receive the airdrop (max 2000 addresses)                   |
| feeRate<mark style="color:red;">\*</mark>           | Number                            | Fee rate in sats/vB                                                              |
| excludeUTXOs                                        | Array of outpoints \["txid:vout"] | Array containing UTXOs not to spend                                              |
| simulateFee                                         | Boolean                           | If true, only return fee estimation (Default = false)                            |

**Response**

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

```json
{
    "psbt":"cHNidP8BAHECAAAAAfPQ0OTWpSxwRJK...",
    "chainFee": 1000,
    "serviceFee": 100
}
```

{% endtab %}

{% tab title="500: Internal Server Error" %}

```json
{
    "status": "error",
    "error": "error reason"
}
```

{% endtab %}

{% tab title="400: Bad Request" %}

{% endtab %}
{% endtabs %}

## 2. Order creation & broadcast

<mark style="color:green;">`POST`</mark> `https://api.ordinalsbot.com/runes/airdrop-psbt`

Receives the signed PSBTs, creates an order and broadcasts the transaction

**Body**

| Name     | Type   | Description                                  |
| -------- | ------ | -------------------------------------------- |
| `psbt`   | String | Signed PSBTs in base64 to broadcast          |
| runeName | String | Valid rune name corresponding to the airdrop |

**Response**

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

<pre class="language-json"><code class="lang-json">{
<strong>    "runeName": "RuneName",
</strong>    "psbts": [
        "cHNidP8BAHECAAAAAfPQ0OTWpSxwRJK..."
    ],
    "orderType": "rune-airdrop",
    "id": "76d1a25b-1e56-4476-8a98-d248f1ab5f95",
    "status": "ok",
    "state": "queued",
    "createdAt": {
        ".sv": "timestamp"
    }
}
</code></pre>

{% endtab %}

{% tab title="500: Internal Server Error" %}

```json
{
    "status": "error",
    "error": "error reason"
}
```

{% endtab %}

{% tab title="400: Bad Request" %}

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

{% endtab %}
{% endtabs %}
