{"uid":"cap_pbwRRd5B6e6gPg01uSzkh","slug":"base-gas-cheapest-window-oracle-x402-cf83f6ac","name":"Base Gas Cheapest Window Oracle (x402)","description":"Cheapest hours of day to transact on Base, from collected gas history: hourly averages in UTC ranked cheapest first, plus the savings percent.","url":"https://base-gas-x402-production.up.railway.app/gas/cheapest-window","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":[],"properties":{"hours":{"type":"integer","default":168,"maximum":168,"minimum":1,"description":"Lookback window in hours used to compute hourly averages. Defaults to 168 (7 days). Check the free GET /health route first to see how much history has been collected."}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":{"type":"json","example":{"chain":"base-mainnet","units":"gwei","chainId":8453,"coverage":{"samples":2016,"hoursCovered":168,"retentionHours":168},"fetchedAt":"2026-07-26T06:08:54.972Z","hoursObserved":24,"hourlyAverages":[{"hourUtc":6,"samples":84,"avgGasPrice":0.005},{"hourUtc":14,"samples":84,"avgGasPrice":0.019}],"requestedHours":168,"savingsPercent":73.7,"cheapestHourUtc":6,"priciestHourUtc":14}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_bTTH3ocPRhqOxTrCvDIso","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns hourly gas price averages for Base mainnet over a configurable lookback window to identify the cheapest and most expensive hours to transact.","exampleAgentPrompt":"What's the cheapest hour to submit transactions on Base mainnet? Look back over the last 7 days of gas data so I can schedule my contract calls to minimize fees.","exampleUseCases":[{"title":"Schedule batch payments at cheapest gas window","prompt":"I need to send a batch of USDC transfers on Base — can you check the last 7 days of gas data and tell me which hour UTC tends to be cheapest so I can schedule them then?"},{"title":"DeFi bot gas cost optimization","prompt":"My DeFi bot runs on Base mainnet and I want to minimize gas costs. Pull the hourly gas averages for the past 24 hours and tell me when gas is cheapest and how much I could save versus the peak hour."},{"title":"Weekly gas timing report for treasury ops","prompt":"Give me a weekly gas timing report for Base — look at the last 168 hours of gas prices, show me the cheapest and most expensive hours, and tell me what percentage I can save by timing my transactions right."}],"resultDescription":"Returns a JSON object with the chain name and ID, the requested and actual hours observed, hourly average gas prices (in gwei) keyed by UTC hour, the cheapest and priciest UTC hours, estimated savings percentage between those extremes, total sample count, and a timestamp of when the data was fetched.","failureModes":["hours parameter out of range (must be 1–168) returns a validation error","insufficient historical data collected (check /health first) may return fewer hours than requested","railway.app service downtime returns a 5xx or connection error","x402 payment not included or incorrect USDC amount results in 402 Payment Required response"],"whenToPreferThis":"Use this endpoint when you need to optimize the timing of Base mainnet transactions by identifying the historically cheapest gas windows. It is ideal for agents scheduling batch operations, treasury transfers, or DeFi interactions on Base (chain ID 8453) where gas timing matters. Prefer it over raw gas price endpoints when you want multi-hour trend analysis and built-in savings calculations rather than a single current gas price snapshot.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T00:36:25.846Z","isFirstParty":false}