1inch Portfolio API: Comprehensive Guide to Integration and Usage

Β·

The 1inch Portfolio API offers developers and investors a powerful tool to manage, analyze, and optimize their Web3 asset portfolios across multiple blockchains. Built with RESTful architecture and accessible over HTTPS, this API enables seamless integration into third-party applications, empowering users with real-time insights into their crypto investments. Whether you're tracking ERC20 tokens, analyzing liquidity provider (LP) positions, or evaluating investment performance, the 1inch Portfolio API delivers accurate, secure, and privacy-preserving data.

This guide explores the core features, integration process, use cases, and frequently asked questions to help you maximize the value of the 1inch Portfolio API in your decentralized finance (DeFi) workflows.

What Is the 1inch Portfolio API?

The 1inch Portfolio API is a developer-focused interface that allows applications to programmatically access comprehensive portfolio analytics from the 1inch ecosystem. By sending HTTP requests to designated endpoints, developers can retrieve real-time data on token valuations, profit and loss (PnL), return on investment (ROI), and detailed asset statistics.

Designed for automation and scalability, the API follows RESTful principles and supports integration with wallets, dashboards, analytics platforms, and custom DeFi tools. It enables efficient monitoring of digital assets without manual intervention, making it ideal for both individual investors and institutional-grade applications.

Key Features of the 1inch Portfolio Service

Multi-Wallet Support

Users can connect multiple wallets to monitor their combined asset holdings in one unified view. This simplifies portfolio management for those active across different accounts or custodial solutions.

Cross-Chain Asset Tracking

The API supports major blockchain networks including Ethereum, Binance Smart Chain, Polygon, Optimism, Arbitrum, and more. You can either track all chains simultaneously or apply filters to focus on specific networks.

Deep Liquidity Provider (LP) Position Analysis

Gain detailed insights into LP positions across leading DeFi protocols such as Uniswap V3, Aave, Lido, Curve, and SushiSwap. The API breaks down impermanent loss, fees earned, and overall position health to help optimize yield strategies.

Real-Time Valuation and Performance Metrics

Access up-to-date market prices and portfolio valuation metrics. Combined with historical data retrieval capabilities, this allows for accurate performance benchmarking over time.

πŸ‘‰ Discover how to integrate advanced portfolio analytics into your app today.

Core Advantages of Using the 1inch Portfolio API

  1. Multi-Chain Compatibility
    Track assets seamlessly across Ethereum, Polygon, Avalanche, and other EVM-compatible chains β€” all through a single API interface.
  2. In-Depth DeFi Position Insights
    Go beyond simple balance checks with granular analysis of staking rewards, liquidity pools, and yield-generating strategies.
  3. User Data Privacy
    No third parties process your wallet data. Users retain full ownership and control, ensuring compliance with privacy best practices.
  4. Advanced Charting Capabilities
    Visualize portfolio growth, token distribution, and performance trends using built-in charting tools that support customizable timeframes.
  5. Profitability Analysis
    Evaluate ROI and PnL across various time periods to assess strategy effectiveness and make informed rebalancing decisions.

Common Use Cases for the Portfolio API

DeFi Investment Management

Investors use the API to aggregate positions from multiple protocols like Aave, Compound, and Yearn Finance. With automated PnL tracking and ROI calculations, they can refine strategies based on actual performance rather than estimates.

Multi-Chain Portfolio Monitoring

For users spread across several blockchains, manually checking balances is inefficient. The 1inch Portfolio API consolidates all assets into a single dashboard view β€” reducing complexity and improving decision speed.

Secure and Private Asset Oversight

Privacy-conscious users appreciate that no private keys are required and no transaction signing occurs via the API. All data retrieval is read-only and non-custodial.

πŸ‘‰ Unlock powerful portfolio tracking tools for your Web3 project now.

Getting Started: Quick Integration Guide

This step-by-step tutorial shows how to use the 1inch Portfolio API (v4) to fetch:

Key Endpoints Used

