Solana Priority Fee API – Smart Fee Estimation for Developers
The Solana Priority Fee API allows developers to fetch optimal compute unit prices in real time, enabling applications to dynamically set fees based on actual network conditions rather than hardcoded values. This is the foundation of reliable, production-grade transaction submission.
Pay only what you need for the speed you want. Smart fee estimation prevents both overpaying and failed transactions due to insufficient priority fees.
The Native RPC Method: getRecentPrioritizationFees
Solana's built-in RPC provides the getRecentPrioritizationFees method, which returns a list of prioritization fees over the last 150 blocks. The response includes the slot number and the minimum fee that was sufficient to land at least one transaction for the given accounts in that slot. This gives a baseline view of the fee market but requires additional processing to extract actionable estimates.
Enhanced APIs: getPriorityFeeEstimate
For a more developer-friendly interface, third-party providers offer enhanced APIs that simplify the response into a single fee estimate per priority tier. The getPriorityFeeEstimate method accepts your transaction (serialized) and returns fee estimates across multiple levels — from Low to Very High — based on real-time analysis of current block data, both globally and for the specific accounts your transaction touches.
Using a Serialized Transaction for Maximum Accuracy
For production applications, sending the full serialized transaction to the fee API yields the most accurate estimate. The API can analyze the exact accounts involved and apply local fee market pricing — accounting for accounts that are in high demand and may require higher fees than the global average.
Integrating with solana/web3.js
A typical integration flow using the Solana Web3.js library involves building your transaction (without the priority fee instruction), calling the fee API with the serialized transaction to get the recommended CU price, then adding a ComputeBudgetProgram.setComputeUnitPrice() instruction with the returned value, signing, and submitting. This pattern ensures your fee is always calibrated to current network conditions.
Fee API Response Example
A typical fee API response returns values in microlamports for each priority tier. For example: Low: 1,000 | Medium: 50,000 | High: 150,000 | Very High: 400,000 | Unsafe Max: 2,000,000. These values shift in real time — during a calm network period, even the High tier may be under 50,000 microlamports.
Rate Limits and Reliability
When building applications that automatically set priority fees, ensure you cache fee estimates for short intervals (a few seconds) rather than querying on every transaction. Most fee APIs have rate limits, and the data changes slowly enough that a 2–5 second cache is valid for most use cases. Combine this with retry logic and automatic fee escalation on failure for maximum robustness.



