# avax.getAtomicTx

Gets a transaction by its ID. Optional encoding parameter to specify the format for the returned transaction. Can only be `hex` when a value is provided.

This method will use `10` [Compute Units](https://docs.validationcloud.io/v1/about/billing).

***

## Reference: [Here](https://docs.avax.network/reference/avalanchego/c-chain/api#avaxgetatomictx)

## **Parameters**

* `txID` - string - The transaction ID in hex format.
* `encoding` - string - (optional) The encoding format to use. Can only be hex when a value is provided.

## Returns

* `tx` - string - The transaction encoded to encoding.
* `encoding` - string - The encoding format.
* `blockHeight` - string - The height of the block which the transaction was included in.

```json
// Result
{
  "jsonrpc": "2.0",
  "result": {
    "tx": "0x000000000000000030399d0775f450604bd2fbc49ce0c5c1c6dfeb2dc2acb8c92c26eeae6e6df4502b19d891ad56056d9c01f18f43f58b5c784ad07a4a49cf3d1f11623804b5cba2c6bf000000018212d6807a0ec9c1b26321418fe7a548180b5be728ce53fe7e98ab5755ed316100000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db00000005000003a352a382400000000100000000000000018db97c7cece249c2b98bdc0226cc4c2a57bf52fc000003a3529edd17dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db000000010000000900000001ead19377f015422fbb8731204fcf6d6879dd05146c2d5b5594e2fea2cb420b2f40bd457b71e279e547790b28fe5482f278c76cf39b2dce5c2e6c53352fe6827d002cc7d20d",
    "encoding": "hex",
    "blockHeight": "1"
  },
  "id": 1
}
```

{% tabs %}
{% tab title="mainnet" %}

```bash
curl https://mainnet.avalanche.validationcloud.io/v1/<YOUR_API_KEY_HERE>/ext/bc/C/avax \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"avax.getAtomicTx",
    "params" :{
        "txID":"2GD5SRYJQr2kw5jE73trBFiAgVQyrCaeg223TaTyJFYXf2kPty",
        "encoding": "hex"
    }
}'

```

{% endtab %}

{% tab title="testnet" %}

```bash
curl https://fuji.avalanche.validationcloud.io/v1/<YOUR_API_KEY_HERE>/ext/bc/C/avax \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"avax.getAtomicTx",
    "params" :{
        "txID":"2GD5SRYJQr2kw5jE73trBFiAgVQyrCaeg223TaTyJFYXf2kPty",
        "encoding": "hex"
    }
}'
```

{% endtab %}
{% endtabs %}
