Treasury Platform API Reference
The BLGV Treasury platform provides enterprise-grade Bitcoin treasury management APIs with real-time analytics and BTC-per-share tracking.
๐ Base URLโ
- Production:
https://blgvbtc.com/api - Regtest:
http://localhost:3001/api
๐ Authenticationโ
API Key Authenticationโ
curl -X GET "https://blgvbtc.com/api/treasury/holdings" \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json"
Multi-Signature Wallet Authenticationโ
interface MultisigAuth {
walletId: string;
signatures: string[];
threshold: number;
publicKeys: string[];
}
๐ฐ Treasury Holdingsโ
GET /treasury/holdingsโ
Get current Bitcoin holdings and portfolio
Response:
{
"success": true,
"data": {
"totalBTC": "15.75432100",
"totalUSD": "708750.00",
"btcPrice": "45000.00",
"shareOutstanding": 1000000,
"btcPerShare": "0.00001575",
"lastUpdated": "2025-01-29T12:00:00Z",
"holdings": [
{
"address": "bc1q...",
"balance": "5.25000000",
"type": "cold_storage",
"label": "Primary Treasury"
}
]
}
}
GET /treasury/performanceโ
Get treasury performance metrics
Query Parameters:
period- Time period (1d, 7d, 30d, 90d, 1y, all)metric- Specific metric (btc_holdings, usd_value, btc_per_share)
Response:
{
"success": true,
"data": {
"period": "30d",
"startValue": "650000.00",
"endValue": "708750.00",
"changePercent": "+9.04%",
"btcHoldingsChange": "+0.75432100",
"timeseries": [
{
"timestamp": "2025-01-01T00:00:00Z",
"btcHoldings": "15.00000000",
"usdValue": "650000.00",
"btcPerShare": "0.00001500"
}
]
}
}
๐ Analytics & Reportingโ
GET /treasury/analytics/btc-per-shareโ
Get detailed BTC-per-share analytics
Response:
{
"success": true,
"data": {
"current": "0.00001575",
"previousMonth": "0.00001500",
"changePercent": "+5.0%",
"trend": "increasing",
"projections": {
"conservative": "0.00001650",
"moderate": "0.00001750",
"optimistic": "0.00001850"
}
}
}
GET /treasury/analytics/cash-flowโ
Get cash flow analysis
GET /treasury/analytics/risk-metricsโ
Get risk assessment metrics
๐ Transactionsโ
GET /treasury/transactionsโ
Get transaction history
Query Parameters:
type- Transaction type (purchase, sale, fee, transfer)limit- Number of transactions (default: 50)since- Timestamp filteraddress- Filter by address
Response:
{
"success": true,
"data": [
{
"txid": "a1b2c3...",
"type": "purchase",
"amount": "1.50000000",
"price": "44000.00",
"usdValue": "66000.00",
"fee": "0.00010000",
"timestamp": "2025-01-29T10:30:00Z",
"status": "confirmed",
"confirmations": 6
}
],
"pagination": {
"page": 1,
"limit": 50,
"total": 150
}
}
POST /treasury/purchaseโ
Execute Bitcoin purchase (requires multi-sig)
Request:
{
"amount": "1.0",
"maxPrice": "45000.00",
"strategy": "dca",
"approvers": ["pubkey1", "pubkey2", "pubkey3"]
}
POST /treasury/transferโ
Transfer Bitcoin between addresses
๐ Price & Market Dataโ
GET /treasury/price/currentโ
Get current Bitcoin price and sources
Response:
{
"success": true,
"data": {
"price": "45000.00",
"currency": "USD",
"sources": [
{
"exchange": "Coinbase",
"price": "44995.50",
"weight": 0.3
},
{
"exchange": "Binance",
"price": "45002.25",
"weight": 0.3
}
],
"lastUpdated": "2025-01-29T12:00:00Z"
}
}
GET /treasury/price/historyโ
Get historical price data
๐ข Compliance & Reportingโ
GET /treasury/reports/monthlyโ
Generate monthly treasury report
Response:
{
"success": true,
"data": {
"period": "2025-01",
"summary": {
"openingBalance": "14.25000000",
"purchases": "2.50000000",
"sales": "0.00000000",
"fees": "0.00567900",
"closingBalance": "15.75432100"
},
"pnl": {
"realizedGains": "0.00",
"unrealizedGains": "58750.00",
"totalReturn": "+9.04%"
},
"reportUrl": "https://blgvbtc.com/reports/2025-01-treasury.pdf"
}
}
GET /treasury/reports/audit-trailโ
Get detailed audit trail
POST /treasury/reports/generateโ
Generate custom report
๐ฏ Strategy & DCAโ
GET /treasury/strategy/currentโ
Get current investment strategy
Response:
{
"success": true,
"data": {
"type": "dca",
"frequency": "weekly",
"amount": "10000.00",
"maxPrice": "50000.00",
"active": true,
"nextExecution": "2025-02-03T10:00:00Z",
"performance": {
"totalInvested": "500000.00",
"avgCostBasis": "41500.00",
"currentValue": "708750.00",
"unrealizedGain": "+41.75%"
}
}
}
POST /treasury/strategy/updateโ
Update investment strategy
GET /treasury/strategy/backtestโ
Backtest investment strategies
๐ Webhooks & Eventsโ
POST /treasury/webhooksโ
Register webhook endpoint
Request:
{
"url": "https://your-app.com/blgv-webhook",
"events": ["purchase", "price_alert", "balance_change"],
"secret": "webhook-secret"
}
Event Typesโ
purchase- Bitcoin purchase executedsale- Bitcoin sale executedprice_alert- Price threshold reachedbalance_change- Holdings balance changedreport_ready- Report generation completed
๐ฏ Alerts & Notificationsโ
POST /treasury/alertsโ
Create price or balance alert
Request:
{
"type": "price",
"condition": "above",
"threshold": "50000.00",
"notification": {
"email": true,
"webhook": true,
"push": false
}
}
GET /treasury/alertsโ
Get active alerts
๐ Multi-Signature Operationsโ
GET /treasury/multisig/walletsโ
Get multi-signature wallet configurations
POST /treasury/multisig/proposeโ
Propose multi-signature transaction
POST /treasury/multisig/approveโ
Approve pending transaction
GET /treasury/multisig/pendingโ
Get pending transactions
๐ Dashboard Dataโ
GET /treasury/dashboardโ
Get dashboard overview data
Response:
{
"success": true,
"data": {
"holdings": {
"btc": "15.75432100",
"usd": "708750.00"
},
"performance": {
"24h": "+2.5%",
"7d": "+8.2%",
"30d": "+9.04%"
},
"recentTransactions": [...],
"alerts": [...],
"nextDCA": "2025-02-03T10:00:00Z"
}
}
๐ SDK Integrationโ
import { TreasuryClient } from '@blgv/ecosystem-sdk';
const treasury = new TreasuryClient({
apiKey: 'your-api-key',
environment: 'production'
});
// Get holdings
const holdings = await treasury.getHoldings();
// Execute purchase
const purchase = await treasury.purchase({
amount: '1.0',
maxPrice: '45000.00'
});
๐จ Error Handlingโ
Common Error Codesโ
INSUFFICIENT_FUNDS- Not enough funds for operationPRICE_EXCEEDED- Current price exceeds maximumMULTISIG_REQUIRED- Operation requires multi-signature approvalCOMPLIANCE_VIOLATION- Operation violates compliance rulesRATE_LIMIT_EXCEEDED- Too many API requests
๐ Rate Limitingโ
- Public endpoints: 100 requests per minute
- Private endpoints: 300 requests per minute
- Trading operations: 60 requests per minute
Need help? Check our Treasury Platform Guide or reach out via GitHub Issues.