Skip to main content
GET
/
legacy
/
block
/
get-block-number-by-time
Get block number by time stamp
curl --request GET \
  --url http://localhost/api/legacy/block/get-block-number-by-time
{
  "message": "<string>",
  "result": {
    "blockNumber": "<string>"
  },
  "status": "0"
}

Documentation Index

Fetch the complete documentation index at: https://docs.blockscout.com/llms.txt

Use this file to discover all available pages before exploring further.

Query Parameters

timestamp
string

Unix timestamp in seconds.

Pattern: ^-?([1-9][0-9]*|0)$
closest
enum<string>

Whether to return the block before or after the timestamp.

Available options:
before,
after
apikey
string

API key for rate limiting or for sensitive endpoints

key
string

Secret key for getting access to restricted resources

Response

200 - application/json

Block number

message
string
required

Human-readable status string — OK on success, a descriptive error message otherwise.

result
GetBlockNumberByTimeResult · object
required

Endpoint-specific payload on success; null on error.

status
enum<string>
required

1 = OK, 0 = error, 2 = pending.

Available options:
0,
1,
2