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
Name | Type | Required | Description |
---|---|---|---|
block_height | string | Yes | Block height |
Query Parameters
Name | Type | Required | Description |
---|---|---|---|
with_transactions | boolean | No | Include 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?;