Integration Guide
Get Started with Stackit.ai
Step-by-step guide to integrating Stackit.ai into your application or workflow. From onboarding to your first deposit in four steps.
Setup Steps
Book a Treasury Design Call
We'll map your income, goals, and constraints — and design the treasury rules together. This is where you decide allocation splits, borrowing preferences, and safety parameters.
Book at stackit.ai/meetGet API Credentials
After onboarding, you'll receive API keys for the Stackit.ai REST API. Keys are scoped to your treasury and follow the same safety rules as the dashboard.
Issued during onboardingConnect Your Treasury
Authenticate with your API key and make your first deposit. The system will create your treasury, apply your rules, and start managing positions.
POST /api/v1/depositsMonitor & Automate
Use the health and treasury endpoints to monitor your position. Set up scheduled deposits, automated borrowing, or connect AI agents for hands-free management.
GET /api/v1/healthAuthentication
All API requests require a Bearer token in the Authorization header. API keys are issued during onboarding and are scoped to your treasury.
Scoped API Keys
Limit API key permissions to only the actions your integration needs. Scoped keys follow the principle of least privilege — give each agent or service only the access it requires.
treasury:readRead treasury status, health score, and balances.
GET /treasury, GET /health
treasury:depositCreate deposits into the treasury.
POST /deposits
treasury:borrowCreate borrows against holdings.
POST /borrow
treasury:convertConvert USDC to BTC or ETH.
POST /convert
treasury:fullFull access to all treasury operations.
All endpoints
Code Examples
Check Treasury Health
TypeScriptconst response = await fetch('https://api.stackit.ai/api/v1/health', {
headers: {
'Authorization': 'Bearer sk_live_your_key',
},
});
const health = await response.json();
console.log(`Health Score: ${health.health_score}`);
console.log(`LTV: ${health.ltv}%`);
console.log(`Zone: ${health.ltv_zone}`);Create a Deposit
TypeScriptconst response = await fetch('https://api.stackit.ai/api/v1/deposits', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_live_your_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount: 10000,
allocation: { btc: 60, eth: 40 },
}),
});
const deposit = await response.json();
console.log(`Deposit ID: ${deposit.deposit_id}`);
console.log(`Fee: $${deposit.fee_usdc}`);
console.log(`Net: $${deposit.net_amount}`);Borrow Against Holdings
TypeScript// Always check health before borrowing
const health = await fetch('https://api.stackit.ai/api/v1/health', {
headers: { 'Authorization': 'Bearer sk_live_your_key' },
}).then(r => r.json());
if (health.ltv < 45) {
const borrow = await fetch('https://api.stackit.ai/api/v1/borrow', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_live_your_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount: 5000,
purpose: 'payroll-march',
}),
}).then(r => r.json());
console.log(`Borrowed: $${borrow.amount_usdc}`);
console.log(`New LTV: ${borrow.ltv_after}%`);
}Weekly DCA Agent
TypeScript// Simple weekly dollar-cost averaging agent
async function weeklyDCA() {
const WEEKLY_AMOUNT = 5000;
// Check treasury is healthy
const health = await fetch('https://api.stackit.ai/api/v1/health', {
headers: { 'Authorization': 'Bearer sk_live_your_key' },
}).then(r => r.json());
console.log(`Current health: ${health.health_score}`);
// Make the deposit
const deposit = await fetch('https://api.stackit.ai/api/v1/deposits', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_live_your_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount: WEEKLY_AMOUNT,
allocation: { btc: 50, eth: 50 },
}),
}).then(r => r.json());
console.log(`Deposited: $${deposit.net_amount}`);
console.log(`Fee: $${deposit.fee_usdc}`);
}
// Run every Monday at 9 AM
// cron: 0 9 * * 1Next Steps
Ready to integrate?
Book a Treasury Design Call to get your API keys and start building.