Documentation Index
Fetch the complete documentation index at: https://fireblocks-43c4b3ee-chore-add-cli.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Beta Feature
The Trading API is currently in beta and subject to change. For participation details, contact your Fireblocks Customer Success Manager or email CSM@fireblocks.com.
This guide provides step-by-step examples of how to execute various order operations using the Fireblocks Trading API via account-based providers. These require you to connect an account before trading. For instructions on how to connect accounts, see Fireblocks Connected Accounts. This guide covers multiple use cases including on-ramp (fiat to crypto), off-ramp (crypto to fiat), and bridging (crypto-to-crypto).
Prerequisites
Before you begin, ensure you have completed the prerequisites outlined in the Trading API Overview:
- ✅ Fireblocks API credentials configured
- ✅ Fireblocks TypeScript SDK installed (
@fireblocks/version 13.x or later)
- ✅ Connected account(s) set up with your chosen provider(s) via the Fireblocks Console (see Fireblocks Connected Accounts for setup instructions)
SDK Setup
First, set up your Fireblocks SDK client:
import { Fireblocks } from '@fireblocks/ts-sdk';
import * as fs from 'fs';
// Initialize the Fireblocks SDK
const fireblocks = new Fireblocks({
apiKey: 'your-api-key',
secretKey: fs.readFileSync('/path/to/your/secret.key', 'utf8'),
basePath: 'https://api.fireblocks.io',
});
Provider and account discovery
Before trading with account-based providers, find out which providers are available and which accounts you have connected. If you haven’t connected any accounts yet, see Fireblocks Connected Accounts for setup instructions.
Step 1: Get Providers and Connected Accounts
Retrieve all trading providers. For account-based providers, the response includes provider information and connected accounts, allowing you to extract both providerId and accountId in a single call.
// Get all trading providers
const response = await fireblocks.trading.getTradingProviders({ pageSize: 20 });
// Filter for account-based providers
const accountBasedProviders = response.data.data.filter(p => p.accountBased);
// Access provider and account information
for (const provider of accountBasedProviders) {
console.log(`Provider: ${provider.id} (${provider.name})`);
provider.accounts?.forEach(account => {
console.log(` Account: ${account.id} (${account.name})`);
});
}
Response Example
{
"data": [
{
"id": "ALFREDPAY",
"name": "Alfred Pay",
"accountBased": true,
"connected": true,
"accounts": [
{
"id": "acc_5e9a2d1c4b7f3e8a",
"name": "My Alfred Pay Account"
}
],
"manifest": {
"assetTypes": ["FIAT", "DIGITAL"],
"capabilities": ["TRADING"]
}
},
{
"id": "YELLOWCARD",
"name": "Yellow Card",
"accountBased": true,
"connected": true,
"accounts": [
{
"id": "acc_9f4e2d8b1c6a5e73",
"name": "Yellow Card Main Account"
}
],
"manifest": {
"assetTypes": ["FIAT", "DIGITAL"],
"capabilities": ["TRADING"]
}
}
],
"total": 2,
"next": null
}
Key Fields Explained
| Field | Description |
|---|
id | Unique identifier for the provider (use as providerId in subsequent API calls) |
name | Display name of the provider |
accountBased | true for account-based providers, false for direct access providers |
connected | Whether you have at least one connected account with this provider |
accounts | Array of connected accounts for this provider. Each account has an id (use as accountId in subsequent API calls) and name |
Step 2: Get Supported Trading Pairs
For each connected account, discover which trading pairs are supported:
// Get supported trading pairs for a specific connected account
const response = await fireblocks.trading.getTradingPairs({
accountId: 'acc_9f4e2d8b1c6a5e73',
});
// Response data
const tradingPairs = response.data;
// tradingPairs = [
// {
// "id": "7c9e8f2a-4b5d-4e1c-9a3b-6f8d2e5c7a1b",
// "toAsset": "USDC",
// "fromAsset": "USD",
// "prefunded": false,
// "fromAssetRail": "ACH"
// }
// ]
Step 3: Get Indicative Rates
Get indicative rates for price preview (these are not executable quotes):
// Get indicative rates
const response = await fireblocks.trading.getRates({
accountId: 'acc_9f4e2d8b1c6a5e73',
baseAssetId: 'USD',
quoteAssetId: 'BTC',
});
const rates = response.data;
Note: Rates provide indicative prices for preview, while quotes return committed rates that can be executed until expiration.