# /v1/blocks/by_height/{block_height}

> Example code for the /v1/blocks/by_height/{block_height} json-rpc method. Сomplete guide on how to use /v1/blocks/by_height/{block_height} json-rpc in GetBlock.io Web3 documentation.

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

## Supported Networks

* Mainnet

## Parameter

| **Parameter** | **Type** | **In** | **Required** | **Description** |
| --- | --- | --- | --- | --- |
| `block_height` | Integer | Path | Yes | Height (number) of the block to fetch. |
| `with_transactions` | Boolean | Query | No | If true, returns full transactions inside the block. Default: false. |

## Request

**Base URL**

```bash
https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>
```

**Example(cURL)**

```curl
curl --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

| **Field** | **Description** |
| --- | --- |
| block_height | The height of the block |
| block_hash | The hash of the block at the specified height |
| block_timestamp | The time at which the block was created/added to the chain |
| first_version | The version number of the first transaction in the block |
| last_version | The version number of the last transaction in the block |
| transactions | An array containing the details of the transactions included in the block |
| type (transaction) | The type of the change |
| hash | The hash of the transaction |
| sender | The account from which the transaction was sent |
| sequence_number | The sequence of a transaction sent by the specific sender |
| max_gas_amount | The maximum amount of gas allocated for the execution of a transaction |
| gas_unit_price | The cost per unit of gas (determines the transaction fee) |
| expiration_timestamp_secs | The timestamp until which the transaction can be included in a block |
| payload | The data carried by a transaction |
| type (payload) | The type of payload indicates the purpose of the data contained |
| function | The function associated with the payload |
| type_arguments | An array specifying the types of arguments provided to the function |
| arguments | An array containing the actual arguments passed to the function |
| signature | An array with signature details |
| type (signature) | The type of signature used to verify authenticity |
| public_key | The 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)**

```python
import 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)**

```js
import 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 Code** | **Error Message** | **Cause** |
| --- | --- | --- |
| **403** | Forbidden | Invalid or missing ACCESS_TOKEN. |
| **410** | Block has been pruned | No block exists for the specified height or pruned. |
| **500** | Internal server error | Node 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.
