This quickstart guide will get you up and running with a fully automated portfolio in just 5 simple steps.
Authentication
Glider is currently in early access. Sign up for the waitlist on the Glider
App.
Prerequisites
Before you begin, you’ll need:
- A Glider platform account
- An API key for authentication
- A wallet for signing portfolio creation and transaction permissions
Authenticate
First, you need to get an API key that will authenticate your requests to the Glider API.
- Log in to the Glider platform
- Navigate to your profile settings
- Select “API Keys” and create a new key
- Store your API key securely - you’ll need to include it in the header of all API requests
# Example of including your API key in requests
curl -H "X-API-KEY: your_api_key_here" https://api.glider.fi/v1/...
API Response Format
All Glider API responses follow a consistent format:
{
"success": true, // or false for errors
"data": {
// Response data varies by endpoint
},
"correlationId": "corr_abcd1234", // For request tracking
"requestId": "req_efgh5678", // For request tracking
"timestamp": "2023-05-21T12:34:56.789Z" // ISO timestamp
}
Error responses include additional error information:
{
"success": false,
"error": {
"code": "ERROR_CODE", // Specific error code
"message": "Human-readable error message",
"details": { // Optional additional details
// Error-specific information
}
},
"correlationId": "corr_abcd1234",
"requestId": "req_efgh5678",
"timestamp": "2023-05-21T12:34:56.789Z"
}
5-Step Portfolio Creation
1. Get a signature request
Request a message that your user will sign to authorize portfolio creation:
const signatureResponse = await fetch('https://api.glider.fi/v1/portfolio/create/signature', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': API_KEY,
},
body: JSON.stringify({
userAddress: '0xUserWalletAddress',
chainIds: [8453], // Base chain
}),
});
const signatureData = await signatureResponse.json();
2. Sign and create the portfolio
Have the user sign the message, then create the portfolio:
// Sign with user's wallet (using ethers, viem, or similar)
const signature = await wallet.signMessage(
signatureData.data.signatureAction.message
);
// Create the portfolio with the signature
const createResponse = await fetch('https://api.glider.fi/v1/portfolio/create', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': API_KEY,
},
body: JSON.stringify({
...signatureData.data,
signature,
templateData: {
name: 'ETH-USDC Portfolio',
description: 'A simple ETH-USDC portfolio',
entry: {
blockType: 'weight',
weightType: 'specified-percentage',
weightings: ['70', '30'],
children: [
{
blockType: 'asset',
assetId: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE:8453' // ETH
},
{
blockType: 'asset',
assetId: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913:8453' // USDC
}
]
},
tradingSettings: {
type: 'threshold',
triggerPercentage: 5
}
}
}),
});
const portfolio = await createResponse.json();
const portfolioId = portfolio.data.portfolioId;
3. Verify portfolio creation
Check that your portfolio was created successfully:
const getPortfolioResponse = await fetch(`https://api.glider.fi/v1/portfolio/${portfolioId}`, {
method: 'GET',
headers: {
'X-API-KEY': API_KEY,
},
});
const portfolioDetails = await getPortfolioResponse.json();
console.log(`Portfolio created: ${portfolioDetails.data.name}`);
4. Deposit assets
Generate deposit instructions for your user:
const depositResponse = await fetch(`https://api.glider.fi/v1/portfolio/${portfolioId}/deposit`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': API_KEY,
},
body: JSON.stringify({
token: {
chainId: 8453,
address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', // ETH
amount: '0.1' // 0.1 ETH
}
}),
});
const depositData = await depositResponse.json();
// Provide this to your frontend for user to confirm transaction
5. Start automation
Enable automatic rebalancing for your portfolio:
const startResponse = await fetch(`https://api.glider.fi/v1/portfolio/${portfolioId}/start`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': API_KEY,
},
body: JSON.stringify({
runRebalanceImmediately: true,
interval: {
every: 86400000, // Daily (24 hours in milliseconds)
}
}),
});
const startData = await startResponse.json();
console.log('Portfolio automation started!');
That’s it! You now have a fully automated portfolio that will rebalance daily or whenever assets drift more than 5% from target allocations.
Next Steps
For more detailed guides, check out:
Responses are generated using AI and may contain mistakes.