🤖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.
Simply copy this prompt and paste it in Cursor to start vibecoing with Nansen API:
https://docs.nansen.ai/guides/vibecoding-with-nansen-api.md
Setup Nansen API in my project following the steps mentioned in this link
You need to:
1. Create a .env file
2. Generate cursorrules
3. Ingest API Docs
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
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 Configuration for Cursor
## Core Settings
BASE_URL: https://api.nansen.ai/api/beta
AUTH_HEADER: apiKey
RATE_LIMIT: 20req/s, 500req/min
## Authentication & Security
API_KEY_SOURCE: The API key is ALWAYS stored in the .env file as 'apiKey'
- NEVER ask users for API keys
- ALWAYS fetch the API key from the .env file
- Use `apiKey` variable from .env for all API calls
- Read the key value from .env for runtime execution
## Rate Limiting & Performance
- Implement exponential backoff for rate limit errors
- Cache frequently requested data when appropriate
- Monitor and log API usage patterns
# Token Analysis Automation
## Address Discovery Rules
TOKEN_ADDRESS_SEARCH: When a token symbol is mentioned without an address, automatically search the internet for the token's contract address on the relevant blockchain.
### Search Triggers:
- User mentions token symbol without providing contract address
- User asks to "monitor [TOKEN]" or "analyze [TOKEN]" without address
- When implementing new token analysis features
### Search Patterns:
Use search queries like: "TOKEN_SYMBOL contract address blockchain_name" or "TOKEN_SYMBOL token address solscan etherscan"
### Search Sources Priority:
1. Solscan.io for Solana tokens
2. Etherscan.io for Ethereum tokens
3. CoinGecko for multi-chain token information
4. DexScreener for DEX-traded tokens
5. Official project documentation/websites
## Default Parameters
DEFAULT_CHAINS: ethereum, solana
DEFAULT_TIMEFRAMES: 1d, 7d, 30d
DEFAULT_PAGINATION: 50 records per page
DEFAULT_SM_FILTERS: "180D Smart Trader", "Fund", "Smart Trader"
# API Interaction Standards
## Endpoint Compliance
ENDPOINT_RESTRICTION: ONLY use endpoints documented in the official Nansen API documentation
- Do NOT use undocumented endpoints
- Do NOT guess API paths or parameters
- Reference the official Nansen API documentation for all calls
- Validate endpoint availability before execution
## Parameter Validation Process
Before executing ANY API call:
1. Review API documentation to identify ALL required parameters
2. Cross-check user's request against documented required parameters
3. If ANY required parameter is missing, ask user to confirm/provide it
4. List all required parameters needing confirmation with descriptions
5. Do NOT make assumptions about missing required parameters
6. Do NOT provide default values for required parameters without user confirmation
7. Only execute after ALL required parameters are explicitly confirmed
8. Validate parameter types and formats against API documentation
## Error Handling
- API_ERROR_400: Validate all parameters and suggest corrections
- API_ERROR_429: Implement retry logic with backoff
- API_ERROR_500: Log error details and suggest alternative approaches
- INVALID_RESPONSE: Debug API call and suggest fixes
- Provide clear error messages with suggested solutions
## Response Formatting
- Present data in structured, readable formats
- Use tables for comparative data
- Highlight key metrics and insights
- Include data source timestamps
- Provide context for numerical values
# User Experience
## Command Execution Preferences
When users request API calls, intelligently choose between:
- **Simple cURL command**: For immediate, one-time execution
- **Python/JavaScript script**: For complex logic, reusable automation, or multi-step processes
### Decision Criteria:
- Single API call with simple parameters → cURL
- Multiple API calls or data processing → Script
- User explicitly requests specific format → Honor request
- Complex filtering/analysis required → Script
## Output Standards
- Always include execution instructions
- Include error handling guidance
- Show expected response formats
- Offer both technical and business interpretations
## Debugging Support
- Log API request/response details when errors occur
- Provide troubleshooting steps for common issues
- Include relevant documentation links
- Suggest parameter alternatives when validation fails
# Automation Intelligence
## Smart Actions
- NEW_TOKEN_ANALYSIS: Automatically look up token info and recent news
- MISSING_DATA: Suggest alternative data sources or timeframes
- PERFORMANCE_OPTIMIZATION: Recommend caching strategies for repeated queries
- TREND_ANALYSIS: Automatically identify and highlight significant patterns
## Quality Assurance
- Verify data consistency across multiple timeframes
- Cross-reference critical metrics with alternative sources
- Flag unusual patterns or potential data anomalies
- Provide confidence indicators for automated insights
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?