# getTransaction

> Returns full details for a single confirmed transaction by signature.

Source: https://docs.constant-k.com/rpc/http/gettransaction/

`getTransaction` looks up one transaction by signature and returns everything recorded about it: the compiled message, account keys, before/after balances, log messages, compute units consumed, and any error.

Mainnet carries three transaction formats — legacy, version 0 (Address Lookup Tables) and version 1 — decoded together by `maxSupportedTransactionVersion: 1`; omitting it fails on anything newer than legacy. See [Transaction v1](/rpc/transaction-v1/).

- Transport: HTTP, JSON-RPC 2.0 `POST` to `https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY` (New York) or `https://rpc-frankfurt.constant-k.com/?api-key=YOUR_API_KEY` (Frankfurt) or `https://rpc-amsterdam.constant-k.com/?api-key=YOUR_API_KEY` (Amsterdam). The key also works as an `x-api-key` header.
- Category: Transactions
- Availability: All plans
- Rate limits: Free 2/s · Operator 5/s · Blade Runner 50/s · Nexus 100/s

## Parameters

`params` is a positional JSON array, in this order:

- `signature` (string, required): Transaction signature to look up, as a base-58 encoded string.
- `config` (object, optional): Optional configuration.
  - `commitment` (string, optional, one of `confirmed`, `finalized`, default `"finalized"`): Bank state to read the transaction from. `processed` is not accepted here.
  - `encoding` (string, optional, one of `json`, `jsonParsed`, `base58`, `base64`, default `"json"`): Encoding for the `transaction` field. `jsonParsed` decodes known program instructions into structured objects; unrecognized programs fall back to raw account/data form even when `jsonParsed` is requested.
  - `maxSupportedTransactionVersion` (integer, optional, min 0, max 1): Highest transaction version the caller can decode, as a ceiling rather than a filter: `1` returns legacy, version 0 and version 1 transactions alike. The value must be the JSON integer `1`, not the string `"1"` (`-32602`); omitting it returns legacy only and fails with `-32015` on a versioned signature. Raising it before the client can decode the format just moves the failure elsewhere.

## Result

- `result` (object | null, optional): The transaction record, or null if the signature isn't known to this node at the requested commitment.
  - `option 1` (object, optional)
    - `slot` (integer, optional): Slot this transaction was processed in.
    - `blockTime` (integer | null, optional): Estimated production time of the containing block, as Unix seconds.
    - `transactionIndex` (integer | null, optional): Index of this transaction within its block.
    - `version` (any, optional): `"legacy"`, or the integer version number `0` or `1`.
    - `transaction` (object, optional)
      - `signatures` (string[], optional): All signatures on the transaction, fee payer's first.
      - `message` (object, optional)
        - `accountKeys` (array, optional): Every account the transaction reads or writes, including ones resolved via address lookup tables.
        - `addressTableLookups` (array, optional): Address Lookup Table references used to extend the account list. Version 0 only: legacy and version 1 transactions cannot use lookup tables, so the field is absent.
        - `instructions` (array, optional): Top-level instructions, in execution order.
        - `recentBlockhash` (string, optional)
        - `transactionConfig` (object, optional): Present on version 1 transactions only: the fee and resource requests encoded in the message itself, in place of ComputeBudget instructions. Every field is present; `null` means the sender left it unset. See [Transaction v1](/rpc/transaction-v1/).
          - `priorityFee` (integer | null, optional): Priority fee for the whole transaction, as a **total in lamports** — not micro-lamports per compute unit, and not a price. `null` means no priority fee was requested (treated as 0).
          - `computeUnitLimit` (integer | null, optional): Requested compute unit limit, in compute units. `null` means unset, which is treated as 0 — not as the legacy per-instruction default.
          - `loadedAccountsDataSizeLimit` (integer | null, optional): Requested cap on loaded account data, in bytes. `null` means unset, which is treated as 0 — not as the 64 MiB default a legacy or version 0 transaction gets.
          - `heapSize` (integer | null, optional): Requested heap size, in bytes: a multiple of 1 KiB between 32 KiB and 256 KiB. `null` means unset, which is the 32 KiB minimum.
    - `meta` (object, optional)
      - `err` (object | null, optional): Null on success; a `TransactionError` variant object on failure.
      - `fee` (integer, optional): Total fee charged, in lamports.
      - `computeUnitsConsumed` (integer, optional): Compute units actually consumed while executing the transaction.
      - `costUnits` (integer, optional): What this transaction charged against the block's cost limits, usually larger than `computeUnitsConsumed` since the cost model adds signatures, write locks, size and loaded account data on top of execution. It measures block space, while `computeUnitsConsumed` measures the compute budget; absent when the node recorded no cost figure.
      - `preBalances` (integer[], optional): Lamport balance of every account in `accountKeys`, before the transaction.
      - `postBalances` (integer[], optional): Lamport balance of every account in `accountKeys`, after the transaction.
      - `preTokenBalances` (array, optional): Token balances for any SPL token accounts referenced, before the transaction.
      - `postTokenBalances` (array, optional): Token balances for any SPL token accounts referenced, after the transaction.
      - `logMessages` (string[], optional): Program log output, in emission order.
      - `innerInstructions` (array, optional): Instructions invoked via cross-program invocation (CPI), grouped by the top-level instruction index that triggered them.
      - `rewards` (array, optional): Any rewards paid out as a side effect of this transaction (rare outside vote/stake-related transactions).
      - `loadedAddresses` (object, optional): Writable/readonly account addresses resolved via address lookup tables. Version 0 only: legacy and version 1 transactions carry their whole account list in the message.
  - `option 2` (null, optional)

## Example: Get a versioned transaction with jsonParsed encoding

