Your Guide to the OpenSea API

OpenSea API Overview

Learn more about OpenSea’s NFT API and developer platform

Intro to NFTs

NFTs, or non-fun­gi­ble to­kens, are digital items on the blockchain that are provably unique. Since its con­cep­tion, the as­set class has grown to in­clude col­lectibles in im­age, video, and au­dio for­mats, game items, digi­tal art, event tick­ets, do­main names, and even own­er­ship records for phys­i­cal as­sets. And the use cas­es con­tin­ue to grow. 

Most of¬≠ten tied to the Ethereum blockchain, NFTs rely on ERC-721 & ERC-1155 to¬≠ken standards, and if you build on the lat¬≠ter, al¬≠low for semi-fun¬≠gi¬≠bil¬≠i¬≠ty‚ÄĒ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. Re¬≠cent¬≠ly, there has also been talk of ‚Äúsoul¬≠bound‚ÄĚ 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.¬†

Mean­while, as the mar­ket for buy­ing & sell­ing NFTs con­tin­ues to grow to be­come an out­sized part of the Web3 space, with more than $41 billion in trading volume at the end of 2021, de­velop­ers are flock­ing to the space to build upon this unique as­set class. 

NFTs of­fer a unique op­por­tu­ni­ty for both application developers and smart con­tract devel­op­ers. Whether or not the projects you’re build­ing re­quire you to in­ter­face di­rect­ly with the blockchain, an im­por­tant re­quire­ment is be­ing able to ac­cess an in­dex of the NFT ecosys­tem, with de­tailed in­for­ma­tion about own­er­ship, col­lec­tions, and events. For smart contract devel­op­ers, equal­ly valu­able is the abil­i­ty to build na­tive NFT mar­ket­places through func­tion­al­ity that en­ables the buy­ing & sell­ing of NFTs. 

Open­Sea, the leading peer-to-peer marketplace for NFTs and other digital assets, ful­fills these key de­vel­op­er re­quire­ments through its API & SDK, a straight­for­ward to in­te­grate and use toolset that al­ready pro­vides the back­bone for most main­stream dApps that deal with NFTs to­day. But such a large por­tion of the mar­ket re­ly­ing on such a cen­tral­ized sys­tem isn’t with­out its prob­lems, especially as OpenSea’s platform has recently faced reliability issues, and there are sev­er­al vi­able al­ter­na­tives to Open­Sea’s API. 

What is OpenSea?

Open­Sea serv­es as a hor­i­zon­tal, peer-to-peer mar­ket­place for digi­tal goods, allowing users to buy, sell, and auction NFTs, rare digital items and crypto collectibles. For developers, OpenSea of­fers ex­ten­sive in­te­gra­tions and tool­ing for dApps in the NFT space. They in­dex and pro­vide the largest dataset of NFTs (hav­ing been around since the first projects were listed), and act as a sec­ondary mar­ket for pop­u­lar col­lec­tions and projects. 
‚Äć
Open­Sea sup­ports a num­ber of wide­ly-used to­kens and chains, and they are ac­tive­ly expand­ing that list. They sup­port both ERC-721 non-fun­gi­bles and ERC-1155 semi-fun­gi­bles, and are a mul­ti-chain plat­form, pro­vid­ing tool­ing for Poly­gon and Klaytn in ad­di­tion to Ethereum.
‚Äć
Along­side their mar­ket­place, Open­Sea’s API plat­form pow­ers third-par­ty tool­ing, with their REST API serv­ing as the back­bone of a num­ber of large projects in the Web3 com­mu­ni­ty, such as MetaMask, Coinbase Wallet, and Rainbow, among others.

OpenSea's Dev Platform

Open­Sea’s de­vel­op­er tool­ing con­sists of a REST API that en­ables developers to access and display metadata about NFTs, and a Soft­ware De­vel­op­ment Kit (SDK) that builds on top of the API to en­able the de­vel­op­ment that directly interfaces with the blockchain, such as for the creation of NFT marketplaces via the buying & selling of digital assets. The Open­Sea dev plat­form pro­vides a num­ber of key val­ue-adds.

