> For the complete documentation index, see [llms.txt](https://docs.sms4sats.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sms4sats.com/api-reference/fund-account.md).

# Fund Account

<mark style="color:green;">`POST`</mark> `https://api2.sms4sats.com/fund`

Creates a Lightning invoice to top up a prepaid API Key balance. Once funded, you can use `immediate: true` on order endpoints to skip per-order invoice payment and deduct directly from your balance.

#### Headers

| Name        | Type   | Required | Description           |
| ----------- | ------ | -------- | --------------------- |
| `X-API-Key` | String | Yes      | Your API Key to fund. |

#### Request Body

| Name     | Type   | Required | Description                                |
| -------- | ------ | -------- | ------------------------------------------ |
| `amount` | Number | Yes      | Amount in satoshis to add to your balance. |

{% tabs %}
{% tab title="200: OK" %}
{% code overflow="wrap" %}

```javascript
{
    status: 'OK', 
    orderId: '7dc6e6b61d8c54dff6b8d6ea2e3f08b018e57963df81d493a6f9728c4dc83318', 
    payreq: 'lnbc30u1p34yef6pp5...'
}
```

{% endcode %}
{% endtab %}

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

```javascript
{
    status: 'error',
    reason: 'backend error'
}
```

{% endtab %}
{% endtabs %}

### Response Fields

| Field     | Type   | Description                                          |
| --------- | ------ | ---------------------------------------------------- |
| `status`  | String | `OK` on success                                      |
| `orderId` | String | Funding order ID                                     |
| `payreq`  | String | BOLT11 Lightning invoice to pay to fund your balance |

{% hint style="info" %}
Once the invoice is paid, your balance is credited and visible via [Get Balance](/api-reference/get-balance.md). You can then use `immediate: true` when creating orders to deduct directly without receiving a new invoice each time.

Get in touch for volume discounts: <sales@sms4sats.com>.
{% endhint %}