Request:

```bash
curl "https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getTransaction",
    "params": [
      "2E1brC5xSGXm9e3aA9pcdAZ2fNSVyCtEgo4QKN8LB6Pp7XCBda1toUgDuJJvbwNkvX665msewKafkj7BRdoQ4sFh",
      { "encoding": "jsonParsed", "maxSupportedTransactionVersion": 1 }
    ]
  }'
```

Response:

```json
{
  "jsonrpc": "2.0",
  "result": {
    "slot": 447947032,
    "blockTime": 1789696264,
    "transactionIndex": 2178,
    "version": 0,
    "transaction": {
      "signatures": [
        "2E1brC5xSGXm9e3aA9pcdAZ2fNSVyCtEgo4QKN8LB6Pp7XCBda1toUgDuJJvbwNkvX665msewKafkj7BRdoQ4sFh"
      ],
      "message": {
        "recentBlockhash": "382VZbVeSXnFDJ9e1No9sd1vjuSMuofPeVrHa7wMLgc1",
        "accountKeys": [
          {
            "pubkey": "HwfP9khbHJgWwnWB9Ai3DVCe8RWjCJUyYQETMnpxZ6YQ",
            "signer": true,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "7HaQUK6x3it2URoVJ579osqrVxY7UoFgVPz5TchcWLjh",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "2S6iGF1GHKaxjz9217efooYXYRbi2NamrxuNV2mTTmxT",
            "signer": false,
            "source": "transaction",
            "writable": true
          }
        ],
        "addressTableLookups": [
          {
            "accountKey": "Cnw7ZuW1diw9Xj5L5CYAKptMy92UzWCQ3r4t4qD65oAw",
            "readonlyIndexes": [
              5,
              13,
              2,
              3,
              4,
              9
            ],
            "writableIndexes": [
              14
            ]
          },
          {
            "accountKey": "HWT1M9xqXWthRWgWutuA5nLfd9V9iUdkJJXSZasfsYYh",
            "readonlyIndexes": [
              74,
              26,
              60,
              22,
              21,
              68
            ],
            "writableIndexes": [
              54,
              55,
              56,
              57,
              58,
              59
            ]
          }
        ],
        "instructions": [
          {
            "accounts": [],
            "data": "Jb2r1u",
            "programId": "ComputeBudget111111111111111111111111111111",
            "stackHeight": 1
          },
          {
            "parsed": {
              "info": {
                "destination": "7HaQUK6x3it2URoVJ579osqrVxY7UoFgVPz5TchcWLjh",
                "lamports": 2538,
                "source": "HwfP9khbHJgWwnWB9Ai3DVCe8RWjCJUyYQETMnpxZ6YQ"
              },
              "type": "transfer"
            },
            "program": "system",
            "programId": "11111111111111111111111111111111",
            "stackHeight": 1
          }
        ]
      }
    },
    "meta": {
      "err": null,
      "status": {
        "Ok": null
      },
      "fee": 5000,
      "computeUnitsConsumed": 22007,
      "costUnits": 37560,
      "preBalances": [
        26295308491,
        723849,
        1855569,
        2039280
      ],
      "postBalances": [
        26295300953,
        726387,
        1855569,
        2039280
      ],
      "preTokenBalances": [
        {
          "accountIndex": 2,
          "mint": "6C5ZkBvdsvwqTzRFYyVG4ojhQb4DRjtbFAG8TYKV1HHT",
          "owner": "HwfP9khbHJgWwnWB9Ai3DVCe8RWjCJUyYQETMnpxZ6YQ",
          "uiTokenAmount": {
            "amount": "38188",
            "decimals": 9,
            "uiAmount": 0.000038188,
            "uiAmountString": "0.000038188"
          }
        }
      ],
      "postTokenBalances": [
        {
          "accountIndex": 2,
          "mint": "6C5ZkBvdsvwqTzRFYyVG4ojhQb4DRjtbFAG8TYKV1HHT",
          "owner": "HwfP9khbHJgWwnWB9Ai3DVCe8RWjCJUyYQETMnpxZ6YQ",
          "uiTokenAmount": {
            "amount": "38188",
            "decimals": 9,
            "uiAmount": 0.000038188,
            "uiAmountString": "0.000038188"
          }
        }
      ],
      "logMessages": [
        "Program ComputeBudget111111111111111111111111111111 invoke [1]",
        "Program ComputeBudget111111111111111111111111111111 success",
        "Program 11111111111111111111111111111111 invoke [1]"
      ],
      "innerInstructions": [],
      "rewards": []
    }
  },
  "id": 1
}
```

_Long arrays in this example were trimmed._

## Notes

- The example is trimmed: the real transaction has 63 account keys (mostly resolved via 6 address lookup tables), 5 top-level instructions and 10 pre/post token balance entries, reflected by `truncated: true`.
- `maxSupportedTransactionVersion: 1`, unless there is a specific reason to omit it, covers both version 0 and version 1 transactions, a large share of mainnet traffic; without it, this call fails on either.
- The example is a version 0 transaction fetched with a ceiling of `1`. A version 1 transaction instead carries a `transactionConfig` object in `transaction.message` with no address lookup tables, so code that scans instructions for `ComputeBudget111111111111111111111111111111` to read a priority fee silently reports zero. See [Transaction v1](/rpc/transaction-v1/).
- `encoding: "base58"` works with `maxSupportedTransactionVersion: 1`, the same as the other encodings.
- constant-k keeps a rolling window of ledger history, not a full archive; a signature older than the retention window returns `null` even though it is valid. `minimumLedgerSlot` or `getFirstAvailableBlock`, compared against the transaction's slot, confirms whether it is in range.

