What is the OpenSea API?
Written by Alchemy Team
Reviewed by Brady Werkheiser
Intro to NFTs
NFTs, or non-fungible tokens, are digital items on the blockchain that are provably unique. Since its conception, the asset class has grown to include collectibles in image, video, and audio formats, game items, digital art, event tickets, domain names, and even ownership records for physical assets. And the use cases continue to grow.
Most often tied to the Ethereum blockchain, NFTs rely on ERC-721 & ERC-1155 token standards, and if you build on the latter, allow for semi-fungibility—the ability to create tokens that are exchangeable/fungible when minted, but become inexchangable/non-fungible upon redemption. Some examples of semi-fungible tokens include concert tickets, gift vouchers, and coupons. Recently, there has also been talk of “soulbound” NFTs that would be non-transferable upon acquisition, allowing individuals to verify their identity, confirm attendance at events, and hold distributed, participation-based governance rights in decentralized organizations (DAOs). Soulbound NFTs would serve to expand the NFT space beyond the social signaling and financial incentives that currently dominate as a result of the ability to trade these assets on secondary markets.
Meanwhile, as the market for buying & selling NFTs continues to grow to become an outsized part of the Web3 space, with more than $41 billion in trading volume at the end of 2021, developers are flocking to the space to build upon this unique asset class.
NFTs offer a unique opportunity for both application developers and smart contract developers. Whether or not the projects you’re building require you to interface directly with the blockchain, an important requirement is being able to access an index of the NFT ecosystem, with detailed information about ownership, collections, and events. For smart contract developers, equally valuable is the ability to build native NFT marketplaces through functionality that enables the buying & selling of NFTs.
OpenSea, the leading peer-to-peer marketplace for NFTs and other digital assets, fulfills these key developer requirements through its API & SDK, a straightforward to integrate and use toolset that already provides the backbone for most mainstream dApps that deal with NFTs today. But such a large portion of the market relying on such a centralized system isn’t without its problems, especially as OpenSea’s platform has recently faced reliability issues, and there are several viable alternatives to OpenSea’s API.
What is OpenSea?
OpenSea serves as a horizontal, peer-to-peer marketplace for digital goods, allowing users to buy, sell, and auction NFTs, rare digital items and crypto collectibles. For developers, OpenSea offers extensive integrations and tooling for dApps in the NFT space. They index and provide the largest dataset of NFTs (having been around since the first projects were listed), and act as a secondary market for popular collections and projects.
OpenSea supports a number of widely-used tokens and chains, and they are actively expanding that list. They support both ERC-721 non-fungibles and ERC-1155 semi-fungibles, and are a multi-chain platform, providing tooling for Polygon and Klaytn in addition to Ethereum.
Alongside their marketplace, OpenSea’s API platform powers third-party tooling, with their REST API serving as the backbone of a number of large projects in the Web3 community, such as MetaMask, Coinbase Wallet, and Rainbow, among others.
OpenSea's Dev Platform
OpenSea’s developer tooling consists of a REST API that enables developers to access and display metadata about NFTs, and a Software Development Kit (SDK) that builds on top of the API to enable the development that directly interfaces with the blockchain, such as for the creation of NFT marketplaces via the buying & selling of digital assets. The OpenSea dev platform provides a number of key value-adds.
For the application development via the API:
Straightforward process to showcase NFTs and collections on the frontend.
Access to metadata about transactions, ownership and other details for each asset and collection in OpenSea’s database.
The ability to monitor any user’s wallet for NFT transactions, and retrieve information about any user’s assets.
Robust data management tools, including filtration and statistics by category.
OpenSea provides comprehensive documentation that makes it easy to get started using their API.
And for smart contract interaction via the SDK:
Access to the largest community in the space for collectors & sellers via OpenSea’s exchange contract.
The ability to build e-commerce functionality that reads and writes to the blockchain without deploying your own contracts.
Build native marketplaces for the buying & selling of NFTs with a wide range of features and payment structures.
OpenSea provides built-in royalty support through Royalty Registry that is standardized across platforms.
The OpenSea SDK documentation is regularly updated for compliance with the latest Solidity standards.
1. API Tooling
The OpenSea API provides endpoints for the following indexed models on the OpenSea platform: assets (individual ERC-721/ERC-1155 tokens), NFT collections, events, orders, accounts, and asset contracts. As part of the SDK functionality, the orders API allows for retrieval (GET) and submission (POST) of NFT orders. OpenSea provides access to both Mainnet & Testnet (via the Ethereum Rinkeby network) APIs so developers can build and test without spending real money.
Some API endpoints (orders & events) are gated by OpenSea to prevent misuse. To build with these endpoints, you can request an API key here.
Now, we’ll explore OpenSea’s API models more closely, and discuss the scope and function of each. Popular endpoints & API calls are also provided below.
1. Contracts
A contract is a deployed smart contract on the Ethereum network. It is associated with a single owner account. Contracts are automatically executed when predetermined terms and conditions are met—in OpenSea’s case, they exist between the buyers and seller of an NFT collection, and are used to execute trades.
2. Assets
Assets represent individual tokens emerging from a contract. They can be owned by one or more accounts, and contain metadata about each asset. This data includes information about the asset’s ID, owner, name, and the contract it is contained within, as well as media (the image url that the asset represents) and creator-defined traits. Assets are how OpenSea refers to NFTs.
3. Orders
An order is an account-submitted intent to buy/sell an asset. It exists off-chain, and has a type: bid or ask. It also contains metadata that is required to match to NFTs on-chain. There are two participants in an order: a maker, who makes liquidity and acts as a first mover in a sale by declaring intent to sell or buy/bid on an item, and a taker, who takes liquidity and acts as the second mover in a sale by buying or accepting a bid on the item. Orders can be bundled within a specific collection.
4. Events
An event represents a state-change on an asset. There are on-chain events like transfers, sales, and mints, as well as off-chain events like bids and listings. Events can be private.
5. Accounts
Accounts represent users on the OpenSea marketplace via their wallet addresses and associated usernames. They can own one or more assets, and act as makers or takers in an order.
6. Collections
A collection is a grouping of the assets in one or more contract. They contain metadata such as royalty information and social links, and they have one or more authorized editors. Collections exist entirely off-chain. They are associated with metadata such as creator royalties and descriptions. Some popular NFT collections include Bored Ape Yacht Club, CryptoPunks, and Crypto Coven.
Some popular endpoints & API calls include:
Get/ Assets Fetches a list of tokens based on filtering criteria (such as asset_contract_address or collection_slug)
GET /asset/:contract_address/:token_id
Fetches detailed information about a specific token, including a list of owners for ERC-1155 tokens and all open orders on a token.
GET /collections
Fetches a list of collections. Also supports filtering options, such as asset_owner.
GET /collections/:slug/stats
Fetches statistical information about a specific collection, including an up-to-date floor price.
GET /events
Fetches a list of events based on filters.
Requires an API key header (X-API-KEY: {KEY}).
GET /orders
Fetches a list of orders. Can be modified with filtering options like order type or with a specific maker or taker.
You can find a complete list of the OpenSea API calls & endpoints here.
2. SDK Tooling
OpenSea’s SDK tooling is an npm package available for web developers looking to build ecommerce functionality into their applications. Through the SDK JavaScript library, you can build native marketplaces for the buying & selling of NFTs with no need to deploy smart contracts or backend orderbooks.
OpenSea’s SDK is backed by the REST API we explored above, and employs Web3.js (a popular package for EVM interactions) to power interactions with the blockchain for the creation and fulfillment of NFT orders.
The SDK supports functionality like fetching assets, making offers, making listings & selling items, running crowdsales, fetching orders, buying items, accepting offers, and transferring items or coins (gifting).
It also offers an advanced set of features that includes the ability to schedule future listings, purchase items for other users, make bulk transfers of NFTs, create bundles of NFTs, use ERC-20 tokens as payment instead of Ether, create private auctions, share sale fees with OpenSea, and listen to events.
It is easy to set up (via npm install) and is integrated natively with OpenSea’s exchange to directly create and fulfill buy/sell orders.
You can install and explore the functionality of OpenSea’s JavaScript SDK library here.
Community Adoption & Perspectives
OpenSea’s development platform has seen widespread adoption throughout the Web3 community. It is integrated into products such as Coinbase Wallet, MetaMask, Rainbow, 3Box, Opera Wallet, Trust Wallet, Editorial, Balance, CryptoGoods, and most recently, Twitter, when it added support for NFT profile photos.
This nearly market-wide reliance on OpenSea’s centralized API index has proved to be problematic. In recent weeks, OpenSea has undergone a series of “database outages,” and as a result, several services which rely on OpenSea’s APIs have been unable to display NFTs. Although this does not affect the underlying tokens or blockchain, it results in sustained down time for all user-facing services that rely on NFT data for the duration of OpenSea’s outage.
These outages have resulted in further conversations about the lack of decentralization across the services in the NFT space, and across the wider Web3 ecosystem. To this point, there are a few projects in the works that aim for various levels of decentralization of the NFT index, but there are no fully decentralized players on the market yet.
Regardless, recent events indicate that developers should consider the all the major NFT API providers before making a decision on whether to use OpenSea.
OpenSea Alternatives
Aside from OpenSea, a few of the most widely-used and full-featured NFT APIs are detailed below. It is important to note that there is currently no service that provides an equivalent to OpenSea’s SDK for the creation of NFT marketplaces & associated features.
1. Alchemy NFT API
Alchemy, a Web3 development infrastructure platform, recently announced the launch of their NFT API, which allows access to NFT metadata across both ERC-721 and ERC-1155, in much the same way that OpenSea does. It currently supports accessing metadata for NFTs on multiple blockchains, finding an NFT’s owner, and real-time information updates, among other features. Alchemy’s API is available on Mainnets for Ethereum, Polygon, and Flow, with planned support for others, starting with Solana and Avalanche, and Testnets for Ethereum and Polygon. It currently powers NFT platforms like Adobe Behance, Shopify, Dapper Labs, and SuperRare, among others.
You can read more about Alchemy’s NFT API here and find documentation here.
2. NFT Port
Another NFT API provider is NFTPort, an NFT infrastructure platform, that supports features such as:
• Minting NFTs on the Polygon chain.
• Deploying OpenSea-compatible contracts with support for dynamic NFTs, as well as planned support for programmatic royalty management.
• Live-indexing and caching of NFT data, with on-chain transaction/order data.
• More advanced APIs that include multi-chain NFT search, NFT recommendations, and counterfeit NFT detection.
You can read more about NFTPort here and find documentation here.
3. Uniswap Token Lists
For developers that like the idea of a fully-decentralized index for NFT data, Uniswap’s Token Lists act as a middle ground between an OpenSea-level of centralization and personally-curated collections of NFTs input by individual users of the network into wallets. With Uniswap’s solution, the community can come together to list NFT collections, creating decentralization and adding trust to the indexing process.
You can read more about Uniswap’s attempt to further decentralize NFT interfaces here and make your own list of tokens here.
4. Fully decentralized indexing...someday soon?
In response to the recent OpenSea outages, Dan Finlay, a founder of MetaMask, described some alternatives to centralized reliance on OpenSea here.
In his post, he argues that: “a better solution is to make asset detection a client centric act of consent.”
Via EIP-747, MetaMask already allows a site to suggest a custom asset to the user’s wallet, with the wallet becoming the index of assets, requiring no central server. MetaMask, it seems, intends to expand this functionality to include NFTs, creating a fully decentralized system that also improves performance.
As more and more such NFT APIs come to market, developers are afforded more and more choice, not only in the level of decentralization that works best for them and their projects, but also in selecting the provider of these services, resulting in fewer market-wide outages.
Final Thoughts
OpenSea’s Developer Platform for NFTs is robust, fully featured, and easy to deploy and use. It provides extensive data read-and-write features for developers looking to enter the NFT space, whether or not they hope to interface directly with smart contracts. It is the leading market provider of the NFT API service, and for good reason.
While OpenSea’s API itself is relatively reliable, the widespread dependence on the company's tooling means that if it fails, as in recent weeks, it will bring much of the NFT market down with it. To sufficiently de-risk the space, developers should continue to explore a variety of decentralized and centralized options to build their projects upon, and infrastructure providers should work to match and compete with OpenSea’s power ful set of features.
Regardless of what API developers choose, the NFT space is rapidly moving toward widespread adoption and sustained innovation as the ecosystem and tooling around this asset class continue to grow. There’s never been a better time to get started as a Web3 developer!
Related overviews
How to Find, Label, and Filter Spam NFTs with Alchemy's NFT API
Learn How Sellers Set Terms for NFT Sales and Buyers Finance NFT Purchases Over Time
Learn About NFT Minting Platforms and Their Benefits for Creators