15. Nansen CLI
Nansen CLI brings Nansen data into the terminal for developers, power users, and AI agents. It is especially useful when you want a fast, scriptable workflow without depending on the browser UI.
Installation
npm install -g nansen-cli
If you are using an AI-agent environment, you can also load the related skill files:
npx skills add nansen-ai/nansen-cli
Authentication
Use one of the following methods:
nansen login --api-key <key>
nansen login --human
export NANSEN_API_KEY=...
nansen logout
The environment variable has the highest priority and is often the best choice for scripts and servers.
Command groups
nansen research <category> <subcommand>nansen trade <subcommand>nansen wallet <subcommand>nansen schema [command] [--pretty]
Research categories include smart-money, token, profiler, portfolio, prediction-market, search, perp, and points.
Important options
--chain <chain>to choose the network--limit <n>to constrain output--timeframe <tf>for time windows such as 24h or 7d--fields <list>to keep responses compact--sort <field:dir>to order the output--tablefor quick visual output--prettyfor readable JSON--streamfor large datasets
Practical examples
Smart Money net flow on Solana
nansen research smart-money netflow --chain solana --timeframe 24h --limit 10 --table
Analyze a known wallet by ENS
nansen research portfolio show --address vitalik.eth --pretty
Reduce output size for agent workflows
nansen research smart-money netflow --chain solana --fields token_symbol,net_flow_usd --limit 10
How to read responses
A successful response uses a standard wrapper:
{"success": true, "data": {}}
Errors look like this:
{"success": false, "error": "message", "code": "UNAUTHORIZED", "status": 401}
Important error codes to remember:
CREDITS_EXHAUSTEDUNAUTHORIZEDRATE_LIMITEDUNSUPPORTED_FILTER
Best practices
- Use
nansen schema --prettybefore exploring a new command - Limit payload size with
--fieldswhen using LLM or agent workflows - Use
--streamfor large outputs - Prefer environment variables in production environments
Reference
- Invite link: https://nsn.ai/7LOuQVx1Jvh