# getPriorityFeeEstimate

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

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

Calculate optimal priority fee recommendations for Solana transactions based on real-time network conditions.

Reference: https://www.alchemy.com/docs/chains/solana/solana-api-endpoints/get-priority-fee-estimate

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Configuration | object | Yes | Single params object. Top-level keys are transaction, accountKeys, and options (nested). Put priorityLevel, recommended, etc. inside options. |

## Result

**Priority fee estimate** (object): Optimal priority fee estimate and optional fee levels for different priority tiers.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "getPriorityFeeEstimate",
  "params": [
    {
      "transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=",
      "options": {
        "priorityLevel": "High"
      }
    }
  ],
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://solana-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getPriorityFeeEstimate",
  "params": [
    {
      "transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=",
      "options": {
        "priorityLevel": "High"
      }
    }
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'getPriorityFeeEstimate',
    params: [
      {
        transaction: 'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=',
        options: {priorityLevel: 'High'}
      }
    ]
  })
};

fetch('https://solana-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://solana-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getPriorityFeeEstimate",
    "params": [
        {
            "transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=",
            "options": { "priorityLevel": "High" }
        }
    ]
}
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://solana-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getPriorityFeeEstimate\",\n  \"params\": [\n    {\n      \"transaction\": \"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=\",\n      \"options\": {\n        \"priorityLevel\": \"High\"\n      }\n    }\n  ]\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://solana-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getPriorityFeeEstimate\",\n  \"params\": [\n    {\n      \"transaction\": \"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=\",\n      \"options\": {\n        \"priorityLevel\": \"High\"\n      }\n    }\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://solana-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\": \"getPriorityFeeEstimate\",\n  \"params\": [\n    {\n      \"transaction\": \"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=\",\n      \"options\": {\n        \"priorityLevel\": \"High\"\n      }\n    }\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: getPriorityFeeEstimate
description: Calculate optimal priority fee recommendations for Solana transactions based on real-time network conditions.
params:
  - name: Configuration
    required: true
    description: Single params object. Top-level keys are transaction, accountKeys, and options (nested). Put priorityLevel, recommended, etc. inside options.
    schema:
      title: GetPriorityFeeEstimate Parameters
      type: object
      description: |
        The single element in params (the config object). This object has two levels:
        - Top-level: transaction (optional), accountKeys (optional), and options (optional).
        - Put priorityLevel, recommended, lookbackSlots, etc. inside the options object, not next to transaction.
      properties:
        transaction:
          type: string
          description: Base58 or Base64 encoded Solana transaction for fee estimation analysis. Top-level key (sibling to options).
        accountKeys:
          type: array
          description: Array of Base58-encoded Solana account public keys. Top-level key (sibling to options).
          items:
            type: string
        options:
          description: Nested object for tuning; put priorityLevel, recommended, lookbackSlots, etc. here.
          title: GetPriorityFeeEstimate Options (nested)
          type: object
          properties:
            transactionEncoding:
              type: string
              enum:
                - base58
                - base64
              description: Encoding format of the transaction (default base58).
            priorityLevel:
              type: string
              enum:
                - Min
                - Low
                - Medium
                - High
                - VeryHigh
                - UnsafeMax
                - Default
              description: 'Priority level for fee estimation. Each level maps to a percentile of recent fees: Min (0th), Low (25th), Medium (50th), High (75th), VeryHigh (95th), UnsafeMax (100th).'
            includeAllPriorityFeeLevels:
              type: boolean
              description: When true, return estimates for all priority levels.
            ignoreZeroFees:
              type: boolean
              description: When true, exclude zero-fee transactions from percentile calculation.
            lookbackSlots:
              type: integer
              minimum: 1
              maximum: 150
              description: Number of recent slots to analyze for fee estimation. Default and max is 150.
            recommended:
              type: boolean
              default: false
              description: When true, return the recommended optimal fee (median).
            detailedBreakdown:
              type: boolean
              default: false
              description: When true, return per-account fee breakdown.
examples:
  - name: getPriorityFeeEstimate with transaction
    params:
      - name: Configuration
        value:
          transaction: AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=
          options:
            priorityLevel: High
result:
  name: Priority fee estimate
  description: Optimal priority fee estimate and optional fee levels for different priority tiers.
  schema:
    title: Priority Fee Estimate Result
    type: object
    description: Optimal priority fee estimate and optional fee levels for different priority tiers.
    properties:
      priorityFee:
        type: integer
        description: Estimated optimal fee in microlamports per compute unit (returned when a single priorityLevel or recommended is requested).
      priorityFeeLevels:
        description: Fee estimates for each priority tier (returned when includeAllPriorityFeeLevels is true).
        title: Priority Fee Levels
        type: object
        properties:
          min:
            type: number
            description: Minimum (0th percentile) priority fee in microlamports.
          low:
            type: number
            description: Low (25th percentile) priority fee in microlamports.
          medium:
            type: number
            description: Medium (50th percentile) priority fee in microlamports.
          high:
            type: number
            description: High (75th percentile) priority fee in microlamports.
          veryHigh:
            type: number
            description: Very high (95th percentile) priority fee in microlamports.
          unsafeMax:
            type: number
            description: Unsafe maximum (100th percentile) priority fee in microlamports.
      detailedBreakdown:
        type: array
        description: Per-account fee breakdown (returned when detailedBreakdown option is true).
        items:
          title: Account Fee Details
          type: object
          properties:
            account:
              type: string
              description: Base58-encoded account public key.
            priorityFees:
              description: Fee estimates for this specific account.
              title: Priority Fee Levels
              type: object
              properties:
                min:
                  type: number
                  description: Minimum (0th percentile) priority fee in microlamports.
                low:
                  type: number
                  description: Low (25th percentile) priority fee in microlamports.
                medium:
                  type: number
                  description: Medium (50th percentile) priority fee in microlamports.
                high:
                  type: number
                  description: High (75th percentile) priority fee in microlamports.
                veryHigh:
                  type: number
                  description: Very high (95th percentile) priority fee in microlamports.
                unsafeMax:
                  type: number
                  description: Unsafe maximum (100th percentile) priority fee in microlamports.
```
