Skip to main content
The Token Trade by Transaction endpoint lets you retrieve a specific trade using a transaction hash. This is helpful when you already have a tx hash and want the trade details without knowing the pool or token address, across chains like Solana, Ethereum, BNB Chain, Base, and more. The endpoint returns the first trade found in that transaction.

What this endpoint does

With this API, you can:
  • Retrieve a single trade by transaction hash on a specific blockchain
  • Return detailed swap information like amounts, USD value, execution prices, and fees
  • Include market context such as marketAddress and marketAddresses for multi-hop swaps
  • Include swapRecipient when available, which helps with accurate attribution in Account Abstraction flows
  • If a transaction contains multiple swaps, only the most recent one is returned

What you’ll need

  • Basic knowledge of REST APIs
  • A transaction hash
  • A Mobula API key
Note: All Mobula endpoints require an API key.
Get a free API key: Here
Optional:
  • DexScreener (to find transactions to test)

When to use Token Trade by Transaction

Use this endpoint when you want to:
  • Fetch the exact details of a trade when you only have a transaction hash
  • Monitor or audit specific trades after detecting an on-chain transaction
  • Show trade details when a user clicks a transaction inside a wallet activity view
  • Retrieve execution prices and fee breakdown for one specific swap
  • Handle Account Abstraction flows using swapRecipient when transactionSenderAddress is not the actual user
If you want the full normalized activity feed for a wallet, use: Wallet Activity If you want all swaps/trades for a wallet over time, use: Wallet Trades If you want pool-level context (price, liquidity, volume) for the market a trade happened on, use: Market Details

Walkthrough to Get Token Trade by Transaction

1. Prepare your query

The Token Trade by Transaction endpoint requires two parameters:
ParameterDescription
blockchainBlockchain identifier (example: base, ethereum, bsc, solana)
transactionHashTransaction hash of the trade
Tip: Make sure you select the correct chain, such as Base or Ethereum.

2. Find a transaction hash to test with DexScreener

To get a real transaction hash:
  • Open DexScreener
  • Pick a token
  • Open its pair page
  • Click Trades (or Recent Trades)
  • Click a trade entry to open the explorer
  • Copy the transaction hash
This hash is used as the transactionHash parameter.

3. Fill the API form

Enter the blockchain and paste the transaction hash into transactionHash, then click Send.

Reviewing the response

The response contains a single trade object, including:
  • id: Unique swap identifier
  • operation: Swap operation type like regular, deposit, or withdrawal
  • type: Trade type like buy, sell, deposit, or withdrawal
  • baseTokenAmount / quoteTokenAmount: Token amounts traded in formatted units
  • baseTokenAmountUSD / quoteTokenAmountUSD: USD value for each side of the trade
  • date: Trade timestamp in milliseconds
  • transactionHash: The transaction hash you queried
  • marketAddress: Main pool or market address where the trade occurred
  • marketAddresses: All market addresses involved for multi-hop swaps
  • swapSenderAddress: Address that executed the swap
  • transactionSenderAddress: Transaction originator address
  • swapRecipient: Wallet that receives the output tokens, useful for accurate attribution in AA flows
  • baseTokenPriceUSD / quoteTokenPriceUSD: Execution prices in USD at the time of the trade
  • labels: Wallet labels when available
  • walletMetadata: Enriched wallet metadata when available
  • platform: Trading platform or aggregator object when available
  • totalFeesUSD: Total fees paid in USD
  • gasFeesUSD / platformFeesUSD / mevFeesUSD: Fee breakdown fields

Try It Live with Mobula Token Trade by Transaction Demo (UI)

You can also test this endpoint using our demo UI: Demo UI Homepage Token Trade by Transaction Demo UI Docs

Summary

The Token Trade by Transaction endpoint helps you:
  • Retrieve a specific trade by blockchain and transaction hash
  • Get full swap context including amounts, USD values, execution prices, and fees
  • Use swapRecipient when available for accurate user attribution in Account Abstraction flows
  • Visualize the trade details instantly in the demo UI

Try Mobula for Free

Try our free API today and start building in minutes.
Get your free API key: Here