# Which block was the chain's at a given time

[Open the latest blocks in TraceFast →](https://tracefast.xyz/blocks)

The last block whose time is at or before a Unix time, and the first block after it — the bracket around the moment. Block times rise strictly with the number, so the answer is exact. `final: false` means the time is after the newest block: a later block may still land at or before it, so ask again later; `nextBlock` is then absent. If blocks around the time are temporarily unavailable, the method answers `422 coverage_gap` rather than a pair across the gap. Pass a block's number to the block methods for its contents.

```
GET https://tracefast.xyz/api/v1/chains/1/blocks/at-time
```

| Parameter | In | Type | Notes |
|---|---|---|---|
| `timestamp` | query | integer | Unix time, seconds. Required. |

**Access** — an [API key](/api/authentication) on the **Enriched Data** plan or higher ([plans](/api/authentication#plans)), or no key at all: pay per call with [x402](/api/x402) at the same path on `https://mpp.tracefast.xyz/api/v1`, at the price its `402` states. As a tool for AI agents: `get_block_at_time` on the [MCP server](/api/mcp-server). **Stable** — see [stability](/api/conventions#stability).

`chains/1` is a literal: other chain ids answer `404 chain_not_supported`. An unknown query parameter is refused rather than ignored.

## Response

`200 application/json`. Lists in the example are cut to two entries.

```json
{
  "data": {
    "chainId": 1,
    "timestamp": 1767225600,
    "block": {
      "number": 24136052,
      "timestamp": 1767225599
    },
    "nextBlock": {
      "number": 24136053,
      "timestamp": 1767225611
    },
    "final": true
  },
  "meta": {
    "chain": "ethereum",
    "timestamp": 1794918315745,
    "cached": false,
    "asOfBlock": 24136052,
    "docs": "https://docs.tracefast.xyz/api/block-at-time"
  }
}
```

### `data`

| Field | Meaning |
|---|---|
| `block` | The last block whose time is at or before `timestamp`. |
| `chainId` | Chain id. `1` is Ethereum mainnet. |
| `final` | `true` once a block after `timestamp` exists: no later block can land at or before it. |
| `nextBlock` | The first block after `timestamp`. Absent while no such block exists yet. |
| `timestamp` | The time asked about, Unix seconds. |

### `data.block`

| Field | Meaning |
|---|---|
| `number` | Block height. |
| `timestamp` | Unix seconds. |

### `data.nextBlock`

The same fields as `data.block`.

`meta` is the same envelope on every method — see [conventions](/api/conventions#meta).

## Errors

| Status | When |
|---|---|
| 400 | `bad_request`: `timestamp` missing or not a non-negative integer (`reason: timestamp_invalid`), or an unknown query parameter |
| 404 | `chain_not_supported`, or an unknown path |
| 422 | `block_not_available` (`reason: coverage_gap`): blocks around the time are temporarily unavailable; retry later |

Malformed input, unknown parameters and the key check's `401`/`403`/`429`/`503` are the same for every method — see [conventions](/api/conventions#errors) and [API keys](/api/authentication#when-a-key-is-refused).

## Related pages

* [Latest block](/api/block-latest)
* [One block](/api/block)
* [Block transactions](/api/block-transactions)
* [Block withdrawals](/api/block-withdrawals)
* [All API methods](/api/methods) — every method on one page
* [Conventions](/api/conventions) — requests, responses, errors and pagination
