> 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/get-history.md).

# Get History

<mark style="color:blue;">`GET`</mark> `https://api2.sms4sats.com/history`

Returns the complete funding history for a prepaid API Key, including all top-up transactions and their amounts.

#### Headers

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

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

```javascript
{
  status: 'OK', 
  totalAmount: 349500,
  orders: [ 
    {
      amount: 9500,
      createdAt: 1668612831730,
      desc: 'fund account',
      description: 'fund account',
      holdinvoice: true,
      preimage: 'xxx',
      preimageHash: 'sha256(xxx)',
      price: 9500,
      userId: 'APIKEY'
    },
    ...
  ],
}
```

{% endcode %}
{% endtab %}

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

```javascript
{
    status: 'error',
    reason: 'X-API-Key header is missing.'
}
```

{% endtab %}
{% endtabs %}

### Response Fields

| Field                   | Type    | Description                                      |
| ----------------------- | ------- | ------------------------------------------------ |
| `status`                | String  | `OK` on success                                  |
| `totalAmount`           | Number  | Total satoshis funded across all transactions    |
| `orders`                | Array   | List of funding transactions                     |
| `orders[].amount`       | Number  | Amount funded in this transaction (satoshis)     |
| `orders[].createdAt`    | Number  | Unix timestamp (milliseconds) of the transaction |
| `orders[].description`  | String  | Transaction description                          |
| `orders[].holdinvoice`  | Boolean | Whether this was a hold invoice                  |
| `orders[].preimage`     | String  | Lightning payment preimage                       |
| `orders[].preimageHash` | String  | SHA256 hash of the preimage                      |
| `orders[].price`        | Number  | Price paid (satoshis)                            |
| `orders[].userId`       | String  | The API Key associated with this transaction     |

{% hint style="info" %}
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, and the optional `goal` query parameter:

```
GET https://docs.sms4sats.com/api-reference/get-history.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
