# /v1/blocks/by\_height/{block\_height} - Aptos

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://go.getblock.io/<ACCESS_TOKEN>
```

**Example(cURL)**

```curl
curl --location 'https://go.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://go.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://go.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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getblock.io/api-reference/aptos-apt/apt_v1_blocks_by_height_block_height.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
