Skip to main content
GET
/
v2
/
api
curl "https://api.etherscan.io/v2/api?chainid=1&module=block&action=getblocknobytime&timestamp=1578638524&closest=before&apikey=YourApiKeyToken"
{
  "status": "1",
  "message": "OK",
  "result": "9251482"
}

Query Parameters

apikey
string
default:"YourApiKeyToken"
Your Etherscan API key.
chainid
string
default:"1"
Chain ID you query, eg 1 for Ethereum, 8453 for Base from our supported chains.
module
string
default:"block"
Set to block for this endpoint.
action
string
default:"getblocknobytime"
Set to getblocknobytime for this endpoint.
timestamp
integer
default:"1578638524"
Unix timestamp in seconds.
closest
string
default:"before"
Closest available block to the provided timestamp, either before or after.
curl "https://api.etherscan.io/v2/api?chainid=1&module=block&action=getblocknobytime&timestamp=1578638524&closest=before&apikey=YourApiKeyToken"
{
  "status": "1",
  "message": "OK",
  "result": "9251482"
}
I