The Trading API provides cross-DEX token quotes, swaps, and approval services, automatically selecting the optimal route for token exchanges. It also supports equity token trading (RWA / Real World Assets such as Ondo and BStock stock tokens) via an RFQ (Request for Quote) workflow.
Feature Overview
| Feature | Endpoint | Method | Description |
|---|---|---|---|
| Supported Chains | /api/v1/dex/aggregator/supported/chain | GET | Query supported blockchain networks |
| Get Quote | /api/v1/dex/aggregator/quote | GET | Get a token swap quote (supports SWAP and RFQ modes) |
| Execute Swap | /api/v1/dex/aggregator/swap | GET | Generate swap transaction data or RFQ typed-data to sign |
| Quote and Swap | /api/v1/dex/aggregator/quote-and-swap | GET | Get a quote and build a swap transaction in a single call (no quoteId needed) |
| Approve Transaction | /api/v1/dex/aggregator/approve-transaction | GET | Generate token approval transaction data |
| Get Transaction Status | /api/v1/dex/aggregator/history | GET | Query DEX swap transaction status by txHash |
| Submit RFQ Order | /api/v1/dex/aggregator/order/submit | POST | Submit a signed RFQ order (equity tokens only) |
| Get RFQ Order Status | /api/v1/dex/aggregator/order/{orderId} | GET | Poll RFQ order settlement status |
Execution Modes
The /quote response includes an executionMode field that tells you which trading flow to follow:
| Mode | Token Types | Flow |
|---|---|---|
SWAP | Regular crypto tokens | Sign the tx from /swap and broadcast to the chain |
RFQ | Equity tokens (Ondo, BStock, etc.) | Sign rfq.typedDataToSign from /swap, submit via /order/submit, poll /order/{orderId} |
Equity Token Trading (RWA)
The Trading API supports tokenized equity assets (Real World Assets), including:
- Ondo tokens (type=1): Tokenized stocks and ETFs (e.g. NKEon/Nike, NVDAon/Nvidia, EEMon/iShares
ETF). Always routed via 3-vendor RFQ (InchFusion + CowSwap + PcsXRfq). All routes return
executionMode=RFQ. - BStock tokens (type=3): Exchange-traded stock tokens (e.g. PALLon/Palladium, TSLAB/Tesla). Routed via LiquidMesh (SWAP) + PcsXRfq (RFQ) in a mixed result â one SWAP route and one RFQ route may be returned simultaneously.
Note: Ondo and BStock token sets are mutually exclusive. A given token belongs to one type only.
SWAP Mode Flow (regular tokens and BStock LiquidMesh route)
Code
Flash API Flow (latency-sensitive)
For latency-sensitive trading with a known vendor, skip the /quote step entirely and call
/quote-and-swap â it returns executable calldata / swapTransaction in a single request, saving one
HTTP round-trip vs the two-step flow above. Currently the vendor parameter only accepts
LiquidMesh.
Code
RFQ Mode Flow (Ondo tokens and BStock PcsXRfq route)
Code
Key Constraints for Equity Token Trading
| Constraint | Details |
|---|---|
userWalletAddress | Required in /quote for RFQ routes. Used as the swap receiver in the RFQ order. |
quoteId TTL | 30 seconds. Call /swap within 30s of /quote or you will get QUOTE_EXPIRED (40401). |
| EIP-712 signature | Sign rfq.typedDataToSign from /swap. The signing wallet must match userWalletAddress. |
vendor in approve | Required for equity tokens in /approve-transaction. Use vendorName from /quote. |
Idempotency (requestId) | Reuse the same UUID when retrying /order/submit. A new UUID creates a new order. |
| Market hours | Ondo tokens may be unavailable outside US market hours (error 40367); BStock similarly (40369). |
Custom Fee (Add Fee / Referral Fee)
The Trading API supports an on-chain, atomic custom-fee (referral fee / revenue-share) feature: a configurable percentage of the swap is deducted on-chain and sent to a wallet address you designate, while the remainder goes through the normal DEX route. This is useful for integrators who want to collect a platform fee or share revenue with affiliates.
Supported chains. Both EVM chains (BSC, Ethereum, Base, etc.) and Solana (CT_501) are
supported, across /quote, /swap, /quote-and-swap, and the Solana-only /swap-instruction.
How it works. Two directions are supported, controlled by which parameters you send:
| Direction | Quote stage (/quote) | Swap stage (/swap, /quote-and-swap) | Effect |
|---|---|---|---|
FROM_TOKEN | feeSource=FROM_TOKEN | fromTokenReferrerWalletAddress (non-empty) | Fee is deducted from the sell token; the net amount is sent to the DEX. User receives the full DEX output. |
TO_TOKEN | feeSource=TO_TOKEN | toTokenReferrerWalletAddress (non-empty) | The full input is swapped; fee is deducted from the buy-token output. User receives the DEX output minus fee. |
Parameter pairing.
/quote:feePercent+feeSource(both present or both absent)./swap,/quote-and-swap, and/swap-instruction:feePercent+ exactly one offromTokenReferrerWalletAddress/toTokenReferrerWalletAddress(the two referrer addresses are mutually exclusive).
Limits. feePercent is a decimal string in (0, 5] for EVM chains and (0, 10] for Solana,
with at most 2 decimal places (e.g. "1.5" = 1.5%). Values with more than 2 decimals are rejected
with INVALID_FEE_PERCENT (40466). Referrer addresses must match the selected chain's format â EVM
(0x + 40 hex chars) or Solana Base58 pubkey â otherwise INVALID_REFERRER_ADDRESS (40467).
Supplying both referrer addresses returns CONFLICT_REFERRER_PARAMS (40468). On Solana, the
referrer must already be activated (funded with some SOL) or the request returns
REFERRER_NOT_ACTIVATED (40469).
Quote â swap consistency. When using the two-step flow, the fee direction (implied by which
referrer address you pass to /swap) and the feePercent value must match the ones locked in the
/quote cache for that quoteId; a mismatch returns SWAP_QUOTE_MISMATCH (40462). The
/quote-and-swap Flash API has no prior quote, so the fee is fully determined by the single
request.
Response echo. When the fee is enabled, /quote, /swap, /quote-and-swap, and
/swap-instruction responses include three fields under each route / routerResult: feeAmount
(fee deducted, integer string), feeToken (the token in which the fee is denominated), and
actualSwapAmount (the amount actually participating in the DEX swap). All three are null when
the fee is not enabled.
RFQ routes. Equity / RWA token (Ondo, BStock) RFQ routes ignore fee parameters and execute as a standard fee-less RFQ order.