MCPcopy Index your code
hub / github.com/ProjectOpenSea/opensea-js

github.com/ProjectOpenSea/opensea-js @v11.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v11.1.1 ↗ · + Follow
540 symbols 1,181 edges 112 files 227 documented · 42% 1 cross-repo links updated 2d agov11.2.0 · 2026-07-06★ 2,339
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Version npm Test CI Coverage Status License Docs Discussions

@opensea/sdk

This is the TypeScript SDK for OpenSea, the largest marketplace for NFTs and tokens.

It allows developers to access the official orderbook, filter it, create listings and offers, complete trades programmatically, and swap tokens across chains.

Get started by getting an API key and instantiating your own OpenSea SDK instance. Then you can create orders off-chain or fulfill orders onchain, and listen to events in the process.

Get an API key

For quick experimentation — request a free-tier key in code, no signup needed. The returned key is valid for 30 days and the endpoint is rate-limited to 3 keys per hour per IP:

import { OpenSeaSDK } from "@opensea/sdk";

const { api_key } = await OpenSeaSDK.requestInstantApiKey();
const sdk = new OpenSeaSDK(provider, { chain: Chain.Mainnet, apiKey: api_key });

Or from the shell:

curl -s -X POST https://api.opensea.io/api/v2/auth/keys | jq -r '.api_key'

For production — create a permanent key at opensea.io/settings/developer. These keys don't expire, get higher rate limits, and can be rotated from your account. See the API key docs for details.

Happy seafaring!

Quick Start

With ethers.js

import { ethers } from "ethers";
import { OpenSeaSDK, Chain } from "@opensea/sdk";

const provider = new ethers.JsonRpcProvider("https://eth-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY");
const sdk = new OpenSeaSDK(provider, { chain: Chain.Mainnet, apiKey: "YOUR_API_KEY" });

With viem

import { createPublicClient, createWalletClient, http } from 'viem'
import { mainnet } from 'viem/chains'
import { OpenSeaSDK, Chain } from '@opensea/sdk/viem'

const publicClient = createPublicClient({ chain: mainnet, transport: http() })
const sdk = new OpenSeaSDK({ publicClient }, { chain: Chain.Mainnet, apiKey: 'YOUR_API_KEY' })

Documentation

Security Warning

Do not use this SDK directly in client-side/frontend applications.

The OpenSea SDK requires an API key for initialization. If you embed your API key in frontend code (e.g., browser applications, mobile apps), it will be publicly exposed and could be extracted by anyone, leading to potential abuse and rate limit issues.

Recommended Architecture

For frontend applications that need to interact with OpenSea functionality:

  1. Create a backend API wrapper: Set up your own backend server that securely stores your OpenSea API key
  2. Call OpenSea SDK server-side: Use @opensea/sdk on your backend to interact with OpenSea's APIs
  3. Return data to your frontend: Send the necessary data (like transaction parameters) back to your frontend
  4. Execute transactions in the browser: Have users sign transactions with their own wallets (e.g., MetaMask) in the browser

Changelog

The changelog for recent versions can be found at:

  • @opensea/sdk: https://github.com/ProjectOpenSea/opensea-js/releases
  • OpenSea API: https://docs.opensea.io/changelog

Extension points exported contracts — how you extend this code

Fetcher (Interface)
(no doc) [1 implementers]
src/api/fetcher.ts
OpenSeaSigner (Interface)
(no doc) [1 implementers]
src/provider/types.ts
TestContext (Interface)
(no doc)
test/utils/runtime.ts
TestResponse (Interface)
(no doc)
test/api/fetcher.spec.ts
MockContextOptions (Interface)
(no doc)
test/fixtures/context.ts
EventData (Interface)
(no doc)
src/types.ts
RateLimitOptions (Interface)
(no doc)
src/utils/rateLimit.ts
BaseSDKConfig (Interface)
(no doc)
src/sdk/base.ts

Core symbols most depended-on inside this repo

getSdkForChain
called by 48
test/utils/setupIntegration.ts
get
called by 43
src/api/fetcher.ts
decodeTokenIds
called by 30
src/utils/protocol.ts
pluralize
called by 26
src/utils/stringHelper.ts
getOfferPaymentToken
called by 26
src/utils/chain.ts
post
called by 23
src/api/fetcher.ts
getRandomExpiration
called by 18
test/utils/utils.ts
createCollectionOffer
called by 18
src/sdk/base.ts

Shape

Method 264
Function 172
Class 46
Interface 46
Enum 12

Languages

TypeScript100%

Modules by API surface

src/api/api.ts87 symbols
src/api/apiPaths.ts77 symbols
src/sdk/base.ts34 symbols
src/api/types.ts30 symbols
src/sdk/orders.ts18 symbols
src/api/tokens.ts16 symbols
src/api/nfts.ts15 symbols
src/api/accounts.ts15 symbols
src/provider/ethers-adapter.ts14 symbols
src/provider/viem-adapter.ts13 symbols
src/api/collections.ts13 symbols
src/types.ts12 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add opensea-js \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page