For the application development via the API: 

  1. Straightforward process to showcase NFTs and collections on the frontend.
  2. Ac­cess to metadata about transactions, ownership and other details for each asset and collection in OpenSea’s database.
  3. The ability to monitor any user’s wallet for NFT transactions, and retrieve information about any user’s assets.
  4. Robust data management tools, including filtration and statistics by category.
  5. Open­Sea pro­vides com­pre­hen­sive doc­u­men­ta­tion that makes it easy to get started us­ing their API.

And for smart contract interaction via the SDK:

  1. Ac­cess to the largest com­mu­ni­ty in the space for col­lec­tors & sell­ers via Open­Sea’s ex­change con­tract.
  2. The ability to build e-commerce functionality that reads and writes to the blockchain without deploying your own contracts.
  3. Build native marketplaces for the buying & selling of NFTs with a wide range of features and payment structures.
  4. Open­Sea pro­vides built-in roy­al­ty sup­port through Roy­al­ty Reg­istry that is standard­ized across plat­forms.
  5. The Open­Sea SDK doc­u­men­ta­tion is reg­u­lar­ly up­dat­ed for com­pli­ance with the lat­est So­lid­i­ty standards.

1. API Tooling

The Open­Sea API pro­vides end­points for the fol­low­ing in­dexed mod­els on the Open­Sea plat­form: as­sets (in­di­vid­ual ERC-721/ERC-1155 to­kens), NFT col­lec­tions, events, or­ders, accounts, and as­set con­tracts. As part of the SDK func­tion­al­i­ty, the or­ders API al­lows for re­trieval (GET) and sub­mis­sion (POST) of NFT or­ders. Open­Sea pro­vides ac­cess to both Main­net & Test­net (via the Ethereum Rinkeby network) APIs so de­vel­op­ers can build and test with­out spend­ing real mon­ey.  

Some API end­points (orders & events) are gat­ed by Open­Sea to pre­vent mis­use. To build with these end­points, you can re­quest an API key here. 

Now, we’ll ex­plore Open­Sea’s API mod­els more close­ly, and dis­cuss the scope and func­tion of each. Pop­u­lar end­points & API calls are also pro­vid­ed be­low.

  1. Contracts
    ‚Äć
    A con¬≠tract is a de¬≠ployed smart con¬≠tract on the Ethereum net¬≠work. It is as¬≠so¬≠ci¬≠at¬≠ed with a sin¬≠gle own¬≠er ac¬≠count. 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
    ‚Äć
    As­sets rep­re­sent in­di­vid­ual to­kens emerg­ing from a con­tract. They can be owned by one or more ac­counts, and con­tain meta­da­ta about each asset. This data includes information about the asset’s ID, owner, name, and the contract it is contained within, as well as me­dia (the image url that the asset represents) and creator-defined traits. As­sets are how Open­Sea refers to NFTs.
  3. Orders
    ‚Äć
    An or­der is an ac­count-sub­mit­ted in­tent to buy/sell an as­set. It ex­ists off-chain, and has a type: bid or ask. It also con­tains meta­da­ta that is re­quired to match to NFTs on-chain. There are two par­tic­i­pants in an or­der: a mak­er, who makes liq­uidi­ty and acts as a first mover in a sale by declaring intent to sell or buy/bid on an item, and a tak­er, who takes liq­uid­i­ty and acts as the sec­ond 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 rep­re­sents a state-change on an as­set. There are on-chain events like trans­fers, sales, and mints, as well as off-chain events like bids and list­ings. Events can be private.
  5. Accounts
    ‚Äć
    Ac­counts rep­re­sent users on the Open­Sea mar­ket­place via their wal­let ad­dress­es and as­so­ci­at­ed user­names. They can own one or more as­sets, and act as makers or tak­ers in an or­der.
  6. Collections
    ‚Äć
    A col­lec­tion is a group­ing of the as­sets in one or more con­tract. They con­tain meta­da­ta such as roy­al­ty in­for­ma­tion and so­cial links, and they have one or more au­tho­rized ed­i­tors. Col­lec­tions ex­ist en­tire­ly off-chain. They are associated with metadata such as creator royalties and descriptions. Some pop­u­lar NFT col­lections in­clude Bored Ape Yacht Club, Cryp­to­P­unks, and Cryp­to Coven.

