> 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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sms4sats.com/api-reference/fund-account.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
