Opensea api

From ProjectOpenSea/opensea-skill · View interactive version

Opensea api is an AI agent skill from the GitHub repository ProjectOpenSea/opensea-skill. Query OpenSea marketplace data via the official CLI, SDK, MCP server, or shell scripts. Get floor prices, collection stats, NFT details, token data, trending collections, drops, events, search, favorites, profile and collection settings, and other wallet-scoped operations. For trading use opensea-ma

How to use this skill

Skill file

OpenSea API

Read NFT, token, collection, drop, account and event data on every chain OpenSea supports, and run wallet-authenticated account operations.

| Need | Use instead |

|---|---|

| Buy, sell, list, make or accept offers, cancel orders | opensea-marketplace |

| Swap tokens | opensea-swaps |

| Set up a signing wallet | opensea-wallet |

| Build, register or gate an ERC-8257 tool | opensea-tool-sdk |

Setup

npm install -g @opensea/cli                  # or prefix commands with: npx @opensea/cli
opensea auth request-key --save --if-missing

request-key --save --if-missing caches an instant key in ~/.opensea/api_key (mode 600; $OPENSEA_CONFIG_DIR overrides the directory) and never prints it. It does nothing when OPENSEA_API_KEY is set or a key is already saved, so running it again reuses the key. A user's OPENSEA_API_KEY always wins and is never overwritten. The CLI uses --api-key, then OPENSEA_API_KEY, then that file, and the shell scripts fall back to the same file.

Without Node, run scripts/auth/opensea-resolve-key.sh >/dev/null from this skill's directory (opensea-api/) instead. It does the same: env key, else the cached key, else a new key saved to that file.

Always reuse a fetched key: fetching again on every request wastes the rate limit and can leave you with none. Instant keys expire after 7 days. On a 401 or 403 with a cached key, run opensea auth request-key --save once to replace it (without Node, scripts/auth/opensea-resolve-key.sh --force >/dev/null). On a 429 from the key endpoint, wait instead of looping. For higher limits, create a key at Settings → Developer.

Working rules

Common reads

| Task | Command |

|---|---|

| Collection details, stats, traits | opensea collections get <slug>, stats <slug>, traits <slug> |

| Trending or top collections | opensea collections trending [--timeframe <tf>] [--chains <c>], top [--sort-by <field>] |

| Floor history, holders, offer depth | opensea collections floor-prices <slug>, holders <slug>, offer-aggregates <slug> |

| NFTs in a collection | opensea nfts list-by-collection <slug> [--traits <json>] [--limit <n>] |

| One NFT, its owners, sale history | opensea nfts get <chain> <contract> <token_id>, owners ..., analytics ... |

| NFTs held by a wallet | opensea nfts list-by-account <chain> <address> |

| Refresh NFT metadata | opensea nfts refresh <chain> <contract> <token_id> |

| Best listings in a collection | opensea listings best <slug> [--traits <json>] |

| Best listing or offer for one NFT | opensea listings best-for-nft <slug> <token_id>, opensea offers best-for-nft <slug> <token_id> |

| All listings or offers | opensea listings all <slug> [--maker <addr>], opensea offers all <slug>, offers collection <slug> |

| Trait offers | opensea offers traits <slug> --type <t> --value <v> |

| Order by hash | opensea orders get <chain> <protocol_address> <order_hash> |

| Trending or top tokens | opensea tokens trending [--chains <c>], tokens top |

| Token details, price history, holders, pools | opensea tokens get <chain> <address>, price-history, ohlcv, holders, liquidity-pools |

| Token groups (one currency across chains) | opensea token-groups list, get <slug> |

| Search | opensea search <query> [--types collection,nft,token,account] [--chains <c>] |

| Resolve ENS, username or address | opensea accounts resolve <identifier> |

| Wallet portfolio, P&L, positions | opensea accounts portfolio <addr>, pnl <addr>, closed-positions <addr> |

| A wallet's listings, offers, collections | opensea accounts listings <addr>, offers <addr>, offers-received <addr>, collections <addr> |

| Events | opensea events by-collection <slug> [--event-type <t>], by-nft ..., by-account <addr>, list |

| Drops and stages | opensea drops list [--type featured\|upcoming\|recently_minted], drops get <slug> |

| Build a mint transaction | opensea drops mint <slug> --minter <addr> [--quantity <n>] [--token-id <id>] |

| Signals about a subject | opensea signals list --collection <slug> |

| Registered AI tools | opensea tools search --query <text>, tools list, tools get <chain> <registry> <id> |

| Any endpoint | opensea api request GET <path> [--params <json>] |

Event types: sale, transfer, mint, listing, offer, trait_offer, collection_offer. --traits takes a JSON array of {"traitType": "...", "value": "..."}, AND-combined.

Without Node, use scripts/opensea-get.sh <path> [query] and scripts/opensea-post.sh <path> <json> (paths relative to this skill's directory). They need only curl and the API key (OPENSEA_API_KEY, else the cached key). They exit non-zero on HTTP errors and retry 429 twice. Response bodies go to stdout, wrapped in --- BEGIN/END OPENSEA API RESPONSE --- markers on stderr. One-endpoint wrappers are listed in references/scripts.md.

Wallet-authenticated calls

Profile, favorites, watchlists, drop and collection management, order cancellation, signals posting and agent accounts act as a wallet. They need the API key plus a short-lived wallet JWT with the right scope.

opensea login --private-key --scopes read:favorites   # signs locally with OPENSEA_PRIVATE_KEY
opensea whoami
opensea auth scopes                                    # list scopes
opensea auth revoke                                    # when done

Call wallet-scoped endpoints with opensea api request <METHOD> <path>: it sends the stored JWT and refreshes it when expired. The CLI does not export that JWT, by design. Request the smallest scope set. A 403 means a missing scope: log in again with it instead of retrying. Flows, SDK usage and recovery rules are in references/authentication.md.

More

| Topic | Reference |

|---|---|

| Wallet login, PATs, JWTs, SDK auth | authentication.md |

| Creating and publishing drops, editing collection pages | creators.md |

| Signals, agent accounts, saved tools | social-and-agents.md |

| MCP server setup, tools and scopes | mcp.md |

| REST endpoints by family | rest-api.md |

| Real-time WebSocket events | stream-api.md |

| Shell script index | scripts.md |

| Tool registry REST parameters | CODE0 |

| Live OpenAPI spec | https://api.opensea.io/api/v2/openapi.json |

The SDK (@opensea/cli exports OpenSeaCLI, @opensea/sdk exports OpenSeaAPI) mirrors the CLI groups, for example client.collections.get(slug) and client.listings.best(slug, { traits }).

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.