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

# API v1 docs

The API is authenticated via URL parameter to decrease implementation difficulty for low-code or no-code users, such as BotGhost users.

The API base URL will always be `https://api.meltfinance.org`.

## Get the current Bitcoin price

<mark style="color:green;">`GET`</mark> `/v1/btcprice`

{% tabs %}
{% tab title="Valid API key" %}

```json
{
  "status": "success",
  "message": "97498.37"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
This endpoint does not require an API key.
{% endhint %}

## Get account balance

<mark style="color:green;">`GET`</mark> `/v1/balance?apikey=YOUR_API_KEY`

{% tabs %}
{% tab title="Valid API key" %}

```json
{
  "balance": 2317800,
  "balance_satoshi": 3782497370000,
  "btc_balance": 3782500000,
  "status": "success"
}
```

{% endtab %}

{% tab title="Invalid API key" %}

```json
{
  "status": "error",
  "message": "Invalid API key."
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Here, the `balance` is the USD value, `balance_satoshi` is the millisatoshi value, and `btc_balance` is the regular satoshi value.
{% endhint %}

## Get account info

<mark style="color:green;">`GET`</mark> `/v1/info?apikey=YOUR_API_KEY`

{% tabs %}
{% tab title="Valid API key" %}

```json
{
  "username": "dyntech",
  "lnurlp": "LNURL1DP68GURN8GHJ7MT9D36XV6FWW3HHQTEWWAJKCMPDDDHX7AMW9AKXUATJD3CZ7EREDE6X2CMGWMZDJE",
  "status": "success"
}
```

{% endtab %}

{% tab title="Invalid API key" %}

```json
{
  "status": "error",
  "message": "Invalid API key."
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
`lnurlp` stands for LNURL-Pay, which is an alternate representation of a Lightning address. It is recommended to present this to wallets with QR code scanning capabilities as it is more currently widespread.
{% endhint %}

## Get account transactions

<mark style="color:green;">`GET`</mark> `/v1/transactions?apikey=YOUR_API_KEY&limit=500`

{% tabs %}
{% tab title="Valid API key" %}

```json
[
  {
    "amount": 5125000,
    "bolt11": "lnbc51250n1pn56qunpp5wgnjc47qm6lflm4w6p4a8dujzjyds94489dssalw92du7gslr3gqdpqf4jkcapqge5kuctwvdjjq6twwehkjcm9cqzzsxqyp2xqsp5pyhc8l4jm36q3kchjufmkl23w6y3z40y4l8sqa3f8x6ggjtwc4us9qxpqysgq78z8crgzd820g4shdfgr353vqej8vgs9kc4hg2rl82kratvvw05yw4weav4s5p69vmruvt4u604hdxgjcmmk3gjhr3gxe8e6gpegdqsq4uqzjm",
    "checking_id": "72272c57c0debe9feeaed06bd3b7921488d816b5395b0877ee2a9bcf221f1c50",
    "expiry": 1733143635,
    "extra": {
      "wallet_fiat_amount": 5,
      "wallet_fiat_currency": "USD",
      "wallet_fiat_rate": 1025
    },
    "fee": 0,
    "memo": "Melt Finance invoice",
    "payment_hash": "72272c57c0debe9feeaed06bd3b7921488d816b5395b0877ee2a9bcf221f1c50",
    "pending": false,
    "preimage": "0000000000000000000000000000000000000000000000000000000000000000",
    "time": 1733100435,
    "wallet_id": "d22dd27b694a479d8fa045513da83ef9",
    "webhook": null,
    "webhook_status": null
  }
]
```

{% endtab %}

{% tab title="Invalid API key" %}

```json
{
  "status": "error",
  "message": "Invalid API key."
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
This endpoint will normally return ALL of your transactions. The provided JSON is only a record of an invoice being paid. It is recommended to test your app extensively if it needs this endpoint's data. To limit the amount of data your app receives, use the optional `limit` parameter to add an upper cap.
{% endhint %}

## Create invoice

<mark style="color:green;">`GET`</mark> `/v1/invoices/create?apikey=YOUR_API_KEY&amount=69420&currency=sat&memo=Sigma%20Payment`

{% tabs %}
{% tab title="Valid API key" %}

```json
{
  "message": "lnbcExampleInvoice",
  "status": "success"
}
```

{% endtab %}

{% tab title="Invalid API key" %}

```json
{
  "status": "error",
  "message": "Invalid API key."
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The `currency` parameter is optional, and can be either `sat` or `USD`. `memo` is also optional but highly recommended.
{% endhint %}

## Pay invoice

<mark style="color:green;">`GET`</mark> `/v1/invoices/pay?apikey=YOUR_API_KEY&invoice=YOUR_INVOICE_HERE`

{% tabs %}
{% tab title="Valid API key" %}

```json
{
  "status": "success",
  "message": "Invoice paid successfully!"
}
```

{% endtab %}

{% tab title="Invalid API key" %}

```json
{
  "status": "error",
  "message": "Invalid API key."
}
```

{% endtab %}

{% tab title="Other sort of error" %}

```json
{
  "status": "error",
  "message": "ERROR_DETAILS_HERE"
}
```

{% endtab %}
{% endtabs %}

## Decode invoice

<mark style="color:green;">`GET`</mark> `/v1/invoices/decode?invoice=YOUR_INVOICE_HERE`

{% tabs %}
{% tab title="Valid invoice" %}

```json5
{
  'currency': 'bc',
  'amount_msat': 69420000,
  'date': 1728970332,
  'signature': '756bb5cf22e66b201ec3244c7e3a787a4254003edba16e2c03543a84425ceae9144c109fbaac325e5f3d9a8897b159779bf3225d7062d0c817cb2142ec2be8a6',
  'payment_hash': '0e3877bb7e8362f904cc70ca14daac4722eef1757f065ad1cedaffd204626a78',
  'payment_secret': '0278f95396c2a5593572d3f2afd01824acc8e11717dba3e04a109d025e33adc2',
  'description': 'Invoice by skibidirizzler',
  'expiry': 43200,
  'features': {
      'var_onion_optin': 'required',
      'payment_secret': 'required',
      'basic_mpp': 'supported',
      'option_route_blinding': 'supported'
  },
  'min_final_cltv_expiry': 80,
  'payee': '027230e7207075b18b089399c4244ca4b45f5e629108ef020f6812aba67037a499'
  }
```

{% endtab %}

{% tab title="Other sort of error" %}

```json
{
  "status": "error",
  "message": "ERROR_DETAILS_HERE"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
This endpoint does not require an API key. The returned `amount_msat` is of millisatoshis. Unless you are an experienced developer, the other fields may not be of big importance to you.
{% endhint %}

## Pay LNURL or LN address

<mark style="color:green;">`GET`</mark> `/v1/lnurl/pay?apikey=YOUR_API_KEY&object=YOUR_LNURL_HERE&amount=69420&memo=MEMO_HERE`

{% tabs %}
{% tab title="Valid API key" %}

```json
{
  "status": "success",
  "message": "Invoice paid successfully!"
}
```

{% endtab %}

{% tab title="Invalid API key" %}

```json
{
  "status": "error",
  "message": "Invalid API key."
}
```

{% endtab %}

{% tab title="Other sort of error" %}

```json
{
  "status": "error",
  "message": "ERROR_DETAILS_HERE"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The `memo` parameter is optional.
{% endhint %}

## Withdraw from a LNURLw

<mark style="color:green;">`GET`</mark> `/v1/lnurl/withdraw?apikey=YOUR_API_KEY&lnurl=YOUR_LNURLW_HERE`

{% tabs %}
{% tab title="Valid API key" %}

```json
{
  "status": "success",
  "message": "LNURLw processed"
}
```

{% endtab %}

{% tab title="Invalid API key" %}

```json
{
  "status": "error",
  "message": "Invalid API key."
}
```

{% endtab %}

{% tab title="Other sort of error" %}

```json
{
  "status": "error",
  "message": "ERROR_DETAILS_HERE"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
LNURLw (lnurl-withdraw) is a type of LNURL that allows the user to receive a certain amount of money from the recipient. One of its many current uses is to allow [Slice](https://addslice.com/?crew=pVF0j) users to receive their browsing earnings.
{% endhint %}