Step 1: Initialize Project & Install Dependencies

npm init -y
npm install dotenv

Step 2: Create .env File

API_KEY=your_api_key_here
WALLET_ADDRESS=your_wallet_address_here
CHAIN_ID=1  # Example: Ethereum Mainnet
πŸ” Never commit your .env file to version control.

Step 3: Set Up API Calls with Rate Limit Handling

require("dotenv").config();
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));

// Fetch current token value
async function getCurrentValue(walletAddress, chainId) {
  const endpoint = `https://api.1inch.dev/portfolio/portfolio/v4/overview/erc20/current_value?addresses=${walletAddress}&chain_id=${chainId}`;
  const response = await fetch(endpoint, {
    headers: { Authorization: `Bearer ${process.env.API_KEY}` }
  });
  return await response.json();
}

// Get PnL and ROI over a time period
async function getProfitAndLoss(walletAddress, chainId, fromTimestamp, toTimestamp) {
  const endpoint = `https://api.1inch.dev/portfolio/portfolio/v4/overview/erc20/profit_and_loss?addresses=${walletAddress}&chain_id=${chainId}&from_timestamp=${fromTimestamp}&to_timestamp=${toTimestamp}`;
  const response = await fetch(endpoint, {
    headers: { Authorization: `Bearer ${process.env.API_KEY}` }
  });
  return await response.json();
}

// Retrieve detailed token stats
async function getTokenDetails(walletAddress, chainId) {
  const endpoint = `https://api.1inch.dev/portfolio/portfolio/v4/overview/erc20/details?addresses=${walletAddress}&chain_id=${chainId}`;
  const response = await fetch(endpoint, {
    headers: { Authorization: `Bearer ${process.env.API_KEY}` }
  });
  return await response.json();
}

Step 4: Execute Sequential Calls with Delays

To stay within free-tier rate limits (1 request per second), add delays between calls:

async function main() {
  console.log("Current Value:", await getCurrentValue(process.env.WALLET_ADDRESS, process.env.CHAIN_ID));
  await delay(2000);

  console.log("Profit and Loss:", await getProfitAndLoss(
    process.env.WALLET_ADDRESS,
    process.env.CHAIN_ID,
    "2023-01-01T00:00:00Z",
    "2023-01-31T23:59:59Z"
  ));
  await delay(2000);

  console.log("Token Details:", await getTokenDetails(process.env.WALLET_ADDRESS, process.env.CHAIN_ID));
}

main();

Run with: node index.js

πŸ“˜ Documentation Reference: 1inch Portfolio API Docs

Frequently Asked Questions (FAQ)

Can I specify which functions to use via the 1inch API?

Currently, direct function selection isn’t supported. However, you can use compatibility mode parameters to force certain behaviors β€” such as enabling gas-intensive swap functions when dealing with taxed tokens or complex smart contract interactions.

Does the API return route comparison data like on app.1inch.io?

No. Route path comparisons shown in the frontend interface aren't exposed via the API. Developers must source this information independently if needed for routing logic or UI displays.

Are there examples of using the 1inch Router in smart contracts?

Yes, sample implementations are available in the official documentation. These demonstrate how to integrate the router for swaps directly within Solidity-based contracts.

Can I use the 1inch Router without the API?

It’s technically possible but not recommended. Functions like unoswap, uniswapV3Swap, and clipperSwap can be called directly with proper bit masking and encoding. However, bypassing the API means losing access to aggregated liquidity sources and advanced optimization features.

How are rate limits determined?

Rate limits vary by your DevPortal subscription tier (Free, Pro, Enterprise). Free plans allow ~1 request per second. Higher tiers offer increased throughput and priority support.

What does the "value" field represent in transactions?

The value field indicates the amount of ETH sent to the 1inch router:

Core Keywords for SEO Optimization

These keywords have been naturally integrated throughout the content to align with common search queries while maintaining readability and relevance.

πŸ‘‰ Start building smarter DeFi tools with real-time portfolio data now.