Query Transaction Status | API Reference for DEX, Swap, and Exchange Integration

·

In the fast-evolving world of decentralized finance (DeFi), real-time transaction monitoring is essential for developers, traders, and platforms relying on seamless blockchain interactions. The Query Transaction Status API enables users to retrieve the final status of a cross-chain or single-chain swap by transaction hash (txHash), ensuring transparency and reliability in decentralized exchange operations.

Whether you're integrating automated trading tools, building a wallet interface, or managing smart contract executions, this API delivers accurate, structured data about transaction outcomes across supported blockchains.


How the Query Transaction Status API Works

This API endpoint allows developers to fetch detailed information about a specific transaction initiated via the OKX DEX Aggregator. By providing the txHash, you can verify whether a swap, wrap, unwrap, or approval action was successful, failed, or remains pending.

It plays a crucial role in user experience — imagine confirming instantly whether a token swap went through without manually checking block explorers.

👉 Discover how to integrate real-time transaction verification into your app today.


Endpoint Overview

HTTP Method: GET
Request URL: https://web3.okx.com/api/v5/dex/aggregator/history

This secure, authenticated endpoint returns structured JSON responses containing full transaction metadata, including status, timestamps, token details, gas usage, and error messages if applicable.


Request Parameters

To query a transaction, include the following parameters in your request:

🔐 Ensure your API key has proper permissions and is securely stored. Never expose it in client-side code.

Response Structure

The API returns a comprehensive object detailing every aspect of the transaction:


Example Use Case: Building a Real-Time Swap Tracker

Imagine you're developing a DeFi dashboard that shows live swap statuses for users. When a user initiates a token exchange:

  1. Your backend captures the txHash.
  2. You call the Query Transaction Status API every 5–10 seconds.
  3. Once the status changes from pending to success, you update the UI with:

    • Final received amount
    • Gas fee spent
    • Confirmation time

If the status becomes fail, you display:

This proactive feedback loop enhances trust and reduces support queries.

👉 See how leading apps maintain high reliability with instant status updates.


Frequently Asked Questions (FAQ)

Q: Can I use this API to track transactions not initiated by my application?

Yes. By default (isFromMyProject=false or not provided), you can query any transaction processed via the OKX DEX API. Set it to true only if you want to restrict results to transactions under your API key.


Q: What does “minimum unit” mean for token amounts?

Blockchain networks often represent token values in their smallest divisible units. For example:


Q: Why might a transaction remain “pending” for a long time?

A pending status usually means:

If it stays pending beyond expected confirmation windows (e.g., >30 mins on Ethereum), consider resubmitting with higher gas.


Q: How soon after submission can I query a transaction?

You can query immediately. However, if the transaction hasn't been broadcasted or indexed yet, the response may return empty or not found. Retry after a few seconds using exponential backoff.


Q: Is there a rate limit for this API?

While specific limits aren’t disclosed publicly, excessive requests may trigger throttling. Best practice: implement caching and avoid polling more than once every 5–10 seconds per transaction.


Q: Can I use this for cross-chain swaps?

Yes! As long as the cross-chain swap was initiated via the OKX DEX Aggregator and you have the correct txHash and chainIndex, you can track its status on either source or destination chain — depending on which leg you're verifying.


Core Keywords for SEO & Search Intent

To align with common developer searches and improve discoverability, key terms naturally integrated throughout include:

These reflect high-intent queries from developers integrating decentralized trading functionality into dApps, wallets, or analytics platforms.


Final Tips for Developers

With robust error handling and timely status checks, your application can deliver a smooth, professional-grade DeFi experience.

👉 Start testing the transaction status API with live data now.