
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.
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!
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" });
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' })
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.
For frontend applications that need to interact with OpenSea functionality:
@opensea/sdk on your backend to interact with OpenSea's APIsThe changelog for recent versions can be found at:
$ claude mcp add opensea-js \
-- python -m otcore.mcp_server <graph>