Getting Started with Quub Exchange
This guide will walk you through integrating Quub Exchange APIs into your application, from initial setup to making your first successful API call.
Time Required: 30 minutes Difficulty: Beginner Prerequisites: Basic programming knowledge, API familiarity
π What Youβll Learn
- Setting up your development environment
- Creating and configuring your Quub Exchange account
- Authenticating with the API
- Making your first API request
- Handling responses and errors
- Next steps for building your application
Step 1: Create Your Account
1.1 Sign Up
- Visit https://app.quub.exchange/signup
-
Choose your account type:
- Developer - For testing and development
- Business - For production applications
- Enterprise - For high-volume trading
- Complete the registration form
- Verify your email address
1.2 Access the Sandbox
For development, we recommend starting with our sandbox environment:
Sandbox Base URL: https://sandbox-api.quub.exchange/v1
Production Base URL: https://api.quub.exchange/v1
Step 2: Generate API Credentials
2.1 Create an API Key
- Log into the Quub Dashboard
- Navigate to Settings β API Keys
- Click Create New API Key
-
Configure permissions:
- Read-only (view data)
- Trade (execute orders)
- Withdraw (move assets)
- Admin (full access)
- Save your credentials securely:
{ "api_key": "qub_live_1234567890abcdef", "api_secret": "sk_live_abcdef1234567890...", "tenant_id": "org_abc123" }
Step 3: Install SDK (Optional)
Choose your preferred language:
JavaScript/Node.js
npm install @quub/exchange-sdk
const Quub = require("@quub/exchange-sdk");
const client = new Quub({
apiKey: process.env.QUUB_API_KEY,
apiSecret: process.env.QUUB_API_SECRET,
environment: "sandbox", // or 'production'
});
Python
pip install quub-exchange
from quub import QuubClient
client = QuubClient(
api_key=os.getenv('QUUB_API_KEY'),
api_secret=os.getenv('QUUB_API_SECRET'),
environment='sandbox'
)
Direct REST API
If you prefer not to use an SDK, you can call our REST API directly.
Step 4: Authenticate
4.1 Generate JWT Token
POST /v1/auth/token
Content-Type: application/json
{
"api_key": "your_api_key",
"api_secret": "your_api_secret"
}
Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "rt_1234567890abcdef"
}
4.2 Using the Token
Include the token in all subsequent requests:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Step 5: Make Your First API Call
5.1 Get Account Information
Letβs retrieve your account details:
Using SDK (JavaScript):
const account = await client.auth.getAccount();
console.log("Account ID:", account.id);
console.log("Organization:", account.org_name);
console.log("Status:", account.status);
Using REST API:
curl -X GET https://sandbox-api.quub.exchange/v1/auth/account \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json"
Response:
{
"id": "usr_1234567890",
"email": "developer@example.com",
"org_id": "org_abc123",
"org_name": "My Company",
"status": "active",
"created_at": "2025-11-01T10:00:00Z",
"permissions": ["read", "trade"]
}
5.2 List Available Assets
const assets = await client.custodian.listAssets();
assets.forEach((asset) => {
console.log(`${asset.symbol}: ${asset.balance} ${asset.currency}`);
});
REST API:
curl -X GET https://sandbox-api.quub.exchange/v1/custodian/assets \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Response:
{
"assets": [
{
"id": "ast_btc_001",
"symbol": "BTC",
"name": "Bitcoin",
"balance": "1.5",
"available": "1.2",
"locked": "0.3",
"value_usd": "67500.00"
},
{
"id": "ast_eth_001",
"symbol": "ETH",
"name": "Ethereum",
"balance": "10.0",
"available": "8.5",
"locked": "1.5",
"value_usd": "23000.00"
}
],
"total_value_usd": "90500.00"
}
Step 6: Place a Test Order
Letβs place a simple limit order in the sandbox:
6.1 Get Market Data
First, check the current market price:
const ticker = await client.exchange.getTicker("BTC-USD");
console.log("Current BTC Price:", ticker.last_price);
6.2 Create a Limit Order
const order = await client.exchange.createOrder({
instrument: "BTC-USD",
side: "buy",
type: "limit",
quantity: "0.01",
price: "65000.00",
time_in_force: "GTC", // Good 'til Canceled
});
console.log("Order placed:", order.id);
console.log("Status:", order.status);
REST API:
curl -X POST https://sandbox-api.quub.exchange/v1/exchange/orders \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"instrument": "BTC-USD",
"side": "buy",
"type": "limit",
"quantity": "0.01",
"price": "65000.00",
"time_in_force": "GTC"
}'
Response:
{
"id": "ord_1234567890",
"instrument": "BTC-USD",
"side": "buy",
"type": "limit",
"quantity": "0.01",
"price": "65000.00",
"status": "pending",
"filled_quantity": "0",
"created_at": "2025-11-03T09:15:00Z",
"updated_at": "2025-11-03T09:15:00Z"
}
Step 7: Handle Responses & Errors
7.1 Success Responses
All successful responses follow this structure:
{
"success": true,
"data": { ... },
"metadata": {
"request_id": "req_abc123",
"timestamp": "2025-11-03T09:15:00Z"
}
}
7.2 Error Handling
try {
const order = await client.exchange.createOrder({...});
} catch (error) {
console.error('Error Code:', error.code);
console.error('Message:', error.message);
console.error('Details:', error.details);
}
Error Response:
{
"success": false,
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Insufficient balance to place order",
"details": {
"required": "650.00",
"available": "500.00",
"currency": "USD"
}
},
"request_id": "req_abc123"
}
Step 8: Set Up Webhooks (Optional)
Get real-time updates for important events:
8.1 Create a Webhook Endpoint
app.post("/webhooks/quub", (req, res) => {
const event = req.body;
switch (event.type) {
case "order.filled":
console.log("Order filled:", event.data.order_id);
break;
case "withdrawal.completed":
console.log("Withdrawal completed:", event.data.tx_id);
break;
}
res.sendStatus(200);
});
8.2 Register Webhook
const webhook = await client.events.createWebhook({
url: "https://yourapp.com/webhooks/quub",
events: ["order.*", "withdrawal.*"],
secret: "your_webhook_secret",
});
π― Next Steps
Congratulations! Youβve successfully integrated with Quub Exchange. Hereβs what to explore next:
Build Your Application
- Trading Bot - Trading Integration Guide
- Custody Solution - Custody Integration Guide
- Payment System - Payment Integration Guide
Advanced Topics
- Authentication - OAuth, API keys, and security
- Best Practices - Production-ready patterns
- Rate Limiting - Optimize API usage
- Testing - Test your integration thoroughly
Explore APIs
- Exchange API - Trading and orders
- Custodian API - Asset management
- Market Data API - Price feeds
- All APIs - Complete reference
π‘ Pro Tips
- Start in Sandbox - Always test in sandbox before production
- Use Webhooks - More efficient than polling APIs
- Implement Retries - Handle transient failures gracefully
- Monitor API Usage - Track your rate limits
- Keep Tokens Secure - Use environment variables and secrets managers
π Need Help?
- API Reference - Complete API documentation
- Community Forum - Ask questions
- Support - Get help from our team
- Status Page - Check system status
π Additional Resources
Last updated: November 3, 2025