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

# Get the base fee percentile

Returns the base fee percentile (50th percentile) of the specified blockchain network. This method uses [80 credits](/services/get-started/pricing/) from your daily balance.

For example, if the API returns a value of `20` Gwei, it means that 50% of the historical base fees are less than or equal to `20` Gwei.

This can be useful for users or applications to estimate the optimal gas price for transactions based on historical data.

**GET** `https://gas.api.infura.io/networks/${chainId}/baseFeePercentile`

## Parameters[​](#parameters "Direct link to Parameters")

**Path**:

- `chainId`: `string` - ID of the chain to query. See the [list of supported chain IDs](/services/get-started/endpoints/#gas-api).

## Returns[​](#returns "Direct link to Returns")

`baseFeePercentile`: `string` - The base fee in Gwei at the 50th percentile, meaning that 50% of the base fees are less than or equal to the provided amount.

## Example[​](#example "Direct link to Example")

### Request[​](#request "Direct link to Request")

Include your [API key](/developer-tools/dashboard/get-started/create-api/)and optional [API key secret](/developer-tools/dashboard/how-to/secure-an-api/api-key-secret/)to authorize your account to use the APIs.

tip

You can call the API with only an API key, and [include it as a path parameter](/services/reference/gas-api/api-reference/#supported-api-request-formats)instead of using the curl authentication option (`-u`).

- curl
- JavaScript

```
curl -X "GET" \
  -u <YOUR-API-KEY>:<YOUR-API-KEY-SECRET> \
  "https://gas.api.infura.io/networks/1/baseFeePercentile"

```

```
const axios = require('axios')

const apiKey = '<YOUR-API-KEY>' // Replace with your API key.
const apiKeySecret = '<YOUR-API-KEY-SECRET>' // Replace with your API key secret.

const Auth = Buffer.from(apiKey + ':' + apiKeySecret).toString('base64')

// The chain ID of the supported network.
const chainId = 1

;(async () => {
  try {
    const { data } = await axios.get(
      `https://gas.api.infura.io/networks/${chainId}/baseFeePercentile`,
      {
        headers: {
          Authorization: `Basic ${Auth}`,
        },
      }
    )
    console.log('Base fee percentile:', data)
  } catch (error) {
    console.log('Server responded with:', error)
  }
})()

```

### Response[​](#response "Direct link to Response")

```
{
  "baseFeePercentile": "23.227829059"
}

```
