🤖Vibecoding with Nansen API
(Nansen API + Cursor Agent)
This guide explains exactly what you must do to start building with the Nansen API inside Cursor. Follow the four steps below in order and you will have a working, AI‑powered development environment in minutes.
1 · Create your .env file
Generate an API key in the Nansen dashboard. Go to https://app.nansen.ai/account?tab=api, click Generate key, and copy the value.
Add the key and base URL to an .env file in the root of your project. Use the template below and replace your_api_key_here with the key you just copied.
# ---------- Nansen API ----------
apiKey=your_api_key_here
NANSEN_BASE_URL=https://api.nansen.ai/api/beta
# ---------- Optional : Rate‑limit + retry settings ----------
MAX_REQUESTS_PER_SECOND=20
MAX_REQUESTS_PER_MINUTE=500
RETRY_ATTEMPTS=3
TIMEOUT_MS=30000
# ---------- Optional : Default settings ----------
# Default blockchain to use when not specified
DEFAULT_CHAIN=ethereum
# Backup chain for cross-chain analysis
BACKUP_CHAIN=solana
# Default Smart Money filters (comma-separated)
DEFAULT_SM_FILTERS=180D Smart Trader,Fund,Smart Trader
# Default tgm/holders and tgm/flows filters
DEFAULT_HOLDER_LABEL=top_100_holders
2 · Tell Cursor what you are building
Create a file called .cursorrules in the project root.
Paste the short ruleset below. It contains the base URL, header format, and rate‑limit policy so Cursor can generate compliant code automatically.
# Nansen API rules for Cursor
BASE_URL: https://api.nansen.ai/api/beta
AUTH_HEADER: apiKey
RATE_LIMIT: 20req/s, 500req/min
# Token Address Discovery Rules
TOKEN_ADDRESS_SEARCH: When a token symbol is mentioned but no address is provided, automatically search the internet for the token's contract address on the relevant blockchain. Use patterns like "TOKEN_SYMBOL contract address blockchain_name" or "TOKEN_SYMBOL token address solscan etherscan".
# Search Triggers:
# - If user mentions token like "PENGU", "PEPE", "BONK" without address
# - If user asks to "monitor [TOKEN]" or "analyze [TOKEN]" without providing address
# - When implementing new token analysis features
# Search Sources Priority:
# 1. Solscan.io for Solana tokens
# 2. Etherscan.io for Ethereum tokens
# 3. CoinGecko for multi-chain token info
# 4. DexScreener for DEX-traded tokens
# Smart Defaults:
DEFAULT_CHAINS: ethereum, solana
DEFAULT_TIMEFRAMES: 1d, 7d, 30d
DEFAULT_PAGINATION: 50 records per page
DEFAULT_SM_FILTERS: "180D Smart Trader", "Fund", "Smart Trader"
# Automatic Actions:
MISSING_TOKEN_ADDRESS: Search internet immediately
INVALID_RESPONSE: Debug API call and suggest fixes
NEW_TOKEN_ANALYSIS: Look up token info and recent news
API_ERROR_400: Validate all parameters and suggest corrections
Save the file and reopen Cursor. The agent now has enough context to scaffold a working client when you ask for code.
3 · Ingest the Nansen docs with api-reference-md
Go to Cursor Settings -> Indexing & Docs
Click on Add Docs and use the URL below to index API Docs
https://docs.nansen.ai/nansen-api-reference.md
4 · Example prompts to give Cursor
Goal
Prompt
Analyse Smart Money behaviour
"List the top three tokens accumulated by Smart Money wallets in the last 24 hours.”
Monitor top holders of a token
“Who are the top holders of PENGU and track their recent PENGU activity”
Token Exchange Flow
"Any whales sending PENDLE to exchanges?"
Analyse smart money activity for a token
"Analyze smart money activity for FARTCOIN token - show holdings, recent trades, and inflows"
Feel free to iterate: start with one prompt, review the generated code, and then ask Cursor to extend or refactor it. Because it already knows about your .env, .cursorrules, and API Docs, you can focus exclusively on describing what the tool should do next.
Last updated
Was this helpful?