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
marketAddressandmarketAddressesfor multi-hop swaps - Include
swapRecipientwhen 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
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
swapRecipientwhentransactionSenderAddressis not the actual user
Walkthrough to Get Token Trade by Transaction
1. Prepare your query
The Token Trade by Transaction endpoint requires two parameters:| Parameter | Description |
|---|---|
blockchain | Blockchain identifier (example: base, ethereum, bsc, solana) |
transactionHash | Transaction hash of the trade |
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
transactionHash parameter.
3. Fill the API form
Enter the blockchain and paste the transaction hash intotransactionHash, then click Send.
Reviewing the response
The response contains a single trade object, including:id: Unique swap identifieroperation: Swap operation type likeregular,deposit, orwithdrawaltype: Trade type likebuy,sell,deposit, orwithdrawalbaseTokenAmount/quoteTokenAmount: Token amounts traded in formatted unitsbaseTokenAmountUSD/quoteTokenAmountUSD: USD value for each side of the tradedate: Trade timestamp in millisecondstransactionHash: The transaction hash you queriedmarketAddress: Main pool or market address where the trade occurredmarketAddresses: All market addresses involved for multi-hop swapsswapSenderAddress: Address that executed the swaptransactionSenderAddress: Transaction originator addressswapRecipient: Wallet that receives the output tokens, useful for accurate attribution in AA flowsbaseTokenPriceUSD/quoteTokenPriceUSD: Execution prices in USD at the time of the tradelabels: Wallet labels when availablewalletMetadata: Enriched wallet metadata when availableplatform: Trading platform or aggregator object when availabletotalFeesUSD: Total fees paid in USDgasFeesUSD/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 DocsSummary
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
swapRecipientwhen 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