Some popular end­points & API calls in­clude:

  • Get/ Assets
    ‚Äʬ†Fetch¬≠es a list of to¬≠kens based on fil¬≠ter¬≠ing cri¬≠te¬≠ria (such as as¬≠set_¬≠con¬≠trac¬≠t_address or col¬≠lec¬≠tion_s¬≠lug)
  • GET /as¬≠set/:con¬≠trac¬≠t_ad¬≠dress/:to¬≠ken_id
    ‚Äʬ†Fetch¬≠es de¬≠tailed in¬≠for¬≠ma¬≠tion about a spe¬≠cif¬≠ic to¬≠ken, in¬≠clud¬≠ing a list of own¬≠ers for ERC-1155 to¬≠kens and all open or¬≠ders on a to¬≠ken.
  • GET /col¬≠lec¬≠tions
    ‚Äʬ†Fetch¬≠es a list of col¬≠lec¬≠tions. Also sup¬≠ports fil¬≠ter¬≠ing op¬≠tions, such as as¬≠set_own¬≠er.
  • GET /col¬≠lec¬≠tions/:slug/stats¬†
    ‚Äʬ†Fetch¬≠es sta¬≠tis¬≠ti¬≠cal in¬≠for¬≠ma¬≠tion about a spe¬≠cif¬≠ic col¬≠lec¬≠tion, in¬≠clud¬≠ing an up-to-date floor price.
  • GET /events
    ‚Äʬ†Fetch¬≠es a list of events based on fil¬≠ters.
    ‚Äʬ†Re¬≠quires an API key head¬≠er (X-API-KEY: {KEY}).
  • GET /or¬≠ders
    ‚Äʬ†Fetch¬≠es a list of or¬≠ders. Can be mod¬≠i¬≠fied with fil¬≠ter¬≠ing op¬≠tions like or¬≠der type or with a spe¬≠cif¬≠ic mak¬≠er or tak¬≠er.

You can find a complete list of the Open­Sea API calls & end­points here. 

2. SDK Tooling

Open­Sea’s SDK tool­ing is an npm pack­age avail­able for web de­vel­op­ers look­ing to build ecom­merce func­tion­al­i­ty into their ap­plications. Through the SDK Java­Script li­brary, you can build na­tive mar­ket­places for the buy­ing & sell­ing of NFTs with no need to de­ploy smart contracts or back­end or­der­books.  

Open­Sea’s SDK is backed by the REST API we ex­plored above, and em­ploys Web3.js (a popu­lar pack­age for EVM in­ter­ac­tions) to pow­er in­ter­ac­tions with the blockchain for the creation and fulfillment of NFT orders.

The SDK sup­ports func­tion­al­i­ty like fetch­ing as­sets, mak­ing of­fers, mak­ing list­ings & sell­ing items, run­ning crowd­sales, fetch­ing or­ders, buy­ing items, ac­cept­ing of­fers, and trans­fer­ring items or coins (gift­ing). 

It also of­fers an ad­vanced set of fea­tures that in­cludes the abil­i­ty to sched­ule fu­ture list­ings, pur­chase items for oth­er users, make bulk trans­fers of NFTs, cre­ate bun­dles of NFTs, use ERC-20 to­kens as pay­ment in­stead of Ether, cre­ate pri­vate auc­tions, share sale fees with Open­Sea, and lis­ten to events. 

