> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enso.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Protocol Data

> Access DeFi protocols and tokens data through Enso's API

export const date_0 = "2025-08-07"

With Enso API, you can retrieve detailed information about DeFi protocols, tokens, and user balances.
These endpoints enable you to build data-rich applications with comprehensive DeFi protocol information.

## Protocol Information

The Protocol API endpoints provide access to DeFi protocol data, standards, and volume metrics.

### Get Supported Protocols

Retrieve a list of all protocols supported by Enso, including names, logos, and supported chains.

**API Reference:** [GET `/v1/protocols`](/api-reference/integration/all-protocols)

<CodeGroup dropdown>
  ```ts EnsoSDK theme={null}
  import { EnsoClient } from '@ensofinance/sdk';

  // Initialize the client with your API key
  const enso = new EnsoClient({
    apiKey: 'YOUR_API_KEY' // Replace with your actual API key
  });

  // Get all supported protocols
  async function getAllProtocols() {
    try {
      const protocols = await enso.getProtocolData();
      console.log('Supported protocols:', protocols);
      return protocols;
    } catch (error) {
      console.error('Error fetching protocols:', error);
      throw error;
    }
  }

  getAllProtocols();
  ```

  ```bash cURL theme={null}
  curl -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    "https://api.enso.build/api/v1/protocols" \
    | jq
  ```
</CodeGroup>

### Get Protocol Standards and Actions

Access detailed information about protocols' supported actions and standards.
This helps you understand which operations can be performed with specific protocols.

**API Reference:** [GET `/v1/standards`](/api-reference/integration/standards)

