Overview
The OKX DEX API provides a method to check the final transaction status of cross-chain swaps using the transaction hash (txHash). This feature is essential for developers and traders to monitor and verify the completion of their decentralized exchange transactions.
API Endpoint
GET https://web3.okx.com/api/v5/dex/aggregator/history
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
chainIndex | String | Yes | Unique chain identifier (e.g., 1 for Ethereum). Refer to supported chains. |
chainId | String | Yes | Deprecated. Use chainIndex instead. |
txHash | String | Yes | Transaction hash generated via OKX DEX API. |
isFromMyProject | Boolean | No | Set to true to filter transactions initiated by your API key. Default: false. |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
chainId | String | Chain identifier (e.g., 1 for Ethereum). |
txHash | String | Transaction hash. |
height | String | Block height of the transaction. |
txTime | String | Transaction timestamp (Unix epoch in milliseconds). |
status | String | pending (executing), success (completed), fail (reverted). |
txType | String | Transaction type: Approve, Wrap, Unwrap, Swap. |
fromAddress | String | Sender's wallet address. |
dexrouter | String | Contract address interacted with. |
toAddress | String | Recipient's wallet address. |
fromTokenDetails | Array | Details of the input token: |
> symbol | String | Token symbol (e.g., ETH). |
> amount | String | Amount in smallest unit (e.g., wei for ETH). |
> tokenAddress | String | Token contract address. |
toTokenDetails | Array | Details of the output token (same structure as above). |
referalAmount | String | Referral commission amount. |
errorMsg | String | Error message (if any). |
gasLimit | String | Gas limit. |
gasUsed | String | Gas consumed (in smallest unit). |
gasPrice | String | Gas price (in smallest unit). |
txFee | String | Transaction fee in native token. |
Example Request
curl -X GET "https://web3.okx.com/api/v5/dex/aggregator/history?chainIndex=1&txHash=0x123..."Example Response
{
"chainId": "1",
"txHash": "0x123...",
"status": "success",
"txType": "Swap",
"fromTokenDetails": {
"symbol": "ETH",
"amount": "1000000000000000000",
"tokenAddress": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
},
"toTokenDetails": {
"symbol": "USDC",
"amount": "1500000000",
"tokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
}
}FAQs
1. How long does it take to get a transaction status?
Transactions typically update within seconds, but delays may occur during network congestion.
2. What does pending status mean?
It indicates the transaction is still being processed on-chain. Monitor until it changes to success or fail.
3. Can I query transactions from other projects?
Only if isFromMyProject=false (default). For project-specific queries, set it to true.
👉 Explore more about OKX DEX API