DefiLlama icon

DefiLlama

Access DeFi protocols data using the DefiLlama API

Overview

The node integrates with the DefiLlama API to retrieve decentralized finance (DeFi) data, specifically focusing on decentralized exchanges (DEXs) and their trading volumes for the "Get DEX Volume" operation. It fetches trading volume data for a specified DEX identified by its slug (e.g., uniswap, sushiswap, curve) over selectable time ranges such as 24 hours, 7 days, or 30 days.

This node is beneficial for users who want to monitor or analyze the trading activity of specific DEX platforms, track volume trends, or integrate DEX volume data into broader DeFi analytics workflows. For example, a user could use this node to get the latest 7-day trading volume of Uniswap to assess liquidity and market activity or compare volume changes across different DEXs.

Properties

Name Meaning
DEX Slug The identifier slug of the DEX to query (e.g., "uniswap", "sushiswap", "curve"). Required.
Additional Fields A collection of optional parameters to refine the query:
- Max Results Maximum number of results to return (1-100).
- Date Range Time range for data aggregation; options are "24 Hours", "7 Days", or "30 Days". Default: "24h".
- Min Volume Minimum volume threshold in USD to filter results.
- AI Agent Mode Whether to optimize output format for AI agents (simplified and structured).
- Include Summary When AI Agent Mode is enabled, whether to include a human-readable summary.

Output

The node outputs JSON data representing the trading volume details of the specified DEX. The structure includes fields such as:

  • totalVolume: The total trading volume aggregated over the selected date range.
  • change: The percentage change in volume compared to the previous equivalent period.
  • dateRange: The selected time range for the data (e.g., "24h", "7d", "30d").
  • Other metadata about the DEX may also be included.

If AI Agent Mode is enabled, the output is enhanced with:

  • ai_summary: A human-readable summary describing the volume data.
  • total_results: Number of results returned.
  • data: The raw data array.
  • resource, operation, and timestamp fields for context.

No binary data output is produced by this node.

Dependencies

  • External Service: DefiLlama API (https://defillama.com/), accessed via HTTPS requests.
  • Optional API Key Credential: The node supports using an API key credential if provided, which is sent as a Bearer token in the Authorization header.
  • No additional environment variables or n8n configurations are strictly required, but providing an API key may improve access or rate limits.

Troubleshooting

  • Missing or Invalid DEX Slug: If the DEX slug parameter is empty or malformed, the node will throw an error indicating that the slug is required or invalid. Ensure the slug uses only lowercase letters, numbers, hyphens, or underscores.
  • API Errors (400 or 404): If the slug does not correspond to a known DEX on DefiLlama, the node returns errors indicating invalid slug or not found. Verify the slug against DefiLlama's supported DEX list.
  • Network or API Access Issues: Failures to reach the DefiLlama API or authorization issues may cause errors. Check network connectivity and API key validity if used.
  • Empty Data Responses: If no volume data matches the filters (e.g., minVolume), the node may return empty results or a message indicating no data found.

To resolve these issues, verify input parameters carefully, ensure valid API credentials if needed, and confirm the availability of the requested DEX data on DefiLlama.

Links and References

Discussion