For the complete documentation index, see llms.txt. This page is also available as Markdown.

Solscan CLI

Query the Solscan API from the terminal, scripts, and CI, with structured output for agents.

Explore Solana on-chain data from the command line — accounts, tokens, transactions, NFTs, blocks, markets, and programs — with clean JSON by default (or human-readable tables for people). 59+ actions across the full Solscan Pro API v2.0

GitHub →

Get started

Step 1 — Install

The CLI runs on Node.js 18 or newer.

Install globally from npm:

Or run it without installing, using npx:

Verify the install:

Step 2 — Authenticate

First, get a Solscan API key from your API management page if you do not have one. Both free and paid (Pro) keys work — a paid key raises rate limits and unlocks the full endpoint set.

Save your key so every command picks it up:

The CLI resolves the key in priority order: the --api-key flag, then the SOLSCAN_API_KEY environment variable, then the stored config file. Confirm what's active with:

Step 3 — Run your first commands

Get trending tokens (JSON by default):

Look up an account's portfolio with USD values:

Switch any command to a readable table with --no-json:


Command reference

Commands follow solscan <resource> <action> [options], mirroring the Pro API. JSON is the default output; switch it with --no-json. List endpoints accept --page / --page-size (or --limit) for pagination.

Resource
Covers

account

Balances, transfers, DeFi activity, stake, rewards, portfolio, labels, CSV export

token

Metadata, holders, price, markets, transfers, DeFi activity, search

transaction

Full details, decoded actions, batch lookup, network fees

nft

Activities, collections, items, new mints

block

Latest blocks, block detail, block transactions

market

DEX pools, market info, historical volume, positions

program

Active programs, popular platforms, program analytics

monitor

API key compute-unit usage

For a resource's actions and every flag, run:

The full option reference lives in the README.


Practical workflows

Common tasks and the commands you would run for each.

Research a wallet

Check whether it's a known/labeled address, then read its holdings and activity:

Portfolio with USD values, low-quality tokens filtered out:

Large-value outgoing transfers only ($100–$999,999):

Swap history across direct and aggregator routes:

Analyze a token before trading

Confirm identity and price:

Check holder concentration — filter to large holders:

Find the deepest liquidity pools:

Filter raw transactions by instruction

transactions-enhanced returns raw transaction objects with full server-side filtering — by program, signer, token, time, slot, or a specific instruction. Filter a wallet's history to one program, successful only:

Target a single instruction by discriminator. The value is the program address plus the first 2 bytes (Shank IDL) or 8 bytes (Anchor IDL) of the instruction data, in hex:

Export history to CSV for tax or accounting

Each -export action returns up to 5000 rows (max 10 requests/min). Print to stdout, or save with --output:

Build scripts and agent workflows

JSON is the default, so piping into jq or an agent needs no flags:

Redirect a CSV export straight into a data pipeline:

Quick market overview


Output modes

JSON (default) — every command returns formatted JSON with a success flag and a data array, ideal for jq, Python, or an AI agent.

Human-readable — add --no-json for a table/text view meant for reading in the terminal.

Error handling

The CLI maps Pro API errors to clear messages and a suggested fix:

HTTP code
Meaning
Suggested action

400

Bad request

Check address format and enum values (type, page_size, range)

401

Authentication failed

Run solscan config set-api-key <KEY>

403

Insufficient permissions

Upgrade your API plan

429

Rate limit exceeded

Wait a moment and retry

500

Server error

Retry; report if it persists

If no key is configured, the CLI tells you to set one via solscan config set-api-key <KEY> or the SOLSCAN_API_KEY environment variable.

Last updated

Was this helpful?