⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

blocks_by_height

Overview

Fetch a block by its height. Includes transactions and block metadata.

Endpoint

GET /v1/blocks/by_height/{block_height}

Request

Path Parameters

NameTypeRequiredDescription
block_heightstringYesBlock height

Query Parameters

NameTypeRequiredDescription
with_transactionsbooleanNoInclude transactions in response

Code Examples

cURL

curl -s "https://api-aptos-mainnet.n.dwellir.com/YOUR_API_KEY/v1/blocks/by_height/1000000?with_transactions=true"

TypeScript

const b = await aptos.getBlockByHeight({ blockHeight: 1_000_000n, withTransactions: true });

Python

b = client.block_by_height(1000000, with_transactions=True)

Rust

let b = client.get_block_by_height(1_000_000, true).await?;