# getTransaction

Returns transaction details for a confirmed transaction

#### Parameters required for this RPC call

* The **pubkey** of account delegate to query, as base-58 encoded string.
* A JSON object with one of the following fields:
  * **mint**: Pubkey of the specific token Mint to limit accounts to, as base-58 encoded string; or
  * **programId**: Pubkey of the Token program that owns the accounts, as base-58 encoded string
* **configuration** : This contains the following parameters, all are optional fields.
  * **commitment**: The commitment describes how finalized a block is at that point in time. Commitment levels <mark style="color:yellow;">processed</mark>, <mark style="color:yellow;">confirmed</mark> and <mark style="color:yellow;">finalized</mark> are supported, defaults to <mark style="color:yellow;">finalized</mark>.
  * **dataSlice**: Request a slice of the account's data.
    * `length: <usize>` - number of bytes to return
    * `offset: <usize>` - byte offset from which to start reading
  * **maxSupportedTransactionVersion**: Currently, the only valid value for this parameter is `0`. Setting it to `0` allows you to fetch all transactions, including both Versioned and legacy transactions.
  * **encoding**: Encoding format for each returned transaction. The supported options are *json*, *jsonParsed*, <mark style="color:yellow;">base58</mark> and <mark style="color:yellow;">base64</mark>. You can know more about [Parsed responses](https://solana.com/docs/rpc#parsed-responses) more on Solana docs.

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

<pre class="language-bash"><code class="lang-bash">curl https://rpc.shyft.to?api_key=YOUR-API-KEY -s -X \
<strong>  POST -H "Content-Type: application/json" -d ' 
</strong>   {
     "jsonrpc": "2.0",
     "id": 1,
     "method": "getTransaction",
     "params": [
       "5Pj5fCupXLUePYn18JkY8SrRaWFiUctuDTRwvUy2ML9yvkENLb1QMYbcBGcBXRrSVDjp7RjUwk9a3rLC6gpvtYpZ",
       {
         "commitment": "confirmed",
         "maxSupportedTransactionVersion": 0,
         "encoding": "json"
       }
     ]
   }
 '
</code></pre>

{% endtab %}

{% tab title="Web3.js" %}

```javascript
import { Connection, PublicKey, clusterApiUrl, type GetVersionedTransactionConfig, } from "@solana/web3.js";

const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed");

let signature =
  "5zSQuTcWsPy2cVAshBXWuJJXLwMD1GbgMpz3iq4xgwiV1s6mxYRbYb7qBiRGZd1xvDcYhQQRBKoNcnW8eKtcyZWg";

let config: GetVersionedTransactionConfig = {
  commitment: "finalized",
  maxSupportedTransactionVersion: 0,
};

let transaction = await connection.getTransaction(signature, config);

console.log(transaction);
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "jsonrpc": "2.0",
  "result": {
    "blockTime": 1746479684,
    "meta": {
      "computeUnitsConsumed": 150,
      "err": null,
      "fee": 5000,
      "innerInstructions": [],
      "loadedAddresses": {
        "readonly": [],
        "writable": []
      },
      "logMessages": [
        "Program 11111111111111111111111111111111 invoke [1]",
        "Program 11111111111111111111111111111111 success"
      ],
      "postBalances": [
        989995000,
        10000000,
        1
      ],
      "postTokenBalances": [],
      "preBalances": [
        1000000000,
        0,
        1
      ],
      "preTokenBalances": [],
      "rewards": [],
      "status": {
        "Ok": null
      }
    },
    "slot": 378917547,
    "transaction": {
      "message": {
        "accountKeys": [
          "7BvfixZx7Rwywf6EJFgRW6acEQ2FLSFJr4n3kLLVeEes",
          "6KtbxYovphtE3eHjPjr2sWwDfgaDwtAn2FcojDyzZWT6",
          "11111111111111111111111111111111"
        ],
        "header": {
          "numReadonlySignedAccounts": 0,
          "numReadonlyUnsignedAccounts": 1,
          "numRequiredSignatures": 1
        },
        "instructions": [
          {
            "accounts": [
              0,
              1
            ],
            "data": "3Bxs4NN8M2Yn4TLb",
            "programIdIndex": 2,
            "stackHeight": null
          }
        ],
        "recentBlockhash": "23dwTHxFhSzqohXhdni5LwpuSRpgN36YvVMCAM2VXQSf"
      },
      "signatures": [
        "5Pj5fCupXLUePYn18JkY8SrRaWFiUctuDTRwvUy2ML9yvkENLb1QMYbcBGcBXRrSVDjp7RjUwk9a3rLC6gpvtYpZ"
      ]
    },
    "version": "legacy"
  },
  "id": 1
}
```

{% endtab %}
{% endtabs %}
