# /v1/transactions/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   |

## 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/3363904007'
```

## Response Example

```json
{
    "version": "3363904007",
    "hash": "0xd797b944ed8657406a1b09a5928048093399fc0a2f576d3e57c0f9cedbf95c4a",
    "state_change_hash": "0xafb6e14fe47d850fd0a7395bcfb997ffacf4715e0f895cc162c218e4a7564bc6",
    "event_root_hash": "0x414343554d554c41544f525f504c414345484f4c4445525f4841534800000000",
    "state_checkpoint_hash": "0xbf257d934f991d1e7d74079cc9060d3ac005aaa208d93a1fd4928dfc224bba53",
    "gas_used": "0",
    "success": true,
    "vm_status": "Executed successfully",
    "accumulator_root_hash": "0xc985314d5c118899c649b772c237178c63f328e7d286aceea01a30373d491d95",
    "changes": [],
    "timestamp": "1757261767411156",
    "block_end_info": {
        "block_gas_limit_reached": false,
        "block_output_limit_reached": false,
        "block_effective_block_gas_units": 500,
        "block_approx_output_size": 21541
    },
    "type": "block_epilogue_transaction"
}

```

## Response Parameter Definition

| **Field**                                            | **Type** | **Description**                                                           |
| ---------------------------------------------------- | -------- | ------------------------------------------------------------------------- |
| version                                              | String   | Global transaction version number.                                        |
| hash                                                 | String   | Hash of the transaction.                                                  |
| state\_change\_hash                                  | String   | Hash of all state changes from this txn.                                  |
| event\_root\_hash                                    | String   | Merkle root hash of all events.                                           |
| state\_checkpoint\_hash                              | String   | Hash of the state checkpoint.                                             |
| gas\_used                                            | String   | Amount of gas consumed.                                                   |
| success                                              | Boolean  | Whether transaction executed successfully.                                |
| vm\_status                                           | String   | Result status from Aptos VM.                                              |
| accumulator\_root\_hash                              | String   | Global accumulator root hash.                                             |
| changes                                              | Array    | State changes applied (empty for system txns).                            |
| timestamp                                            | String   | Unix timestamp in microseconds.                                           |
| block\_end\_info                                     | Object   | Metadata about block execution.                                           |
| block\_end\_info.block\_gas\_limit\_reached          | Booleab  | Block’s gas limit was reached.                                            |
| block\_end\_info.block\_output\_limit\_reached       | Boolean  | Block’s output size limit was hit.                                        |
| block\_end\_info.block\_effective\_block\_gas\_units | Integer  | Effective gas used in this block.                                         |
| block\_end\_info.block\_approx\_output\_size         | Interger | Approximate output size of block in bytes.                                |
| type                                                 | String   | Transaction type (e.g., user\_transaction, block\_epilogue\_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/3541136893',
};

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/3541136893"

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.
