Moralis Plugins OpenSea getAsset 403 Error

Hey everyone!

I’m preparing a rarity tool for a collection following your tutorial and I’m integrating the Moralis.Plugins.opensea.getAsset method to get asset prices, but I’m getting a 403 access denied error. :spider:Error image below.

Here’s the snippet of code:

 Moralis.initPlugins()

    const test =
      await Moralis.Plugins.opensea.getAsset({
          network:'mainnet',
          tokenAddress: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d' , 
          tokenId:'220'
        })
      ;

Setting an OS API key is optional in Moralis Server, but does this error is telling me otherwise. Does this mean an OS API Key is now required or am I missing something?

:spider:Error Image
image

Thanks!

in mainnet it doesn’t work and I heard that it is not easy to get a key

1 Like

After I read your answer I tried testnet and its returning a 404 error. I’m guessing the solution is to wait for OpenSea to get their APIs straightened out. Thanks for the quick reply!

I was expecting testnet to work

1 Like

Getting the same error with mainnet (with and without OS Api Key). Tried get asset function for BAYC token id 1204

2022-02-04T06:18:01.818Z - Ran cloud function opensea_getAsset for user undefined with:
  Input: {"network":"mainnet","tokenAddress":"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d","tokenId":"1204"}
  Result: {"status":502,"data":{"error":true,"data":{"code":500001,"message":"No asset found","details":{"method":"getAsset","network":"main","tokenAddress":"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d","tokenId":"1204","error":"API Error 403: Unauthorized.

With Testnet (Rinkerby) I have no issue getting the response. No OS API Key needed.

This looks like an issue from Opensea?

1 Like

do you have an api key for open sea on mainnet? and it doesn’t work with that either?

1 Like

Yes, I do have an API key for Opensea, and still get the error.

1 Like

This is an error coming from opensea. We wrote to them and we are waiting for an answer.
Nothing we can do on our side.

1 Like

I assumed so. I’ve been using the OpenSea API since last year and I have an old API key, but its not working the same. I concluded that OpenSea is making a lot of changes behind the scenes and many platforms are being affected.

Thanks everyone! :fire:

1 Like

you can be very rich if you sell that API Key :smiley:

2 Likes

This is now working for ‘mainnet’ and ‘testnet’. I’m currently using mainnet without problems. Thanks for all the replies! :fire::zap:

1 Like

Although this still works for me testing for assets on the Ethereum blockchain, it’s currently not working for the polygon blockchain. I’ve been doing tests for poly assets the past few days and am getting 404/403 errors. I’m sure the assets exist in the polygon mainnet, considering I collected the data using Moralis.Web3API.token.searchNFTs(options).

The main problem right now is that OpenSea is developing their polygon API, so all requests to polygon data will be problematic for a while. :paperclip: