Query the OpenSea API from the command line or programmatically with @opensea/cli. Designed for both AI agents and developers.
What is @opensea/cli?
@opensea/cli is a command-line tool and TypeScript SDK for querying the OpenSea API. It supports collections, NFTs, listings, offers, events, search, tokens, swaps, drops, and accounts, with JSON, table, and TOON output formats.
Quick Start
Install globally:
npm install -g @opensea/cliOr use without installing:
npx @opensea/cli collections get mfersAuthentication
Set your API key via environment variable or flag:
export OPENSEA_API_KEY=your-api-key
opensea collections get mfers
# or pass inline
opensea --api-key your-api-key collections get mfersGet an API key at Settings -> Developer.
Examples
# Get collection details
opensea collections get mfers
# Get floor price and volume stats
opensea collections stats mfers
# List NFTs in a collection
opensea nfts list-by-collection mfers --limit 5
# Get best listings
opensea listings best mfers --limit 5
# Search across OpenSea
opensea search collections "cool cats"
# Get trending tokens
opensea tokens trending --limit 5
# Human-readable table output
opensea --format table collections stats mfersRequirements
- Node.js >= 18.0.0
- OpenSea API key (get one here)
Documentation
Full documentation including the commands reference, programmatic SDK, output formats, pagination, and examples is maintained in the GitHub repository:
github.com/ProjectOpenSea/opensea-cli
