{"openapi":"3.1.0","info":{"title":"GWEI gas price API","version":"1.0.0","description":"The current Ethereum mainnet gas price and the last 24 hours of fee history, read from the chain directly rather than from a third-party gas oracle. See https://gwei.ryanio.com/about for how the numbers are produced."},"servers":[{"url":"https://gwei.ryanio.com"}],"paths":{"/api/gas":{"get":{"operationId":"getGasPrice","summary":"Current gas price","description":"Fast, normal and cheap priority fees, the base fee, and the USD cost of a plain ETH transfer at each speed. Cached for at most 30 seconds server-side, so polling faster than that returns the same reading.","responses":{"200":{"description":"Current gas snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GasSnapshot"}}}},"500":{"$ref":"#/components/responses/Error"}}}},"/api/gas/history":{"get":{"operationId":"getGasHistory","summary":"24-hour fee history","description":"Base fee and priority fee readings over the last 24 hours, for charting. A reading is only recorded when someone loads the site, so coverage is dense during busy periods and sparse during quiet ones.","responses":{"200":{"description":"Gas history","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GasHistory"}}}},"500":{"$ref":"#/components/responses/Error"}}}}},"components":{"responses":{"Error":{"description":"The upstream read failed and no cached reading was available.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string","description":"Human-readable reason. Not a machine-readable code.","example":"Failed to fetch gas data"}},"required":["error"]},"GasSpeed":{"type":"string","enum":["fast","normal","cheap"]},"SpeedOption":{"type":"object","properties":{"speed":{"$ref":"#/components/schemas/GasSpeed"},"label":{"type":"string","example":"Normal"},"eta":{"type":"string","example":"~1 min"},"priorityFeeGwei":{"type":"number","description":"The tip, in gwei."},"totalGwei":{"type":"number","description":"baseFeeGwei + priorityFeeGwei."},"maxFeeGwei":{"type":"number","description":"Recommended maxFeePerGas to set in a wallet, in gwei."},"usdPerTransfer":{"type":["number","null"],"description":"Cost of a 21000-gas ETH transfer at totalGwei. null when no ETH price is available; never a placeholder."}},"required":["speed","label","eta","priorityFeeGwei","totalGwei","maxFeeGwei","usdPerTransfer"]},"GasSnapshot":{"type":"object","properties":{"baseFeeGwei":{"type":"number"},"speeds":{"type":"array","items":{"$ref":"#/components/schemas/SpeedOption"},"minItems":3,"maxItems":3,"description":"Exactly 3 entries, in order: fast, normal, cheap."},"ethPriceUsd":{"type":["number","null"],"description":"null when no price could be fetched. Never a placeholder."},"blockNumber":{"type":"integer"},"updatedAt":{"type":"integer","description":"Epoch milliseconds when this data was read."},"ethPriceStale":{"type":"boolean","description":"True when ethPriceUsd is a cached leftover rather than a fresh quote. Omitted entirely when false."}},"required":["baseFeeGwei","speeds","ethPriceUsd","blockNumber","updatedAt"]},"HistoryPoint":{"type":"object","properties":{"t":{"type":"integer","description":"Epoch milliseconds."},"gwei":{"type":"number","description":"Base fee at that moment."},"tip":{"type":"number","description":"Median priority fee at that moment. Omitted on older points recorded before the tip was tracked."}},"required":["t","gwei"]},"GasHistory":{"type":"object","properties":{"points":{"type":"array","items":{"$ref":"#/components/schemas/HistoryPoint"},"description":"Chronological, oldest first, last 24 hours."},"low24h":{"type":["number","null"]},"high24h":{"type":["number","null"]}},"required":["points","low24h","high24h"]}}}}