Prerequisites
Before you begin, ensure you have completed the prerequisites outlined in the Trading API Overview:- β Fireblocks API credentials configured
- β Vault accounts with sufficient assets
- β
Fireblocks TypeScript SDK installed (
@fireblocks/[emailΒ protected])
SDK Setup
First, set up your Fireblocks SDK client:Swap Flow Overview
The following steps outline the process for executing a swap via direct access providers:Step 1: List Available Providers
Before trading, retrieve the list of available providers and use the response to identify theid of your desired provider.
API Call
Response Example
Key Fields Explained
Direct access providers may require one-time Terms of Service approval. The fields hasTermsOfService and approved indicate whether approval is required and whether your workspace already approved it. Approval must be done once per workspace via the Fireblocks Console.
For more details about this endpoint, see the Get Providers API Reference.
Step 2: Approve Terms of Service (Direct Access Providers Only)
Direct access providers require one-time Terms of Service approval before trading. Approval must be done in the Fireblocks Console (not available via SDK).Check Approval Status
Clarification on how to translating user intent into baseAssetId, quoteAssetId, side, and baseAmount
When creating a Quote or an Order, you express the trade using:baseAssetId: the asset you receive on BUY / give on SELLquoteAssetId: the counter asset used to pay/receiveside:BUY: receive base / pay quoteSELL: give base / receive quote
baseAmount: amount inbaseAssetIdBUY: base amount to receiveSELL: base amount to sell
Examples
Step 3: Create a Quote for the Swap
Creating a quote is required before executing a swap via direct access providers. A quote provides you with the exact exchange rate, expected amounts, fees, and price impact for the swap.API Call
Quote Response Example
Understanding Quote Fields
Quotes expire quickly (typically within 1-5 minutes). Create your order promptly after receiving a quote.
For more details about this endpoint, see the Create Quote API Reference.
Step 4: Execute the Swap Order
Once you have a quote, execute the swap using that quote. Direct access providers like Uniswap require a quote to ensure you get the expected rate and protection against price slippage.Execute Order with Quote
Why direct access providers require quotes: Unlike some account-based providers, direct access providers (like Uniswap) through Fireblocks require creating a quote first. This ensures you know the exact exchange rate, fees, and slippage protection before the transaction executes on-chain.
For more details about this endpoint, see the Create Order API Reference.
Step 5: Monitor Order Status
After creating an order, monitor its execution status to track completion.Get Order Details
For more details about this endpoint, see the Get Order Details API Reference.
List All Orders
For more details about this endpoint, see the Get Orders (List) API Reference.
Order Status Values
Additional Resources
- Trading API Overview
- On-Ramp, Off-Ramp, and Bridge/Swap via Account-Based Providers (CeFi) - For on-ramp, off-ramp, and other account-based provider use cases
- Fireblocks SDKs: Python | TypeScript | Java
- Fireblocks Developer Portal
Support
For questions or issues with the Trading API:- Contact your Fireblocks Customer Success Manager
- Email: CSM@fireblocks.com
- Check the Fireblocks Developer Portal for updates