<CodeGroup dropdown>
  ```ts EnsoSDK theme={null}
  // Get all available standards (protocols and their actions)
  async function getProtocolStandards() {
    try {
      const response = await fetch('https://api.enso.build/api/v1/standards', {
        headers: {
          'Authorization': `Bearer ${enso.apiKey}`,
          'Content-Type': 'application/json'
        }
      });
      const standards = await response.json();
      console.log('Protocol standards and actions:', standards);
      return standards;
    } catch (error) {
      console.error('Error fetching standards:', error);
      throw error;
    }
  }

  // Get specific protocol standard
  async function getProtocolStandardBySlug(slug) {
    try {
      const response = await fetch(`https://api.enso.build/api/v1/integration/${slug}`, {
        headers: {
          'Authorization': `Bearer ${enso.apiKey}`,
          'Content-Type': 'application/json'
        }
      });
      const standard = await response.json();
      console.log(`Standard for ${slug}:`, standard);
      return standard;
    } catch (error) {
      console.error(`Error fetching standard for ${slug}:`, error);
      throw error;
    }
  }

  getProtocolStandards();
  getProtocolStandardBySlug('aave-v3');
  ```

  ```bash cURL theme={null}
  # Get all standards
  curl -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    "https://api.enso.build/api/v1/standards" \
    | jq

  # Get specific protocol standard
  curl -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    "https://api.enso.build/api/v1/integration/aave-v3" \
    | jq
  ```
</CodeGroup>

### Get Protocol Volume Data

Retrieve transaction volume on a given chain.

**API Reference:** [GET `/volume/{chainId}`](/api-reference/defi/chain-and-transactions-volume)

<CodeGroup dropdown>
  ```ts EnsoSDK theme={null}
  // Get protocol volume data for a specific chain
  async function getChainVolume(chainId: number) {
    try {
      const response = await fetch(`https://api.enso.build/api/v1/volume/${chainId}`, {
        headers: {
          'Authorization': `Bearer ${enso.apiKey}`,
          'Content-Type': 'application/json'
        }
      });
      const volumeData = await response.json();
      console.log(`Volume data for chain ${chainId}:`, volumeData);
      return volumeData;
    } catch (error) {
      console.error(`Error fetching volume data for chain ${chainId}:`, error);
      throw error;
    }
  }

  // Get volume data for Ethereum
  getChainVolume(1);
  ```

  ```bash cURL theme={null}
  curl -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    "https://api.enso.build/api/v1/volume/1" \
    | jq
  ```
</CodeGroup>

## Position Information

The Token API delivers data about DeFi assets including pricing, composition, and yield metrics. Filter tokens by protocol, chain, underlying assets, APY, or TVL to discover specific DeFi opportunities.

### Filter Supported Tokens

Query tokens based on various criteria like protocol, underlying assets, or token type. This helps users discover specific DeFi opportunities.

**API Reference:** [GET `/v1/tokens`](/api-reference/tokens/tokens)

<CodeGroup dropdown>
  ```ts EnsoSDK theme={null}
  import { EnsoClient } from '@ensofinance/sdk';

  // Initialize the client with your API key
  const enso = new EnsoClient({
    apiKey: 'YOUR_API_KEY' // Replace with your actual API key
  });

  // Get Aave V3 DeFi tokens on Ethereum mainnet (chainId 1) with USDT as underlying
  async function getAaveV3UsdtTokensOnEthereum() {
    try {
      const tokenData = await enso.getTokenData({
        chainId: 1, // Ethereum mainnet
        protocolSlug: 'aave-v3',
        type: 'defi',
        underlyingTokens: '0xdAC17F958D2ee523a2206206994597C13D831ec7', // USDT
        includeMetadata: true
      });
      
      console.log('Aave V3 DeFi tokens with USDT as underlying on Ethereum:', tokenData.data);
      return tokenData.data;
    } catch (error) {
      console.error('Error fetching tokens:', error);
      throw error;
    }
  }

  getAaveV3UsdtTokensOnEthereum();
  ```

  ```bash cURL theme={null}
  curl -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    "https://api.enso.build/api/v1/tokens?chainId=1&protocolSlug=aave-v3&type=defi&underlyingTokens=0xdAC17F958D2ee523a2206206994597C13D831ec7&includeMetadata=true" \
    | jq
  ```
</CodeGroup>

### Get Protocol TVL and APY Data

Access yield and total value locked (TVL) information for DeFi protocols. This data is crucial for comparing investment opportunities across the DeFi landscape.

**API Reference:** [GET `/v1/tokens`](/api-reference/tokens/tokens) with APY filters

<CodeGroup dropdown>
  ```ts EnsoSDK theme={null}
  import { EnsoClient } from '@ensofinance/sdk';

  // Initialize the client with your API key
  const enso = new EnsoClient({
    apiKey: 'YOUR_API_KEY' // Replace with your actual API key
  });

  // Get tokens with APY over 5% for a specific protocol
  async function getHighYieldTokensForProtocol(protocolSlug: string, minApy: number = 5) {
    try {
      const tokenData = await enso.getTokenData({
        chainId: 1,
        protocolSlug: protocolSlug,
        type: 'defi',
        apyFrom: minApy,
        includeMetadata: true
      });
      
      console.log(`${protocolSlug} tokens with APY > ${minApy}%:`, tokenData.data);
      return tokenData.data;
    } catch (error) {
      console.error('Error fetching high-yield tokens:', error);
      throw error;
    }
  }

  getHighYieldTokensForProtocol('yearn');
  ```

  ```bash cURL theme={null}
  curl -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    "https://api.enso.build/api/v1/tokens?chainId=1&protocolSlug=yearn-v2&type=defi&apyFrom=5&includeMetadata=true" \
    | jq
  ```
</CodeGroup>

### Get Token Prices

Retrieve current token prices with confidence scores, supporting decision-making around token swaps and valuations.

**API Reference:** [GET `/prices/token-price`](/api-reference/tokens/token-price)

<CodeGroup dropdown>
  ```ts EnsoSDK theme={null}
  import { EnsoClient } from '@ensofinance/sdk';

  // Initialize the client with your API key
  const enso = new EnsoClient({
    apiKey: 'YOUR_API_KEY' // Replace with your actual API key
  });

  // Get price data for a specific token
  async function getTokenPrice(chainId: number, tokenAddress: string) {
    try {
      const priceData = await enso.getPriceData({
        chainId,
        address: tokenAddress
      });
      
      console.log(`Price data for ${tokenAddress} on chain ${chainId}:`, priceData);
      return priceData;
    } catch (error) {
      console.error('Error fetching token price:', error);
      throw error;
    }
  }

  // Get price for WETH on Ethereum
  getTokenPrice(1, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2');
  ```

  ```bash cURL theme={null}
  curl -X GET \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    "https://api.enso.build/api/v1/prices/1/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" \
    | jq
  ```
</CodeGroup>

I'll add the token information use cases with the specified layout and examples:

### Get Information for Several Tokens

Retrieve detailed information about multiple tokens in a single request to support portfolio analysis or multi-token operations.

**API Reference:** [GET `/v1/tokens`](/api-reference/tokens/tokens)

<CodeGroup dropdown>
  ```ts EnsoSDK theme={null}
  // SDK Example
  const ensoClient = new EnsoClient({
    apiKey: "your-api-key"
  });

  const tokenData = await ensoClient.getTokenData({
    chainId: 1,
    address: [
      "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "0x6b175474e89094c44da98b954eedeac495271d0f"
    ],
    includeMetadata: true
  });
  ```

  ```bash cURL theme={null}
  curl -X GET \
    'https://api.enso.build/api/v1/tokens?chainId=1&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&address=0x6b175474e89094c44da98b954eedeac495271d0f&includeMetadata=true' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -H 'accept: application/json'
  ```
</CodeGroup>

### Fetch All Tokens from a Specific Protocol

Get a comprehensive list of all tokens associated with a particular protocol to understand available investment options.

**API Reference:** [GET `/v1/tokens`](/api-reference/tokens/tokens)

<CodeGroup dropdown>
  ```ts EnsoSDK theme={null}
  // SDK Example
  const ensoClient = new EnsoClient({
    apiKey: "your-api-key"
  });

  const aaveTokens = await ensoClient.getTokenData({
    chainId: 1,
    protocolSlug: "aave-v3",
    includeMetadata: true
  });
  ```

  ```bash cURL theme={null}
  curl -X GET \
    'https://api.enso.build/api/v1/tokens?chainId=1&protocolSlug=aave-v3&includeMetadata=true' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -H 'accept: application/json'
  ```
</CodeGroup>

### Filter by Token Type and Minimum TVL

Find specific token types with a minimum TVL (Total Value Locked) threshold to focus on well-established and liquid DeFi positions.

**API Reference:** [GET `/v1/tokens`](/api-reference/tokens/tokens)

<CodeGroup dropdown>
  ```ts EnsoSDK theme={null}
  // SDK Example
  const ensoClient = new EnsoClient({
    apiKey: "your-api-key"
  });

  const defiTokens = await ensoClient.getTokenData({
    chainId: 1,
    type: "defi",
    tvl: 1000000, // $1M minimum TVL
    includeMetadata: true
  });
  ```

  ```bash cURL theme={null}
  curl -X GET \
    'https://api.enso.build/api/v1/tokens?chainId=1&type=defi&tvlFrom=1000000&includeMetadata=true' \
    -H "Authorization: Bearer $ENSO_API_KEY" \
    -H 'accept: application/json'
  ```
</CodeGroup>

<div className="text-right text-xs gray-200 font-semibold w-full" style={{marginTop: '0'}}>
  <p style={{
        color: "#b2b2b2"  
    }}>Updated {date_0}</p>
</div>
