{"uid":"cap_IRSvFDuYLca_XfQP-r3gU","slug":"block-by-timestamp-f4fbf78d","name":"Block By Timestamp","description":"Nearest Ethereum block number to a given Unix timestamp, from Etherscan's V2 API -- anchors a point in time to a specific block for historical on-chain lookups (e.g. state as of a given date). Not address-specific. $0.01/call.","url":"https://www.x402financialdata.com/block-by-timestamp","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","HEAD","DELETE"],"type":"string"},"queryParams":{"type":"object","required":["timestamp"],"properties":{"chain":{"enum":["eth"],"type":"string","description":"Which chain to query. Only 'eth' is supported right now."},"closest":{"enum":["before","after"],"type":"string","description":"Return the closest block before or after the timestamp, default 'before'."},"timestamp":{"type":"integer","description":"Unix timestamp (seconds)."}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","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.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_bxnJFnbrMuK70KB6kgnkR","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns the nearest Ethereum block number for a given Unix timestamp, anchoring a point in time to a specific on-chain block for historical state lookups.","exampleAgentPrompt":"What's the Ethereum block number closest to midnight UTC on March 15, 2023 — give me the block just before that timestamp.","exampleUseCases":[{"title":"Historical token balance snapshot","prompt":"I need to know what Ethereum block was active right before the start of 2024 — specifically the block just before Unix timestamp 1704067200 — so I can query a token contract's historical state at that exact moment."},{"title":"DeFi protocol audit at a past date","prompt":"What Ethereum block number corresponds to right before the Uniswap exploit on April 18, 2023 at 14:00 UTC (Unix timestamp 1681826400)? I want to anchor my on-chain audit to that block."},{"title":"NFT snapshot for airdrop eligibility","prompt":"Find me the closest Ethereum block before Unix timestamp 1680307200 — that's April 1, 2023 at midnight UTC — so I can check wallet holdings at that point in time for an airdrop eligibility snapshot."}],"resultDescription":"Returns the Ethereum block number nearest to the requested Unix timestamp, along with whether it is the block immediately before or after that timestamp, enabling precise historical on-chain lookups tied to a real-world point in time.","failureModes":["Invalid or future Unix timestamp returns an error or unexpected result","Unsupported chain value (anything other than 'eth') returns a validation error","Missing required timestamp parameter returns a 400-level error","Etherscan API rate limits or downtime may cause upstream failures","Very early timestamps (pre-Ethereum genesis) may not resolve to a valid block"],"whenToPreferThis":"Use this endpoint when you need to pin a specific date or time to an Ethereum block number before making historical on-chain queries — such as reading past contract state, checking historical balances, or auditing DeFi protocol activity at a precise moment. It is the right choice when time-based block anchoring is required rather than querying the latest block or a known block number directly.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T12:40:19.996Z","isFirstParty":false}