apyhub
Back
▣ FINANCE

Get Blockchain Gas Prices and Transaction Fee API

What it does

Blockchain Gas Tracker gives you a current gas snapshot for a supported EVM chain. Send a chain value and get back the selected chain, the gasPriceGwei, the blockNumber it was observed on, and the source RPC host that answered. Depending on the network, the response can also include baseFeeGwei and priorityFeeGwei.

Use it when you need to estimate transaction costs before submitting a swap, mint, bridge, or contract call. The endpoint covers Ethereum, Polygon, BSC, Arbitrum, Optimism, Base, and Avalanche, so you can build fee-aware UX across multiple chains without hardcoding stale values.

The response is intentionally lightweight: one chain, one block height, and the gas data you need to make routing or pricing decisions. That makes it useful for dashboards, fee estimators, wallet flows, and backend jobs that need a live gas reading rather than historical analytics.

If you are normalising fees across chains, the fields are easy to consume directly in application logic or display in a user-facing estimate.

GET
Multi-chain gas snapshot
https://api.eu.apyhub.com/corsair96/get-blockchain-gas-prices-transaction-fee/crypto/gas

QUICKSTART

GUIDE

Quickstart

Fetch the gas snapshot for the default chain (ethereum).

curl -X GET "https://api.eu.apyhub.com/corsair96/get-blockchain-gas-prices-transaction-fee/crypto/gas" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

Returns a JSON object with these top-level fields: chain (string), gasPriceGwei (number), blockNumber (integer), and source (string). It may also include baseFeeGwei and priorityFeeGwei, which can be number or null.

{
  "chain": "ethereum",
  "gasPriceGwei": 12.4,
  "blockNumber": 19654321,
  "source": "rpc.ankr.com",
  "baseFeeGwei": 11.8,
  "priorityFeeGwei": 0.6
}
TRY ITLIVE · 75 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Returns a snapshot of gas pricing for the selected blockchain network. You can optionally choose the chain with a query parameter; the response includes the chain, gas price, block number, and the source RPC host, plus optional fee breakdown fields.

Query Parameter(s)

AttributeTypeMandatoryDescription
chainStringNoAllowed values: ethereum, polygon, bsc, arbitrum, optimism, base, avalanche
Default: ethereum

Response

Returns a JSON object with required chain (string), gasPriceGwei (number), blockNumber (integer), and source (string) fields, plus optional baseFeeGwei and priorityFeeGwei fields, both of which may be number or null.

ParameterTypeDescription
chainStringThe chain for which the gas snapshot was taken.
sourceStringRPC host that answered.
baseFeeGweiNumberBase fee in Gwei, or null if unavailable.
blockNumberIntegerBlock number associated with the snapshot.
gasPriceGweiNumberGas price in Gwei.
priorityFeeGweiNumberPriority fee in Gwei, or null if unavailable.
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.