> For the complete documentation index, see [llms.txt](https://doc.bittap.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.bittap.org/developer-guides/api-reference/estimate-tx-fee.md).

# Estimate-tx-fee

<mark style="color:green;">`POST`</mark> /api/estimate-tx-fee

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `token`            |

#### Request Body

| Name       | Type   | Required | Description                                                |
| ---------- | ------ | -------- | ---------------------------------------------------------- |
| wallet\_id | string | true     | The end user's wallet id                                   |
| amount     | int    | false    | the amount of satoshi to send in case of type 1            |
| type       | int    | true     | 1  layer 1 btc transfer;  2 layer 2 taproot asset transfer |
| fee\_rate  | int    | true     | satoshi cost per byte                                      |

#### Response Body

| Name    | Type | Description                            |
| ------- | ---- | -------------------------------------- |
| tx\_fee | int  | estimated tx\_fee for this transaction |

#### Request Demo

```json
{
  "wallet_id": "10e21d53-82d3-43d6-99bc-03ea6945d902",
  "type": 1,
  "amount": 20000,
  "fee_rate": 21
}
```

**Response Demo**

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

```json
{
    "code": 0,
    "data": {
        "tx_fee": 1512
    },
    "message": "",
    "traceid": "e8857f31-91ee-47ea-975c-d05f6328d9fb"
}
```

{% endtab %}

{% tab title="400" %}

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

{% endtab %}
{% endtabs %}
