Streaming Quotes
The 0x Cross-Chain API is in private beta. Request access to start building.
The Cross-Chain API supports streaming of swap quotes using Server-Sent Events (SSE). Quotes are delivered progressively as they’re discovered, so users can act on them immediately.
Why Streaming?
- ⚡ Faster first quote — get actionable quotes faster
- 🔄 Progressive discovery — quotes stream in as they’re found, no blocking waits
- 🛠️ Immediately executable — every quote includes full transaction details
- 🎯 Better UX — show users the first good option instead of making them wait
Endpoint
GET /cross-chain/quotes/stream
Streams cross-chain swap quotes as SSE events. Each quote is delivered as a standalone event with everything needed for execution.
Same params as /cross-chain/quotes, except:
- No
sortQuotesBy— quotes stream in discovery order always - The
maxNumQuotesdefaults to 5 for the streaming endpoint (vs. 3 for the non-streaming/quotesendpoint). The stream closes after delivering this many quotes or reaching the timeout, whichever comes first.
After calling the endpoint with proper parameters, you will get back Server-Sent Events with the following message types:
Quote Found
Stream Done
Error (if stream fails)
Timeout
The stream has a 30-second server-side timeout. If no quotes are found within this window, a result event with liquidityAvailable: false is sent and the stream closes.
This timeout is not configurable. If you’re getting timeouts:
- Remove
excludedBridgesor broadenincludedBridges - Increase
slippageBps - Try a more liquid token pair
Reconnection
SSE connections may be dropped by network intermediaries (proxies, load balancers). If the connection closes without a result or error event:
- The stream is not resumable, just open a new connection with the same parameters
- Each new connection generates a new
zid - Add a 1–2 second delay between reconnection attempts
Client Example
You can find a full streaming example with NextJS in 0x-examples.