---
title: "Block at Timestamp"
method: GET
path: "/timestamps/{timestamp}/block"
---

# Block at Timestamp

`GET /timestamps/{timestamp}/block`

## Request

- Base URL: `https://portal.sqd.dev/datasets/bitcoin-mainnet`
- URL: `https://portal.sqd.dev/datasets/bitcoin-mainnet/timestamps/{timestamp}/block`
- Auth: none required
- TypeScript: <https://skmtc.dev/sqd/apis/sqd-portal-api-bitcoin-dataset-endpoints/docs/timestamps/:timestamp/block/get.ts> (a function with typed inputs; its response is checked against the schema)

Resolves a Unix timestamp (in seconds) to a block number. Returns the first block whose timestamp is greater than or equal to `timestamp`. Resolution prefers archival data and falls back to the real-time source when available; the `x-sqd-data-source` response header reports which source served the result (`network` or `real_time`).

## Path parameters

- `timestamp` integer, required

## Response `200`

Block number resolved.

- BlockNumberResponse
  - `block_number` integer, required: Number of the first block whose timestamp is greater than or equal to the requested timestamp.

## Other responses

- `404`: No block found at or after the given timestamp.
- `500`: Internal server error. Do not retry.
- `503`: Upstream data source temporarily unavailable. Retry later.

---

[API](https://skmtc.dev/sqd/apis/sqd-portal-api-bitcoin-dataset-endpoints.md) - [All operations](https://skmtc.dev/sqd/apis/sqd-portal-api-bitcoin-dataset-endpoints/llms.txt) - [OpenAPI document](https://skmtc.dev/sqd/apis/sqd-portal-api-bitcoin-dataset-endpoints/revisions/cf9d60e495b1?raw)
