### Nansen API: Make First API Call Source: https://context7_llms This guide assists users in making their initial API call to the Nansen API, from obtaining an API key to receiving a successful response. It covers the fundamental steps for getting started with the API. ```N/A This guide takes you from API key → first successful response in minutes. ``` -------------------------------- ### SmartMoneyNetflowRequest Example Source: https://docs.nansen.ai/getting-started/make-your-first-api-call An example of a request body for the Smart Money Netflow API, demonstrating how to specify chains, filters, pagination, and sorting preferences. ```json { "chains": [ "ethereum", "polygon" ], "filters": { "token_age_days": { "gt": 30 }, "market_cap_usd": { "gte": 10000000 } }, "pagination": { "page": 1, "per_page": 50 }, "order_by": [ { "field": "net_flow_30d_usd", "direction": "DESC" } ] } ``` -------------------------------- ### SmartMoneyNetflowResponse Example Source: https://docs.nansen.ai/getting-started/make-your-first-api-call An example of a successful response from the Smart Money Netflow API, containing a list of smart money netflow records and pagination information. ```json { "data": [ { "token_address": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984", "token_symbol": "UNI", "net_flow_24h_usd": 1500000.50, "net_flow_7d_usd": 7500000.25, "net_flow_30d_usd": 25000000.75, "chain": "ethereum", "token_sectors": [ "DeFi", "Governance" ], "trader_count": 1200, "token_age_days": 1200, "market_cap_usd": 5000000000 }, { "token_address": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "token_symbol": "USDT", "net_flow_24h_usd": -500000.00, "net_flow_7d_usd": -2000000.00, "net_flow_30d_usd": -10000000.00, "chain": "ethereum", "token_sectors": [ "Stablecoin" ], "trader_count": 5000, "token_age_days": 2500, "market_cap_usd": 80000000000 } ], "pagination": { "page": 1, "per_page": 50, "is_last_page": false } } ``` -------------------------------- ### Smart Money Netflows API Request Example Source: https://docs.nansen.ai/getting-started/make-your-first-api-call This example demonstrates a typical API request to the Smart Money Netflows endpoint. It includes the base URL and the method, which is POST for all Nansen API endpoints. Users are instructed to replace 'YOUR_API_KEY' with their actual key. ```json { "apiKey": "YOUR_API_KEY" } ``` -------------------------------- ### SmartMoneyNetflowRequest Example Source: https://docs.nansen.ai/api/smart-money/netflows Example of a request to the Smart Money Netflow API, specifying chains, filters, and sorting preferences. This demonstrates how to query for specific smart money flows. ```JSON { "chains": [ "ethereum", "polygon" ], "filters": { "token_sectors": [ "DeFi", "NFT" ], "market_cap_usd": { "min": 100000000, "max": 10000000000 } }, "order_by": [ { "field": "net_flow_30d_usd", "direction": "DESC" } ], "pagination": { "page": 1, "per_page": 50 } } ``` -------------------------------- ### Token Screener API Request Example Source: https://docs.nansen.ai/api/token-god-mode/token-screener This example demonstrates how to request the most liquid tokens under 7 days old on Ethereum and Base using the Token Screener API. It includes parameters for chains and date, filters for token age, and specifies pagination and sorting preferences. ```json { "parameters": { "chains": [ "ethereum", "base" ], "date": { "from": "2025-07-01", "to": "2025-07-02" }, "watchlistFilter": [], "sectorsFilter": [], "smLabelFilter": [], "onlySmartMoney": false }, "filters": { "tokenAgeDays": { "from": 0, "to": 4 } }, "pagination": { "page": 1, "recordsPerPage": 100 }, "order": { "order": "desc", "orderBy": "liquidity" } } ``` -------------------------------- ### SmartMoneyHoldingsRequest Example Source: https://docs.nansen.ai/api/smart-money/holdings Demonstrates how to construct a request for the Smart Money Holdings API, including specifying chains, filters, pagination, and sorting. ```Python from nansen import Nansen nansen_api = Nansen("YOUR_API_KEY") request_body = { "chains": ["ethereum", "polygon"], "filters": { "token_sectors": ["DeFi", "NFT"], "market_cap_usd": {"min": 10000000, "max": 1000000000}, "token_age_days": {"min": 30} }, "pagination": {"per_page": 50}, "order_by": [ {"field": "value_usd", "direction": "DESC"}, {"field": "holders_count", "direction": "ASC"} ] } response = nansen_api.smart_money.holdings(request_body) print(response) ``` -------------------------------- ### Index Nansen API Docs with Cursor Source: https://docs.nansen.ai/beta-nansen-api/guides/vibecoding-with-nansen-api Instructions on how to add the Nansen API documentation URL to Cursor for indexing, enabling the IDE to understand and scaffold client code based on the API. ```bash https://docs.nansen.ai/nansen-api-reference.md ``` -------------------------------- ### SmartMoneyHoldingsSortOrder Example Source: https://docs.nansen.ai/api/smart-money/holdings Shows how to define custom sorting for the Smart Money Holdings API response, allowing sorting by multiple fields in ascending or descending order. ```JSON [ { "field": "value_usd", "direction": "DESC" }, { "field": "holders_count", "direction": "ASC" } ] ``` -------------------------------- ### NumericRangeFilter for Float Values Source: https://docs.nansen.ai/api/token-god-mode/flow-intelligence A filter for numeric values, specifically floats, that allows for optional minimum and maximum bounds. It is suitable for filtering data like prices, volumes, and ratios. Example values range from -10.5 to 100.75. ```json { "type": "object", "title": "NumericRangeFilter", "description": "Filter for numeric values (floats) with optional min/max bounds.\nUse for prices, volumes, ratios, and other decimal values. - Values between -10.5 and 100.75" } ``` -------------------------------- ### API Key Header Source: https://docs.nansen.ai/beta-nansen-api/getting-started/make-your-first-api-call This snippet shows how to include your Nansen API key in the request header for authentication. Ensure you replace 'YOUR_API_KEY' with your actual key. ```bash -H 'apiKey: YOUR_API_KEY' \ ``` -------------------------------- ### Numeric Range Filter for Token Metrics Source: https://docs.nansen.ai/api/token-god-mode/token-screener Defines a filter for numeric values (floats) with optional minimum and maximum bounds. This is used for metrics like prices, volumes, and ratios. The example range provided is between -10.5 and 100.75. ```json { "type": "object", "title": "NumericRangeFilter", "description": "Filter for numeric values (floats) with optional min/max bounds.\nUse for prices, volumes, ratios, and other decimal values. - Values between -10.5 and 100.75" } ``` -------------------------------- ### Fetch Smart Money Inflows (Javascript) Source: https://docs.nansen.ai/beta-nansen-api/getting-started/make-your-first-api-call This Javascript code snippet demonstrates how to fetch smart money inflows from the Nansen AI API using the fetch API. It includes setting the API key, content type, and request body with parameters for filtering smart money, specifying chains, and pagination. ```javascript const response = await fetch('https://api.nansen.ai/api/beta/smart-money/inflows', { method: 'POST', headers: { "apiKey": "YOUR_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ "parameters": { "smFilter": [ "180D Smart Trader", "Fund", "Smart Trader" ], "chains": [ "ethereum", "solana" ], "includeStablecoin": true, "includeNativeTokens": true, "excludeSmFilter": [] }, "pagination": { "page": 1, "recordsPerPage": 100 } }) }); const data = await response.json(); ``` -------------------------------- ### Numeric Range Filter for Financial Data Source: https://docs.nansen.ai/api/token-god-mode/flow-intelligence This filter is designed for numeric (float) values, suitable for prices, volumes, ratios, and other decimal values. It supports optional minimum and maximum bounds, with example values ranging from -10.5 to 100.75. ```JSON { "type": "object", "title": "NumericRangeFilter", "description": "Filter for numeric values (floats) with optional min/max bounds.\nUse for prices, volumes, ratios, and other decimal values. - Values between -10.5 and 100.75" } ``` -------------------------------- ### View DeFi Positions Source: https://docs.nansen.ai/getting-started/use-case-templates/simple-use-cases Retrieve comprehensive details about a wallet's DeFi positions, including balances, values, and token information. This is useful for analyzing portfolio performance and tracking asset allocation. ```bash curl -L \ --request POST \ --url 'https://api.nansen.ai/api/v1/portfolio/defi-holdings' \ --header 'apiKey: YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data '{ "wallet_address": "0x4062b997279de7213731dbe00485722a26718892" }' ``` -------------------------------- ### SmartMoneyNetflowRequest Schema Source: https://docs.nansen.ai/getting-started/make-your-first-api-call The complete schema for the Smart Money Netflow request, outlining all required and optional parameters including chains, filters, pagination, and sorting. ```json { "required": [ "chains" ], "additionalProperties": false, "type": "object", "title": "SmartMoneyNetflowRequest", "description": "" } ``` -------------------------------- ### IntegerRangeFilter for Count Values Source: https://docs.nansen.ai/api/token-god-mode/flow-intelligence A filter designed for integer values, enabling the specification of optional minimum and maximum bounds. This filter is useful for data representing counts, quantities of items, or other whole number values. Example values range from 5 to 100. ```json { "type": "object", "title": "IntegerRangeFilter", "description": "Filter for integer values with optional min/max bounds.\nUse for counts, numbers of items, and other whole number values. - Values between 5 and 100" } ``` -------------------------------- ### View DeFi Positions with Nansen API Source: https://docs.nansen.ai/beta-nansen-api/getting-started/usecase-templates/easy-level-usecases Retrieve comprehensive information about a wallet's DeFi positions, including balances, values, and token details. This is useful for analyzing portfolio performance and tracking changes. ```bash curl -L \ --request POST \ --url 'https://api.nansen.ai/api/v1/portfolio/defi-holdings' \ --header 'apiKey: YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data '{ "wallet_address": "0x4062b997279de7213731dbe00485722a26718892" }' ``` -------------------------------- ### Get Address Counterparties Data (JSON) Source: https://docs.nansen.ai/api/profiler/address-counterparties This JSON object defines the request structure for the Nansen API's 'Get Address Counterparties Data' endpoint. It specifies parameters for the address, entity name, blockchain, date range, interaction source, grouping, and various filters for interaction count and volume. ```json { "openapi": "3.1.0", "info": { "title": "Nansen API", "version": "1.0.0" }, "tags": [ { "name": "Profiler", "description": "Wallet profiling and analysis" } ], "servers": [ { "url": "https://api.nansen.ai", "description": "Production server" } ], "security": [ { "ApiKeyAuth": [] } ], "components": { "securitySchemes": { "ApiKeyAuth": { "type": "apiKey", "in": "header", "name": "apiKey", "description": "API key for authentication" } } }, "paths": { "/api/v1/profiler/address/counterparties": { "post": { "tags": [ "Profiler" ], "summary": "Get Address Counterparties Data", "description": "Get top counterparties that wallet addresses have interacted with, supporting different\ngrouping options (wallet or entity) and source filtering (Combined, Tokens, ETH).\nReturns interaction statistics including volume, frequency, and timing data.\n\nWhat it helps to answer:\n\n- Most frequent transaction partners by count and volume\n- Net value flows between addresses (inflows vs outflows)\n- Exchange and protocol interaction patterns\n- DeFi protocol usage and DEX trading counterparties\n- High-value transfer relationships and funding sources", "operationId": "get_profiler_address_counterparties_api_v1_profiler_address_counterparties_post", "requestBody": { "content": { "application/json": { "schema": { "properties": { "address": { "anyOf": [ { "type": "string" } ], "title": "Address", "description": "Address to get counterparties for" }, "entity_name": { "anyOf": [ { "type": "string" } ], "title": "Entity Name", "description": "Entity name to get counterparties for" }, "chain": { "description": "Blockchain chain for the counterparties data", "type": "string", "enum": [ "all", "arbitrum", "avalanche", "base", "berachain", "blast", "bnb", "ethereum", "fantom", "goat", "hyperevm", "iotaevm", "linea", "mantle", "optimism", "polygon", "ronin", "sei", "scroll", "sonic", "unichain", "zksync", "solana", "bitcoin", "starknet", "ton", "tron" ], "title": "ProfilerChain" }, "date": { "description": "Date range for the counterparties data", "properties": { "from": { "anyOf": [ { "type": "string" } ], "title": "From", "description": "Start date in ISO 8601 format" }, "to": { "anyOf": [ { "type": "string" } ], "title": "To", "description": "End date in ISO 8601 format" } }, "type": "object", "title": "DateRange" }, "source_input": { "description": "Type of interactions to include", "default": "Combined", "type": "string", "enum": [ "Combined", "Tokens", "ETH" ], "title": "SourceInput" }, "group_by": { "description": "Group counterparties by wallet or entity", "default": "wallet", "type": "string", "enum": [ "wallet", "entity" ], "title": "GroupBy" }, "filters": { "anyOf": [ { "properties": { "interaction_count": { "anyOf": [ { "properties": { "min": { "anyOf": [ { "type": "integer" } ], "title": "Min", "description": "Minimum value (inclusive)" }, "max": { "anyOf": [ { "type": "integer" } ], "title": "Max", "description": "Maximum value (inclusive)" } }, "type": "object", "title": "IntegerRangeFilter", "description": "Filter for integer values with optional min/max bounds.\nUse for counts, numbers of items, and other whole number values. - Values between 5 and 100" } ], "description": "Interaction count range filter" }, "total_volume_usd": { "anyOf": [ { "properties": { "min": { "anyOf": [ { "type": "number" } ], "title": "Min", "description": "Minimum value (inclusive)" }, "max": { "anyOf": [ { "type": "number" } ], "title": "Max", "description": "Maximum value (inclusive)" } }, "type": "object", "title": "NumericRangeFilter", "description": "Filter for numeric values (floats) with optional min/max bounds.\nUse for prices, volumes, ratios, and other decimal values. - Values between -10.5 and 100.75" } ], "description": "Total volume range filter in USD" }, "volume_in_usd": { "anyOf": [ { "properties": { "$ref": "#/paths/~1api~1v1~1profiler~1address~1counterparties/post/requestBody/content/application~1json/schema/properties/filters/anyOf/0/properties/total_volume_usd/anyOf/0/properties" }, "type": "object", "title": "NumericRangeFilter", "description": "Filter for numeric values (floats) with optional min/max bounds.\nUse for prices, volumes, ratios, and other decimal values. - Values between -10.5 and 100.75" } ], "description": "Volume in USD range filter" }, "volume_out_usd": { "anyOf": [ { "properties": { "$ref": "#/paths/~1api~1v1~1profiler~1address~1counterparties/post/requestBody/content/application~1json/schema/properties/filters/anyOf/0/properties/total_volume_usd/anyOf/0/properties" }, "type": "object", "title": "NumericRangeFilter", "description": "Filter for numeric values (floats) with optional min/max bounds.\nUse for prices, volumes, ratios, and other de" } ], "description": "Volume out USD range filter" } }, "type": "object", "title": "CounterpartiesFilters" } ], "description": "Filters for counterparties data" } }, "type": "object", "title": "CounterpartiesRequest" } } } } } } } } ``` -------------------------------- ### Fetch Smart Money Inflows (Python) Source: https://docs.nansen.ai/beta-nansen-api/getting-started/make-your-first-api-call This Python code snippet shows how to retrieve smart money inflows using the requests library. It details how to construct a POST request to the Nansen AI API, including authentication with an API key, specifying request parameters, and handling the JSON response. ```python import json import requests response = requests.post( "https://api.nansen.ai/api/beta/smart-money/inflows", headers={"apiKey":"YOUR_API_KEY","Content-Type":"application/json"}, data=json.dumps({ "parameters": { "smFilter": [ "180D Smart Trader", "Fund", "Smart Trader" ], "chains": [ "ethereum", "solana" ], "includeStablecoin": True, "includeNativeTokens": True, "excludeSmFilter": [] }, "pagination": { "page": 1, "recordsPerPage": 100 } }) ) data = response.json() ``` -------------------------------- ### PaginationRequest Description Source: https://docs.nansen.ai/getting-started/make-your-first-api-call Defines the parameters for paginating API results, including the current page number and the number of records to retrieve per page. ```json { "type": "object", "title": "PaginationRequest", "description": "Pagination parameters", "properties": { "page": { "type": "integer", "minimum": 1, "title": "Page", "description": "Page number (1-based)", "default": 1 }, "per_page": { "type": "integer", "maximum": 1000, "minimum": 1, "title": "Per Page", "description": "Number of records per page (max 1000)", "default": 10 } } } ``` -------------------------------- ### Get Transaction Data (Nansen API) Source: https://docs.nansen.ai/api/profiler/address-transactions This snippet demonstrates how to call the Nansen API to retrieve detailed transaction information, including token and NFT transfers. It requires specifying the blockchain chain and transaction hash. ```json { "openapi": "3.1.0", "info": { "title": "Nansen API", "version": "1.0.0" }, "tags": [ { "name": "Profiler", "description": "Wallet profiling and analysis" } ], "servers": [ { "url": "https://api.nansen.ai", "description": "Production server" } ], "security": [ { "ApiKeyAuth": [] } ], "components": { "securitySchemes": { "ApiKeyAuth": { "type": "apiKey", "in": "header", "name": "apiKey", "description": "API key for authentication" } } }, "paths": { "/api/v1/transaction-with-token-transfer-lookup": { "post": { "tags": [ "Profiler" ], "summary": "Get Transaction with Token Transfer Lookup Data", "description": "Get comprehensive transaction information including token transfers and NFT transfers.\n This endpoint provides detailed information about a specific transaction including\n native cryptocurrency movements, token transfers, and NFT transfers with USD values.", "operationId": "get_transaction_with_token_transfer_lookup_api_v1_transaction_with_token_transfer_lookup_post", "requestBody": { "content": { "application/json": { "schema": { "properties": { "chain": { "description": "Blockchain chain for the transaction lookup", "type": "string", "enum": [ "arbitrum", "avalanche", "base", "berachain", "blast", "bnb", "ethereum", "fantom", "hyperevm", "iotaevm", "linea", "mantle", "optimism", "ronin", "sei", "scroll", "sonic", "unichain", "zksync", "bitcoin", "ton", "tron", "starknet" ], "title": "TransactionLookupChain" }, "transaction_hash": { "type": "string", "title": "Transaction Hash", "description": "Transaction hash to lookup" }, "block_timestamp": { "type": "string", "title": "Block Timestamp", "description": "Timestamp of the transaction" } }, "additionalProperties": false, "type": "object", "required": [ "chain", "transaction_hash", "block_timestamp" ], "title": "TransactionLookupRequest", "description": "" } } }, "required": true }, "responses": { "200": { "description": "Transaction lookup data with token and NFT transfer information", "content": { "application/json": { "schema": { "properties": { "data": { "items": { "properties": { "chain": { "type": "string", "title": "Chain", "description": "The blockchain network of the transaction" }, "transaction_hash": { "type": "string", "title": "Transaction Hash", "description": "The unique identifier of the transaction" }, "from_address": { "type": "string", "title": "From Address", "description": "The hexadecimal address of the sender" }, "from_address_label": { "anyOf": [ { "type": "string" } ], "title": "From Address Label", "description": "The name or label associated with the sender's address" }, "to_address": { "type": "string", "title": "To Address", "description": "The hexadecimal address of the recipient" }, "to_address_label": { "anyOf": [ { "type": "string" } ], "title": "To Address Label", "description": "The name or label associated with the recipient's address" }, "native_value": { "anyOf": [ { "type": "number" } ], "title": "Native Value", "description": "The amount of native cryptocurrency transferred" }, "dated_native_price": { "anyOf": [ { "type": "number" } ], "title": "Dated Native Price", "description": "The price of the native cryptocurrency at the time of the transaction" }, "dated_native_value_usd": { "anyOf": [ { "type": "number" } ], "title": "Dated Native Value Usd", "description": "The USD value of the native cryptocurrency transferred at the time of the transaction" }, "current_native_price": { "anyOf": [ { "type": "number" } ], "title": "Current Native Price", "description": "The current price of the native cryptocurrency" }, "current_native_value_usd": { "anyOf": [ { "type": "number" } ], "title": "Current Native Value Usd", "description": "The current USD value of the native cryptocurrency transferred" }, "receipt_status": { "anyOf": [ { "type": "integer" } ], "title": "Receipt Status", "description": "The status of the transaction receipt (1 for success, 0 for failure)" }, "block_timestamp": { "type": "string", "title": "Block Timestamp", "description": "The timestamp of the block in which the transaction was included" }, "token_transfer_array": { "anyOf": [ { "items": { "properties": { "from_address": { "type": "string", "title": "From Address", "description": "From address" }, "from_address_label": { "type": "string", "title": "From Address Label", "description": "From address label" }, "to_address": { "type": "string", "title": "To Address", "description": "To address" }, "to_address_label": { "type": "string", "title": "To Address Label", "description": "To address label" }, "token_address": { "type": "string", "title": "Token Address", "description": "Token contract address" }, "token_symbol": { "type": "string", "title": "Token Symbol", "description": "Token symbol" }, "token_amount": { "type": "number", "title": "Token Amount", "description": "Token amount transferred" }, "dated_price_usd": { "anyOf": [ { "type": "number" } ], "title": "Dated Price Usd", "description": "Price of the token in USD at the time of the transaction" }, "dated_value_usd": { "anyOf": [ { "type": "number" } ], "title": "Dated Value Usd", "description": "The USD value of the token transferred at the time of the transaction" } } } } ], "title": "Token Transfer Array", "description": "An array of token transfer events associated with the transaction" } } } } } } } } } } } } } } ``` -------------------------------- ### Fetch Smart Money Netflow Data (Javascript) Source: https://docs.nansen.ai/getting-started/make-your-first-api-call This Javascript code snippet demonstrates how to fetch smart money netflow data from the Nansen AI API. It includes setting up the request method, headers with an API key and content type, and constructing a JSON body with filters for chains, smart money labels, and pagination. The response is then parsed as JSON. ```javascript const response = await fetch('https://api.nansen.ai/api/v1/smart-money/netflow', { method: 'POST', headers: { "apiKey": "YOUR_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ "chains": [ "ethereum", "solana" ], "filters": { "exclude_smart_money_labels": [ "30D Smart Trader" ], "include_native_tokens": false, "include_smart_money_labels": [ "Fund", "Smart Trader" ], "include_stablecoins": false }, "pagination": { "page": 1, "per_page": 10 }, "order_by": [ { "field": "chain", "direction": "ASC" } ] }) }); const data = await response.json(); ``` -------------------------------- ### Use Token Screener to Find New Tokens with Nansen API Source: https://docs.nansen.ai/beta-nansen-api/getting-started/usecase-templates/easy-level-usecases Discover new and trending tokens based on various metrics like market cap, token age, volume, and smart money activity. This helps in finding emerging opportunities. ```bash curl -L \ --request POST \ --url 'https://api.nansen.ai/api/v1/token-screener' \ --header 'apiKey: YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data '{ "chains": [ "ethereum", "solana", "base" ], "date": { "from": "2025-08-27T00:00:00Z", "to": "2025-09-03T23:59:59Z" }, "pagination": { "page": 1, "per_page": 10 }, "filters": { "token_age_days": { "max": 7 } }, "order_by": [ { "field": "market_cap_usd", "direction": "DESC" } ] }' ``` -------------------------------- ### Get Exchange Holders Source: https://docs.nansen.ai/api/token-god-mode/holders Retrieves a list of exchange holders for a token. This is achieved by setting the 'label' parameter to 'exchange' and including 'Exchange' in the 'includeLabels' array. Aggregating by entity is possible by setting 'isEntity' to true. ```json { "label": "exchange", "includeLabels": [ "Exchange" ], "isEntity": true } ```