# getFeeStats

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://stellar-mainnet.g.alchemy.com/v2/{apiKey}

Statistics for charged inclusion fees. The inclusion fee statistics are calculated from the inclusion fees that were paid for the transactions to be included onto the ledger. For Soroban transactions and Stellar transactions, they each have their own inclusion fees and own surge pricing. Inclusion fees are used to prevent spam and prioritize transactions during network traffic surge.

Reference: https://www.alchemy.com/docs/chains/stellar/stellar-api-endpoints/get-fee-stats

## Result

**getFeeStatsResult** (object)

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://stellar-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getFeeStats"
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({jsonrpc: '2.0', id: 1, method: 'getFeeStats'})
};

fetch('https://stellar-mainnet.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://stellar-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getFeeStats"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://stellar-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getFeeStats\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://stellar-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getFeeStats\"\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://stellar-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getFeeStats\"\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: getFeeStats
summary: returns statistics about charged inclusion fees
description: Statistics for charged inclusion fees. The inclusion fee statistics are calculated from the inclusion fees that were paid for the transactions to be included onto the ledger. For Soroban transactions and Stellar transactions, they each have their own inclusion fees and own surge pricing. Inclusion fees are used to prevent spam and prioritize transactions during network traffic surge.
externalDocs:
  url: https://developers.stellar.org/docs/data/apis/rpc/api-reference/methods/getFeeStats
paramStructure: by-name
params: []
result:
  name: getFeeStatsResult
  schema:
    type: object
    properties:
      sorobanInclusionFee:
        type: object
        description: Inclusion fee distribution statistics for Soroban transactions
        properties:
          max:
            description: Maximum fee
            type: string
          min:
            description: Minimum fee
            type: string
          mode:
            description: Fee value which occurs the most often
            type: string
          p10:
            description: 10th nearest-rank fee percentile
            type: string
          p20:
            description: 20th nearest-rank fee percentile
            type: string
          p30:
            description: 30th nearest-rank fee percentile
            type: string
          p40:
            description: 40th nearest-rank fee percentile
            type: string
          p50:
            description: 50th nearest-rank fee percentile
            type: string
          p60:
            description: 60th nearest-rank fee percentile
            type: string
          p70:
            description: 70th nearest-rank fee percentile
            type: string
          p80:
            description: 80th nearest-rank fee percentile
            type: string
          p90:
            description: 90th nearest-rank fee percentile.
            type: string
          p95:
            description: 95th nearest-rank fee percentile.
            type: string
          p99:
            description: 99th nearest-rank fee percentile
            type: string
          transactionCount:
            description: How many transactions are part of the distribution
            type: number
          ledgerCount:
            description: How many consecutive ledgers form the distribution
            type: number
      inclusionFee:
        type: object
        description: Fee distribution statistics for Stellar (i.e. non-Soroban) transactions. Statistics are normalized per operation.
        properties:
          max:
            description: Maximum fee
            type: string
          min:
            description: Minimum fee
            type: string
          mode:
            description: Fee value which occurs the most often
            type: string
          p10:
            description: 10th nearest-rank fee percentile
            type: string
          p20:
            description: 20th nearest-rank fee percentile
            type: string
          p30:
            description: 30th nearest-rank fee percentile
            type: string
          p40:
            description: 40th nearest-rank fee percentile
            type: string
          p50:
            description: 50th nearest-rank fee percentile
            type: string
          p60:
            description: 60th nearest-rank fee percentile
            type: string
          p70:
            description: 70th nearest-rank fee percentile
            type: string
          p80:
            description: 80th nearest-rank fee percentile
            type: string
          p90:
            description: 90th nearest-rank fee percentile.
            type: string
          p95:
            description: 95th nearest-rank fee percentile.
            type: string
          p99:
            description: 99th nearest-rank fee percentile
            type: string
          transactionCount:
            description: How many transactions are part of the distribution
            type: number
          ledgerCount:
            description: How many consecutive ledgers form the distribution
            type: number
      latestLedger:
        title: latestLedger
        description: The sequence number of the latest ledger known to Stellar RPC at the time it handled the request.
        type: number
```
