🚀 Getting Started with Oracle API
Quick start guide for integrating FortiBlox Oracle API into your applications with authentication, basic usage, and first API calls.
Getting Started with Oracle API
Quick Start Guide: Get up and running with FortiBlox Oracle API in minutes with this step-by-step guide covering authentication, basic usage, and your first API calls.
Welcome to FortiBlox Oracle API! This guide will help you integrate reliable cryptocurrency price data into your application quickly and efficiently.
Get Your API Key →
Quick Setup
1. Account Creation
Sign Up Process
- Create Account: Visit oracle.fortiblox.com/signup
- Email Verification: Verify your email address
- Plan Selection: Choose from Community, Professional, or Enterprise
- API Key Generation: Generate your authentication credentials
Account Types
Plan Comparison:
├── Community: Free tier with 1,000 requests/month
├── Professional: $29/month, 100,000 requests
├── Enterprise: Custom pricing, unlimited requests
└── Developer: $9/month, 10,000 requests
2. API Key Setup
Obtaining Your API Key
- Dashboard Access: Log into your Oracle dashboard
- API Keys Section: Navigate to API credentials
- Generate Key: Create new API key with appropriate permissions
- Secure Storage: Store your API key securely in environment variables
Security Best Practices
# Environment variable setup
export FORTIBLOX_API_KEY="your_api_key_here"
# Never hardcode API keys in your source code
const apiKey = process.env.FORTIBLOX_API_KEY;
First API Call
Basic Price Request
Simple Price Lookup
// JavaScript Example
const response = await fetch('https://api.oracle.fortiblox.com/v1/prices/BTC-USD', {
headers: {
'Authorization': `Bearer ${process.env.FORTIBLOX_API_KEY}`,
'Content-Type': 'application/json'
}
});
const priceData = await response.json();
console.log('BTC Price:', priceData.price);
Python Example
import requests
import os
# Make API request
url = "https://api.oracle.fortiblox.com/v1/prices/BTC-USD"
headers = {
"Authorization": f"Bearer {os.getenv('FORTIBLOX_API_KEY')}",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
price_data = response.json()
print(f"BTC Price: ${price_data['price']}")
Expected Response
{
"symbol": "BTC-USD",
"price": 45280.50,
"confidence": 95.2,
"timestamp": "2025-01-15T14:30:25Z",
"sources": 15,
"change_24h": 2.34,
"volume_24h": 1250000000
}
Essential Endpoints
Core Price Data
Current Prices
# Single asset price
GET /v1/prices/{symbol}
# Multiple asset prices
GET /v1/prices/batch?symbols=BTC-USD,ETH-USD,SOL-USD
# All supported assets
GET /v1/prices/all
Historical Data
# Price history
GET /v1/prices/{symbol}/history?period=1h&limit=100
# OHLCV data
GET /v1/prices/{symbol}/ohlcv?interval=1m&limit=500
Market Data
Market Information
// Market summary
const marketData = await fetch('https://api.oracle.fortiblox.com/v1/market/summary', {
headers: { 'Authorization': `Bearer ${apiKey}` }
});
// Top gainers/losers
const movers = await fetch('https://api.oracle.fortiblox.com/v1/market/movers', {
headers: { 'Authorization': `Bearer ${apiKey}` }
});
Authentication
API Key Authentication
Header Format
Authorization: Bearer your_api_key_here
Content-Type: application/json
Authentication Validation
// Check API key validity
async function validateApiKey(apiKey) {
try {
const response = await fetch('https://api.oracle.fortiblox.com/v1/auth/validate', {
headers: { 'Authorization': `Bearer ${apiKey}` }
});
return response.status === 200;
} catch (error) {
return false;
}
}
Rate Limiting
Rate Limits by Plan
Rate Limits:
├── Community: 10 requests/minute
├── Developer: 60 requests/minute
├── Professional: 300 requests/minute
└── Enterprise: 1000+ requests/minute
Handling Rate Limits
async function makeApiRequest(url, options) {
const response = await fetch(url, options);
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After');
await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
return makeApiRequest(url, options);
}
return response;
}
Common Use Cases
Portfolio Tracking
Multi-Asset Portfolio
async function getPortfolioValue(holdings) {
const symbols = Object.keys(holdings).map(asset => `${asset}-USD`).join(',');
const response = await fetch(
`https://api.oracle.fortiblox.com/v1/prices/batch?symbols=${symbols}`,
{ headers: { 'Authorization': `Bearer ${apiKey}` } }
);
const prices = await response.json();
let totalValue = 0;
for (const [asset, amount] of Object.entries(holdings)) {
const price = prices.data.find(p => p.symbol === `${asset}-USD`);
totalValue += amount * price.price;
}
return totalValue;
}
Price Alerts
Alert System Setup
async function checkPriceAlert(symbol, targetPrice, condition) {
const response = await fetch(
`https://api.oracle.fortiblox.com/v1/prices/${symbol}`,
{ headers: { 'Authorization': `Bearer ${apiKey}` } }
);
const data = await response.json();
const currentPrice = data.price;
if (condition === 'above' && currentPrice > targetPrice) {
return { triggered: true, currentPrice, targetPrice };
} else if (condition === 'below' && currentPrice < targetPrice) {
return { triggered: true, currentPrice, targetPrice };
}
return { triggered: false, currentPrice, targetPrice };
}
Error Handling
Common Errors
Error Response Format
{
"error": {
"code": "INVALID_SYMBOL",
"message": "The provided symbol is not supported",
"details": "Symbol 'INVALID-USD' is not available"
},
"timestamp": "2025-01-15T14:30:25Z"
}
Error Handling Implementation
async function handleApiResponse(response) {
if (!response.ok) {
const error = await response.json();
switch (response.status) {
case 400:
throw new Error(`Bad Request: ${error.error.message}`);
case 401:
throw new Error('Unauthorized: Check your API key');
case 403:
throw new Error('Forbidden: Insufficient permissions');
case 429:
throw new Error('Rate limit exceeded');
case 500:
throw new Error('Server error: Try again later');
default:
throw new Error(`API Error: ${error.error.message}`);
}
}
return await response.json();
}
Next Steps
Advanced Features
Explore More Capabilities
- Webhooks: Real-time price notifications
- Historical Analysis: Time-series data analysis
- Custom Indices: Create custom price indices
- Risk Analytics: Volatility and risk metrics
Integration Examples
- Trading Bots: Automated trading integration
- DeFi Protocols: Smart contract price feeds
- Portfolio Apps: Complete portfolio management
- Analytics Dashboards: Business intelligence integration
Best Practice: Start with the basic price endpoints, then gradually add more sophisticated features as your application grows.