← Protocols
OpenSea API
01Description

OpenSea's NFT marketplace REST API (v2) and the `opensea-js` SDK for listing, offering, and fulfilling Seaport orders across multiple EVM chains.

02Best for
  • 01NFT marketplace integrations
  • 02listing / offer creation
  • 03fetching collection + asset metadata
  • 04Seaport order fulfillment
  • 05portfolio / activity feeds
03Install
  • pnpm add opensea-js ethers
  • pnpm add @opensea/seaport-js # for direct Seaport order construction
04Environment variables
VariableScopeDescription
OPENSEA_API_KEYServerOpenSea API v2 key (apply via the OpenSea developer portal). Server-only — required for higher rate limits and for write endpoints.
NEXT_PUBLIC_OPENSEA_CHAINClientChain slug used in API paths: 'ethereum', 'matic', 'base', 'arbitrum', 'optimism', etc.
05Prompt snippet
Use OpenSea API v2 (base `https://api.opensea.io/api/v2/`) with header `x-api-key: OPENSEA_API_KEY`. Read endpoints: `GET /chain/{chain}/contract/{address}/nfts/{tokenId}`, `GET /collection/{slug}`, `GET /orders/{chain}/seaport/listings`. For listing/offer creation use `opensea-js`: `const sdk = new OpenSeaSDK(provider, { chain: Chain.Mainnet, apiKey: OPENSEA_API_KEY })`, then `sdk.createListing({ asset, accountAddress, startAmount, expirationTime })` or `sdk.createOffer(...)`. Fulfill orders with `sdk.fulfillOrder({ order, accountAddress })`. All orders are Seaport v1.6.
06Gotchas
  • Default unkeyed rate limits are very tight (a few requests per second); production apps must apply for an API key via the OpenSea form, and even then expect a per-key QPS ceiling.
  • Creator royalties on OpenSea are now enforced via the Operator Filter / fee schedule — listings that bypass royalties may be hidden from the OpenSea UI even though they remain valid Seaport orders on-chain.
  • Chain slugs in v2 are not always the chain ID (e.g. Polygon is `matic`, not `polygon`) — check the docs for the exact slug per chain.
  • Testnet endpoints are on a different base host (`https://testnets-api.opensea.io`) and require a separate API key.
  • Seaport v1.6 introduces new order types — make sure `opensea-js` is on a recent (>=7.x) version or order creation will fail signature validation.
  • Write operations (post listing/offer) require `OPENSEA_API_KEY` and a server-side signer; never expose the key in browser code.
07Alternatives