# /v1/blocks/by\_version/{version} - Aptos

This endpoint gets a transaction by its ledger version number from Aptos blockchain.

## Supported Network

* Mainnet

## Parameter

| **Parameter**      | **Data type** | **Description**                         | **Required** | **In** |
| ------------------ | ------------- | --------------------------------------- | ------------ | ------ |
| version            | integer       | The ledger version                      | Yes          | Path   |
| with\_transactions | boolean       | To contain transactions' details or not | no           | Query  |

## Request

**Base URL**

```bash
https://go.getblock.io/<ACCESS_TOKEN>
```

**Example(cURL)**

```curl
curl --location 'https://go.getblock.io/<ACCESS_TOKEN>/v1/transactions/by_version/3556737308?with_transactions=false'
```

## Response Example

```json
{
    "block_height": "456015808",
    "block_hash": "0xdbe2cbd48ec3b897fa5f6b1ff51bd8eef280e300e12b6ff153b3959a7440a268",
    "block_timestamp": "1760341227055115",
    "first_version": "3556737303",
    "last_version": "3556737309",
    "transactions": null
}

```

## Response Parameter Definition

| Field                                        | Type    | Description                                                                       |
| -------------------------------------------- | ------- | --------------------------------------------------------------------------------- |
| **block\_height**                            | string  | Height of the block in the blockchain.                                            |
| **block\_hash**                              | string  | Unique hash identifying the block.                                                |
| **block\_timestamp**                         | string  | Timestamp (in microseconds) when the block was created.                           |
| **first\_version**                           | string  | First transaction version included in this block.                                 |
| **last\_version**                            | string  | Last transaction version included in this block.                                  |
| **transactions**                             | objects | List of transactions contained in this block.                                     |
| **transactions.type**                        | string  | Type of the transaction (e.g., `user_transaction`, `block_metadata_transaction`). |
| **transactions.hash**                        | string  | Unique hash identifying the transaction.                                          |
| **transactions.sender**                      | string  | Account address that initiated the transaction.                                   |
| **transactions.sequence\_number**            | string  | The sender’s sequence number for this transaction.                                |
| **transactions.max\_gas\_amount**            | string  | Maximum gas units the sender is willing to spend.                                 |
| **transactions.gas\_unit\_price**            | string  | Gas price per unit.                                                               |
| **transactions.expiration\_timestamp\_secs** | string  | Expiration timestamp (in seconds) after which the transaction becomes invalid.    |
| **transactions.payload**                     | object  | Payload object describing the action being executed.                              |
| **transactions.payload.type**                | string  | Type of payload (e.g., `entry_function_payload`).                                 |
| **transactions.payload.function**            | string  | Function name being called (e.g., `0x1::coin::transfer`).                         |
| **transactions.payload.type\_arguments**     | array   | Type arguments for the function (e.g., token types).                              |
| **transactions.payload.arguments**           | array   | Arguments passed to the function (e.g., recipient address, amount).               |
| **transactions.signature**                   | object  | Signature object verifying the transaction.                                       |
| **transactions.signature.type**              | string  | Type of cryptographic signature (e.g., `ed25519_signature`).                      |
| **transactions.signature.public\_key**       | string  | Public key of the sender.                                                         |
| **transactions.signature.signature**         | string  | Cryptographic signature validating the transaction.                               |

## Use cases

This method is used for:

* Retrieve details of a specific transaction by its version.
* Debug **failed transactions** by checking vm\_status.
* Build **explorers** that let users search transactions by version.
* Track **system-level transactions** like block epilogues.

## Code Example

**Node(Axios)**

```js
const axios = require('axios');

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://go.getblock.io/<ACCESS_TOKEN>/v1/transactions/by_version/3363904007',
};

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

**Python(Request)**

```python
import requests

url = 'https://go.getblock.io/<ACCESS_TOKEN>/v1/transactions/by_version/3363904007'

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

## Error handling

| **Status Code** | **Error Message**              | **Cause**                                |
| --------------- | ------------------------------ | ---------------------------------------- |
| **403**         | forbidden                      | Missing or invalid \<ACCESS\_TOKEN>.     |
| **410**         | Ledger version has been pruned | Incorrect version number or being pruned |
| **500**         | Internal server error          | Node or network issue; retry later.      |

## Integration with Web3

By integrating `/v1/transactions/by_version/{version}`, developers can:

* **Trace exact transactions** for auditing or compliance.
* **Debug dApps** by fetching execution results and state changes.
* **Enable explorers** to link transactions with block details.\
  **Monitor validators/system txns** like block prologues and epilogues.
