During development, you can use the developer endpoints
without an API key. For production use, you’ll need an
API key to avoid rate limits.
BONK -> outcome token, without first swapping BONK → CASH and then CASH -> outcome token. This removes extra steps and streamlines application logic.
Trading Flow Overview
When you want to trade a spot token for a prediction market outcome token, the/order endpoint orchestrates the entire transaction flow behind the scenes. The endpoint automatically:
- Detects whether the target market has been tokenized (initialized)
- Executes a two-step swap path: Input Token → Settlement Mint → Outcome Token
- Handles market tokenization if the market hasn’t been initialized yet
The
/order endpoint accepts any spot token as inputMint and any outcome
token mint as outputMint. The endpoint automatically constructs the
appropriate transaction path based on the market’s initialization status.outputMint.
Filter Outcome Mints
Filter Outcome Mints
Transaction Flow
All trades from spot tokens to outcome tokens follow a two-step swap path that route through the settlement mint as an intermediate step:- Input Token → Settlement Mint
- Settlement Mint → Outcome Token
/order endpoint returns a single transaction that executes both swaps.
Request a Trade from Spot to Outcome Token
Request a Trade from Spot to Outcome Token
Monitor Order Status
Monitor Order Status
Market Initialization States
The/order endpoint automatically detects whether the target market has been tokenized and handles the transaction accordingly:
Initialized Markets
When a market has already been tokenized, the transaction executes the two-step swap path directly: Input Token → Settlement Mint → Outcome TokenUninitialized Markets
When a market hasn’t been tokenized yet, the/order endpoint automatically includes market tokenization in the transaction before executing the swap:
Market Tokenization + (Input Token → Settlement Mint → Outcome Token)
The transaction will:
- First perform on-demand market tokenization (creating the YES and NO outcome tokens on-chain)
- Then execute the two-step swap: Input Token → Settlement Mint → Outcome Token
On-demand market creation (tokenization) incurs a small fee. This fee is
automatically included in the transaction when trading into an uninitialized
market.
Checking Market Status
You can check a market’s initialization status using the Prediction Market Metadata API. TheisInitialized field in the market response indicates whether the market has been tokenized:
isInitialized: true- Market is already tokenized; direct swap path.isInitialized: false- Market needs tokenization; transaction will include initialization.
/order endpoint handles the detection automatically, so you don’t need to check beforehand.
Check Market Initialization Status
Check Market Initialization Status
API Routes
Key Takeaways
- The
/orderendpoint accepts any spot token as input and any outcome token as output. - All trades execute through the settlement mint as an intermediate step: Input Token → Settlement Mint → Outcome Token.
- For initialized markets, the transaction executes the swap path directly.
- For uninitialized markets, the transaction includes market tokenization before executing the swap path.
- On-demand market creation (tokenization) incurs a small fee.
- The endpoint automatically detects market initialization status and constructs the appropriate transaction.
- You can check
isInitializedvia the metadata API.
Related Resources
Order Endpoint Reference
Complete API reference for the
/order endpoint, including all parameters
and response formatsTrade Tokens Recipe
Learn how to use the DFlow Trade API to execute trades programmatically
Markets API Reference
Query market data including initialization status and outcome token
addresses
Discover Prediction Tokens
Learn how to find markets and access outcome token mint addresses for
trading