It is easy to set up (via npm in­stall) and is in­te­grat­ed na­tive­ly with Open­Sea’s ex­change to di­rect­ly cre­ate and ful­fill buy/sell or­ders. 

You can in­stall and ex­plore the func­tion­al­i­ty of Open­Sea’s Java­Script SDK li­brary here.
‚Äć

Community Adoption & Perspectives

Open­Sea’s de­vel­op­ment plat­form has seen wide­spread adop­tion through­out the Web3 commu­ni­ty. It is in­te­grat­ed into prod­ucts such as Coin­base Wal­let, Meta­Mask, Rain­bow, 3Box, Opera Wal­let, Trust Wal­let, Ed­i­to­r­i­al, Bal­ance, Cryp­to­Goods, and most re­cent­ly, Twit­ter, when it added sup­port for NFT pro­file pho­tos. 

This near¬≠ly mar¬≠ket-wide re¬≠liance on Open¬≠Sea‚Äôs cen¬≠tral¬≠ized API in¬≠dex has proved to be problem¬≠at¬≠ic. In re¬≠cent weeks, Open¬≠Sea has un¬≠der¬≠gone a se¬≠ries of ‚Äúdata¬≠base out¬≠ages,‚ÄĚ and as a re¬≠sult, sev¬≠er¬≠al ser¬≠vices which rely on Open¬≠Sea‚Äôs APIs have been un¬≠able to dis¬≠play NFTs. Although this does not af¬≠fect the un¬≠der¬≠ly¬≠ing to¬≠kens or blockchain, it re¬≠sults in sus¬≠tained down time for all user-fac¬≠ing ser¬≠vices that rely on NFT data for the du¬≠ra¬≠tion of Open¬≠Sea‚Äôs out¬≠age.¬†

These out­ages have re­sult­ed in fur­ther con­ver­sa­tions about the lack of de­cen­tral­iza­tion across the ser­vices in the NFT space, and across the wider Web3 ecosys­tem. To this point, there are a few projects in the works that aim for var­i­ous lev­els of de­cen­tral­iza­tion of the NFT in­dex, but there are no ful­ly de­cen­tral­ized play­ers on the mar­ket yet.

Re­gard­less, re­cent events in­di­cate that de­vel­op­ers should con­sid­er the all the ma­jor NFT API providers be­fore mak­ing a de­ci­sion on whether to use Open­Sea. 

OpenSea Alternatives

Aside from Open­Sea, a few of the most wide­ly-used and full-fea­tured NFT APIs are de­tailed be­low. It is im­por­tant to note that there is cur­rent­ly no ser­vice that pro­vides an equiv­a­lent to Open­Sea’s SDK for the cre­ation of NFT mar­ket­places & as­so­ci­at­ed fea­tures. 

1. Alchemy NFT API

Alche­my, a Web3 de­vel­op­ment in­frastructure plat­form, recently an­nounced the launch of their NFT API, which al­lows ac­cess to NFT meta­da­ta across both ERC-721 and ERC-1155, in much the same way that Open­Sea does. It cur­rent­ly sup­ports ac­cess­ing meta­da­ta for NFTs on mul­ti­ple blockchains, find­ing an NFT’s own­er, and real-time in­for­ma­tion up­dates, among oth­er fea­tures. Alche­my’s API is avail­able on Mainnets for Ethereum, Polygon, and Flow, with planned support for others, starting with Solana and Avalanche, and Test­nets for Ethereum and Polygon. It currently powers NFT platforms like Adobe Behance, Shopify, Dapper Labs, and SuperRare, among others. 

You can read more about Alche­my’s NFT API here and find doc­u­men­ta­tion here. 

2. NFT Port

