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 for Google Sheets

Apipheny is a free API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to API data sources, easily.

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

2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.

In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.

open apipheny

Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new

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 API documentation page
OpenSea API documentation page

An example endpoint is Get Collection Stats, which returns the stats for a single collection. The URL for this endpoint is:

https://api.opensea.io/api/v2/collections/{collection_slug}/stats

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:

Get Collection Stats endpoint description
Get Collection Stats endpoint description

The path ( or query if that’s the case) 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:

The path parameters
The path parameters

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, in the right side:

The Headers section
The Headers section

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 Get Collection endpoint, which returns a single collection including details such as fees, traits, and links.

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

Don’t forget to replace {collection_slug} with an unique string to identify a collection on OpenSea.


The Get Traits endpoint, which returns the traits in a collection.

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

Don’t forget to replace {collection_slug} with an unique string to identify a collection on OpenSea.


The Get All Offers (by collection) endpoint, which gets all active, valid offers for the specified collection. This includes individual and criteria offers.

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

Don’t forget to replace {collection_slug} with an unique string to identify a collection on OpenSea.


The Get Order endpoint, which gets a single order, offer or listing, by its order hash. Protocol and Chain are required to prevent hash collisions..

Method: GET
API URL Path: https://api.opensea.io/api/v2/orders/chain/{chain}/protocol/{protocol_address}/{order_hash}
Headers:
    Header 1 Key:
       X-API-KEY
    Header 1 Value:
       your API key, which you obtained in Step 2

Don’t forget to replace {chain}, {protocol_address} and {order_hash} with real values according to the documentation.

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. 

Automatic pagination

Important: Before using the pagination settings for the first time, please make a single request without pagination to obtain the first page of results and the next page value:

In Apipheny, under the Headers section we have the automatic pagination settings. We have multiple type of pagination from where you can choose depending on your API:

OpenSea API uses cursor pagination, so we will select it from the drop-down list and we will complete the necessary fields:

  • Next Token Parameter Name value usually is the name of the last column. In this case is next.
  • Next Token Path is the value from that column. It will be a single value in the entire column from the previous page of results.
  • Run Until – At this option we choose Page Count Equals.
  • Page Count Limit Value – We choose 10 to import 10 pages.

Important: Use Append mode to not overwrite the first page of results before running the request with pagination.

Manual 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 Get Events endpoint, which returns a list of events based on before and after timestamps. This is what the whole URL looks like:

https://api.opensea.io/api/v2/events

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 request entered in the Apipheny add-on
OpenSea request entered in the Apipheny add-on

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 using the Apipheny add-on
OpenSea data imported into Google Sheets using the Apipheny add-on

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?

Import JSON to Google Sheets


SEO by SearchCyrus