{"uid":"cap_rKmkuk0rbTrs6S1PovZHj","slug":"block-number-at-a-timestamp-e51e5bdf","name":"Block Number at a Timestamp","description":"APEX. Which block was the chain at at this time? Pass ?chain= (ethereum, base, arbitrum, optimism, polygon, arc, bnb or robinhood) and ?time= (ISO date-time or unix seconds, from 2015 to now). Returns the last block whose timestamp is at or before the time: number, hash, exact timestamp, seconds between, and the next block. Found by searching live RPC reads (28 at most), so the answer comes from the chain, not an index. A time before the chain's first block is a finding.","url":"https://apexfaucet.xyz/api/x402/block-at-time?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","queryParams"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["chain","time"],"properties":{"time":{"type":"string","description":"ISO date-time (zone-less means UTC) or unix seconds; not before 2015 and not in the future."},"chain":{"enum":["ethereum","base","arbitrum","optimism","polygon","arc","bnb","robinhood"],"type":"string","description":"Chain to search."}}}}},"output":{"type":"object"}}},"responseSchema":{"type":"json","schema":{"type":"object","properties":{"ok":{"type":"boolean"},"data":{"type":"object"},"paid":{"type":"number"}}},"example":{"ok":true,"data":{"ms":629,"ok":true,"block":{"iso":"2024-03-01T11:59:59.000Z","hash":"0xcc9e11dab0ad3a11a286398d…","number":19340185,"timestamp":1709294399},"chain":"ethereum","found":true,"notes":["The block is the last one …"],"query":{"iso":"2024-03-01T12:00:00.000Z","unix":1709294400,"assumedUtc":false},"chainId":1,"rpcReads":9,"nextBlock":{"iso":"2024-03-01T12:00:11.000Z","hash":"0xdd1ca5c9d01b28e0ab55a427…","number":19340186,"timestamp":1709294411,"secondsAfterTime":11},"latestBlock":{"iso":"2026-11-05T12:32:35.000Z","number":26348654,"timestamp":1793881955},"differenceSeconds":1},"paid":0.002}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","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.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_1HVDhEUmpTE7NLXSi2qta","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns the block number, hash, and timestamp for the last block at or before a given datetime on Ethereum, Base, Arc, or BNB Chain","exampleAgentPrompt":"What block was Ethereum on at 2023-06-15T12:00:00Z? Give me the block number, hash, and exact timestamp.","exampleUseCases":[{"title":"Audit event at historical block","prompt":"I need to know what block Ethereum was on at 2022-11-08T20:00:00Z — can you get me the block number and hash for that exact moment?"},{"title":"Base chain timestamp anchor for DeFi snapshot","prompt":"For my DeFi report, what was the last block on Base before 2024-01-01T00:00:00Z? I need the block number and its exact timestamp."},{"title":"BNB Chain block lookup for compliance","prompt":"Which block was BNB Chain at on 2023-03-15 at 09:30 UTC? I need the block number, hash, and how many seconds off the target time it was."}],"resultDescription":"Returns a JSON object with ok (boolean), paid (amount in USDC), and data containing: the block number, block hash, exact block timestamp, seconds difference between the queried time and the block timestamp, and information about the next block after the found block.","failureModes":["Timestamp before 2015 (before any supported chain's genesis) returns a special 'before first block' finding rather than an error","Future timestamps are rejected","Missing required query parameters (chain or time) result in an error","Unsupported chain name returns an error","Ambiguous or malformed datetime strings may be misinterpreted; zone-less times are assumed UTC","Network or RPC node issues may cause slow or failed responses after up to 28 live RPC reads"],"whenToPreferThis":"Use this endpoint when you need to map a human-readable or Unix datetime to a specific on-chain block number on Ethereum, Base, Arc, or BNB Chain without relying on a centralized index — the answer comes from live RPC reads against the chain itself, making it authoritative. Prefer this over block explorer APIs when you need chain-verified results for Arc (which few other services support), or when you need the exact block at-or-before a time with adjacent block context.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-11T12:23:07.715Z","isFirstParty":false,"canonicalSlug":"block-number-at-a-timestamp-e51e5bdf"}