Crypto API Tutorials:

How to connect the OpenSea API to Google Sheets

OpenSea is the first and largest peer-to-peer marketplace for cryptogoods (like an eBay for crypto assets), which include collectibles, gaming items, and other virtual goods backed by a blockchain.

We can use the OpenSea API to import data from OpenSea into Google Sheets. In this tutorial, I’ll show you how to connect the OpenSea API to Google Sheets in 5 steps:

  1. Install the Apipheny add-on
  2. Request an API Key
  3. Choose an OpenSea endpoint
  4. Enter Your OpenSea API request into Apipheny
  5. Run the OpenSea API request in your Google Sheet

Step 1.) Install and open the Apipheny add-on in Google Sheets

To pull data from the OpenSea API to Google Sheets, first install and open the Apipheny Google Sheets add-on.

Apipheny is a no-code API integrator for Google Sheets that you can use to make unlimited API requests, connect to unlimited APIs, save API requests, schedule API requests, and more. 

1. Install Apipheny by opening the following link on desktop and then clicking the Install button on the page: https://apipheny.io/install

2. After you’ve installed Apipheny, open a Google Sheet and then click on the Add-Ons or Extensions option in the top menu. In the add-ons menu, you should see Apipheny.

Click Apipheny > Import API to open the Apipheny sidebar in your Google Sheets.

open apipheny

Step 2.) Request an API Key

To be able to use the OpenSea API without restrictions, you need to request an API key. In your account, start by hovering over your Profile icon and select Settings:

On the left side of the page, click Developer:

Click Verify in profile to verify your email address:

Write the email address in your profile and click the Save button from the bottom of the page:

Click the Verify your email button from the email you received:

After verifying your email address, navigate back to the Developer section and click Get access.

Fill out your Organization NameWebsite, and Intended use of the OpenSea API, then click the Submit button:

You can create an API Key by clicking the Create API key button:

Write a name for your API key, then click the Create new key button:

Your API key is now created. Save it to a safe location because you’ll need it later:

Step 3.) Choose an OpenSea endpoint

In this section, we’ll show you how to browse the OpenSea API documentation to find the API endpoint that retrieves the information you need from your account. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 4.

First, open the OpenSea API documentation page: https://docs.opensea.io/reference/api-overview

The menu on the left contains links to overview pages for the OpenSea APIs, their objects and endpoints:

OpenSea documentation page
OpenSea documentation page

An example endpoint is Retrieving assets, which returns a list of digital items managed on the platform. The URL for this endpoint is:

https://api.opensea.io/api/v1/assets

The endpoint’s documentation contains the endpoint’s HTTP method (GET) and its URI, a list of the API calls you’ve made to it in the past, a description of the endpoint’s functionality and parameter usage, a table with the accepted parameters and their descriptions, as well as sample requests in Curl and in various programming languages:

Retrieving assets endpoint documentation
Retrieving assets endpoint documentation

The query parameters can be assigned values and you can press the Try It! button under the currently-selected sample request, to perform the call and see the response:

Try it! section for the endpoint part 1
Try it! section for the endpoint part 1

After you receive your API key, you can use the key for making API calls, by pasting it in the dedicated field from the HEADERS table, under the parameters:

 Try it! section for the endpoint part 2
Try it! section for the endpoint part 2

Base domains for API calls depend on the particular API you’re using:

OpenSea API base domains:
https://api.opensea.io/api/v1/ for the main OpenSea API
https://api.opensea.io/wyvern/v1/ for the OpenSea Orderbook API
https://rinkeby-api.opensea.io/api/v1/ for the OpenSea Rinkeby Test Network API

More OpenSea API endpoint examples

The Retrieve assets endpoint, which returns a set of NFTs based on the specified filter parameters.

Method: GET
API URL Path: https://api.opensea.io/api/v1/assets
Headers:
    Header 1 Key:
       X-API-KEY
    Header 1 Value:
       your API key, which you obtained in Step 2

