Get blocks by height

This endpoint allows you to get the transactions in a block and the corresponding block information.

Transactions are limited by max default transactions size. If not all transactions are present, the user will need to query for the rest of the transactions via the get transactions API.

If the block is pruned, it will return a 410.

Path Parameters:

block_height integer required

Block height to lookup. Starts at 0

Query Parameters:

with_transactions boolean

If set to true, include all transactions in the block. If not provided, no transactions will be retrieved

Response Header:

X-APTOS-BLOCK-HEIGHT integer

Current block height of the chain

X-APTOS-CHAIN-ID integer

Chain ID of the current chain

X-APTOS-EPOCH integer

Current epoch of the chain

X-APTOS-LEDGER-OLDEST-VERSION integer

Oldest non-pruned ledger version of the chain

X-APTOS-LEDGER-TIMESTAMPUSEC integer

Current timestamp of the chain

X-APTOS-LEDGER-VERSION integer

Current ledger version of the chain

X-APTOS-OLDEST-BLOCK-HEIGHT integer

Oldest non-pruned block height of the chain

Response Body:

A Block with or without transactions

block_height string<uint64>

A string containing a 64-bit unsigned integer.

block_hash string

block_timestamp string<uint64>

A string containing a 64-bit unsigned integer.

first_version string<uint64>

A string containing a 64-bit unsigned integer.

last_version string<uint64>

A string containing a 64-bit unsigned integer.

transactions array

Example:

// Request
curl -X GET -H 'Content-Type: application/json' https://aptos.blockpi.network/aptos/v1/your_api_key/v1/blocks/by_height/3617300?with_transactions=true

// Result
{
    "block_height": "3617300",
    "block_hash": "0x476a4ef5f0860e246cc11be465a2af1abac579feecaa9b6577d89b86a087bf8c",
    "block_timestamp": "1666770485746778",
    "first_version": "13287613",
    "last_version": "13287614",
    "transactions": [<array of transactions>]
}

Last updated