# Block By Timestamp

> Block By Timestamp is a paid API for AI agents from www.x402financialdata.com, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-13).

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.

## Facts

- Endpoint: GET https://www.x402financialdata.com/block-by-timestamp
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/block-by-timestamp-f4fbf78d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_IRSvFDuYLca_XfQP-r3gU

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability block-by-timestamp-f4fbf78d
```

Example prompt: What's the Ethereum block number closest to midnight UTC on March 15, 2023 — give me the block just before that timestamp.

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

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.

## Output

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.

## Request schema (JSON Schema)

```json
{
 "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"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/block-by-timestamp-f4fbf78d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from www.x402financialdata.com](https://www.zero.xyz/host/www.x402financialdata.com/llms.txt)
