# /v1/transactions/by_version/{version} - Aptos

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

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://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>
```

**Example(cURL)**

```curl
curl --location 'https://shared.eu-central-1.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://shared.eu-central-1.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://shared.eu-central-1.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.
