---
updatedAt: 2026-09-24T05:30:09.000Z
agentTools:
  projectIndex: https://docs.opensea.io/llms.txt
---

# CLI

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:

```bash
npm install -g @opensea/cli
```

Or use without installing:

```bash
npx @opensea/cli collections get mfers
```

### Authentication

Use an API key for public marketplace data:

```bash
export OPENSEA_API_KEY=your-api-key
opensea collections get mfers

# or pass inline
opensea --api-key your-api-key collections get mfers
```

Get an API key at <Anchor label="Settings -> Developer" target="_blank" href="https://opensea.io/settings/developer">Settings -> Developer</Anchor>.

Wallet-specific endpoints also need a scoped wallet JWT. For interactive use, sign in with OAuth:

```bash
opensea login --scopes read:favorites
opensea auth status
opensea whoami
```

For a server-side agent, keep the private key in an environment variable and sign in headlessly with SIWE:

```bash
export OPENSEA_PRIVATE_KEY="..."
opensea login --private-key --scopes read:eligibility
```

The CLI stores the resulting credentials in `~/.opensea/auth.json` with file mode `0600`. It does not store the private key. Use `opensea auth refresh` to renew the short-lived JWT and `opensea auth revoke` to revoke the underlying PAT and clear the local credential.

See [Authentication](https://docs.opensea.io/reference/auth) for credential types, scopes, and the manual REST flow. Never pass a private key as a command argument or include keys, tokens, cookies, signatures, or authorization headers in logs.

### Examples

```bash
# 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 "cool cats" --types collection

# Get trending tokens
opensea tokens trending --limit 5

# Human-readable table output
opensea --format table collections stats mfers
```

### Requirements

* Node.js >= 18.0.0
* OpenSea API key for public REST data ([get one here](https://docs.opensea.io/reference/api-keys))

### Documentation

Full documentation including the commands reference, programmatic SDK, output formats, pagination, and examples is maintained in the GitHub repository:

<Anchor label="github.com/ProjectOpenSea/opensea-cli" target="_blank" href="https://github.com/ProjectOpenSea/opensea-cli">github.com/ProjectOpenSea/opensea-cli</Anchor>

### Links

* <Anchor label="GitHub Repository" target="_blank" href="https://github.com/ProjectOpenSea/opensea-cli">github.com/ProjectOpenSea/opensea-cli</Anchor>
* <Anchor label="npm Package" target="_blank" href="https://www.npmjs.com/package/@opensea/cli">@opensea/cli on npm</Anchor>