/v1/blocks/by_height/{block_height}

This endpoint gets a specific block's information from the Aptos blockchain network, given its height.

Supported Networks

  • Mainnet

Parameter

ParameterTypeInRequiredDescription
block_heightIntegerPathYesHeight (number) of the block to fetch.
with_transactionsBooleanQueryNoIf true, returns full transactions inside the block. Default: false.

Request

Base URL

bashhttps://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>

Example(cURL)

curlcurl --location 'https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/v1/blocks/by_height/425737645?with_transactions=false'

Response Example

json
{
    "block_height": "445814139",
    "block_hash": "0x0ac6b36f89b6a3fc9b7c2cabcb1f29cc624e609ed0978dd2a757b048196cb3bc",
    "block_timestamp": "1759349325550593",
    "first_version": "3492983944",
    "last_version": "3492983948",
    "transactions": null
}

Response Parameter Definition

FieldDescription
block_heightThe height of the block
block_hashThe hash of the block at the specified height
block_timestampThe time at which the block was created/added to the chain
first_versionThe version number of the first transaction in the block
last_versionThe version number of the last transaction in the block
transactionsAn array containing the details of the transactions included in the block
type (transaction)The type of the change
hashThe hash of the transaction
senderThe account from which the transaction was sent
sequence_numberThe sequence of a transaction sent by the specific sender
max_gas_amountThe maximum amount of gas allocated for the execution of a transaction
gas_unit_priceThe cost per unit of gas (determines the transaction fee)
expiration_timestamp_secsThe timestamp until which the transaction can be included in a block
payloadThe data carried by a transaction
type (payload)The type of payload indicates the purpose of the data contained
functionThe function associated with the payload
type_argumentsAn array specifying the types of arguments provided to the function
argumentsAn array containing the actual arguments passed to the function
signatureAn array with signature details
type (signature)The type of signature used to verify authenticity
public_keyThe public key of the account that generated the signature
signature (value)The actual signature generated with the private key

Use Cases

This method can be used for:

  • Get a specific block by its height.
  • Explore transactions inside a given block.
  • Build block explorers or monitoring dashboards.

Code Example

Python(Request)

pythonimport requests

url = "https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/v1/blocks/by_height/425737645?with_transactions=false"
response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Node(Axios)

jsimport axios from ‘axios’

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: "https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/v1/blocks/by_height/425737645?with_transactions=false"
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

Error Handling

Status CodeError MessageCause
403ForbiddenInvalid or missing ACCESS_TOKEN.
410Block has been prunedNo block exists for the specified height or pruned.
500Internal server errorNode or network issue; retry later.

Integration with Web3

By integrating /v1/blocks/by_height/{block_height}, developers can:

  • Synchronise chain data by fetching blocks sequentially.
  • Monitor on-chain activity at the block level.
  • Enable dApps to verify inclusion of transactions at a given height.