An­oth­er NFT API provider is NFT­Port, an NFT in­frastructure plat­form, that sup­ports fea­tures such as: 
‚Äʬ†Mint¬≠ing NFTs on the Poly¬≠gon chain.¬†
‚Äʬ†De¬≠ploy¬≠ing Open¬≠Sea-com¬≠pat¬≠i¬≠ble con¬≠tracts with sup¬≠port for dy¬≠nam¬≠ic NFTs, as well as planned sup¬≠port for programmatic roy¬≠al¬≠ty man¬≠age¬≠ment.¬†
‚Äʬ†Live-in¬≠dex¬≠ing and caching of NFT data, with on-chain trans¬≠ac¬≠tion/or¬≠der data.¬†
‚Äʬ†More ad¬≠vanced APIs that in¬≠clude mul¬≠ti-chain NFT search, NFT rec¬≠om¬≠menda¬≠tions, and coun¬≠ter¬≠feit NFT de¬≠tec¬≠tion.¬†
‚Äć
You can read more about NFT­Port here and find doc­u­men­ta­tion here. 

3. Uniswap Token Lists

For de­vel­op­ers that like the idea of a ful­ly-de­cen­tral­ized in­dex for NFT data, Uniswap’s To­ken Lists act as a mid­dle ground be­tween an Open­Sea-lev­el of central­iza­tion and per­son­al­ly-cu­rat­ed col­lec­tions of NFTs in­put by in­di­vid­ual users of the net­work into wal­lets. With Uniswap’s so­lu­tion, the com­mu­ni­ty can come togeth­er to list NFT col­lec­tions, cre­at­ing de­cen­tral­iza­tion and adding trust to the index­ing process. 

You can read more about Uniswap’s at­tempt to fur­ther de­cen­tral­ize NFT in­ter­faces here and make your own list of tokens here.

4. Fully decentralized indexing...someday soon?

In re­sponse to the re­cent Open­Sea out­ages, Dan Fin­lay, a founder of Meta­Mask, de­scribed some al­ter­na­tives to cen­tral­ized re­liance on Open­Sea here. 

In his post, he ar¬≠gues that: ‚Äúa bet¬≠ter so¬≠lu¬≠tion is to make as¬≠set de¬≠tec¬≠tion a client cen¬≠tric act of con¬≠sent.‚Ä̬†

‚Äć
Via EIP-747, Meta­Mask al­ready al­lows a site to sug­gest a cus­tom as­set to the user’s wal­let, with the wal­let be­com­ing the in­dex of as­sets, re­quir­ing no cen­tral server. Meta­Mask, it seems, in­tends to ex­pand this func­tion­al­i­ty to in­clude NFTs, cre­at­ing a ful­ly de­cen­tral­ized sys­tem that also im­proves per­for­mance.

As more and more such NFT APIs come to mar­ket, de­vel­op­ers are af­ford­ed more and more  choice, not only in the lev­el of de­cen­tral­iza­tion that works best for them and their projects, but also in se­lect­ing the provider of these ser­vices, re­sult­ing in few­er mar­ket-wide out­ages.  

Final Thoughts

Open­Sea’s De­vel­op­er Plat­form for NFTs is ro­bust, fully featured, and easy to de­ploy and use. It pro­vides ex­ten­sive data read-and-write fea­tures for de­vel­op­ers look­ing to en­ter the NFT space, whether or not they hope to interface directly with smart contracts. It is the lead­ing mar­ket provider of the NFT API ser­vice, and for good rea­son. 

While Open­Sea’s API it­self is rel­a­tive­ly re­li­able, the wide­spread de­pen­dence on the company's tool­ing means that if it fails, as in re­cent weeks, it will bring much of the NFT mar­ket down with it. To suf­fi­cient­ly de-risk the space, de­vel­op­ers should con­tin­ue to ex­plore a va­ri­ety of de­cen­tral­ized and cen­tral­ized op­tions to build their projects upon, and in­frastructure providers should work to match and com­pete with Open­Sea’s pow­er ful set of fea­tures.

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!

Supernode footer