The Retrieve listings endpoint, which fetches the set of active listings on a given NFT for the Seaport contract.

Method: GET
API URL Path: https://api.opensea.io/v2/orders/ethereum/seaport/listings
Headers:
    Header 1 Key:
       X-API-KEY
    Header 1 Value:
       your API key, which you obtained in Step 2

The Retrieve offers endpoint, which fetches the set of active offers on a given NFT for the Seaport contract.

Method: GET
API URL Path: https://api.opensea.io/v2/orders/ethereum/seaport/offers
Headers:
    Header 1 Key:
       X-API-KEY
    Header 1 Value:
       your API key, which you obtained in Step 2

The Retrieve collection offers (Beta) endpoint, which gets collection offers.

Method: GET
API URL Path: https://api.opensea.io/v2/offers/collection
Headers:
    Header 1 Key:
       X-API-KEY
    Header 1 Value:
       your API key, which you obtained in Step 2

OpenSea API pagination

Pagination is a process that is used to divide a large dataset into smaller chunks (pages). Usually the endpoints that return a list of resources support pagination. 

Some of the OpenSea API endpoints use the pagination option. This means you need to add pagination some of these parameters at the end of the URL:

  • next – a cursor to be supplied as a query param to retrieve the next page;
  • previous – a cursor to be supplied as a query param to retrieve the previous page;
  • limit – the maximum number of records that will be returned for each page.

Each endpoint that needs pagination will have in its documentation relevant information on which of these parameters you can use and how to do it.

Example:
https://testnets-api.opensea.io/v2/orders/goerli/seaport/offers?order_by=created_date&limit=40

If you use the URL above, you will receive a response containing a page of offers orders by created_date with a limit of 40 orders per page, and a value for the next parameter. That’s what you get when you first run the request.

To get the next page of orders (the next 40 records) you will add in your link the next parameter like this:

https://testnets-api.opensea.io/v2/orders/goerli/seaport/offers?order_by=created_date&limit=40&next=next_value

Don’t forget to replace next_value with the value for the next parameter that you obtained in the response from the first call.

For this second call, you will also get a previous parameter, because now the previous page is the first page, the current page is the second page and the next page is the third one.

Step 4.) Enter Your OpenSea API request into Apipheny

Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the Import tab. With the Import tab open, enter these details into the add-on:

Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) required by your API endpoint. For this example, we are using the GET method.

API URL: In Step 3, we explained how you can find the OpenSea REST API endpoint that you need. Now copy and paste your complete OpenSea API URL into the Apipheny add-on, where it says API URL Path, followed by any parameters required for your query (if applicable).

For this example, we are using the Retrieving a single contract endpoint, which returns details about a single contract managed on the platform. This is what the whole URL looks like:

https://api.opensea.io/api/v1/asset_contract/asset_contract_address

If you use this URL, you should replace asset_contract_address with the actual address of the contract for an NFT.

Headers: In the Headers section of Apipheny, add one row with the following key and value:

Header
Key:
X-API-KEY
Value:
your API key, which you obtained in Step 2
 OpenSea API request entered into Apipheny
OpenSea API request entered into Apipheny

Step 5.) Run the OpenSea API request in your Google Sheet

Finally, the last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the OpenSea API data to be imported into your Google Sheet. Here’s what our request looked like when completed:

OpenSea data imported into Google Sheets
OpenSea data imported into Google Sheets

That’s it! You’ve successfully connected your OpenSea account to Google Sheets using the OpenSea API, Google Sheets API, and the Apipheny add-on.

After making a successful request to the OpenSea API, try querying a different OpenSea API endpoint, or try using one of the more advanced features in the Apipheny add-on, such as:


Popular API Tutorials


API Knowledge

What is an API?

What is an API URL?

What are parameters?

What is an endpoint?

What is an API key/token?

What is basic authentication?

What are headers?

What is a GET request?

What is a POST request?