How to connect the KuCoin API to Google Sheets

Crypto API tutorials and more:


KuCoin is a large cryptocurrency exchange offering the ability to buy, sell, and trade cryptocurrencies. We can use the KuCoin API to import data from KuCoin into Google Sheets. In this tutorial, we’ll show you how to connect the KuCoin REST API to Google Sheets in 4 steps:

  1. Install the Apipheny add-on
  2. Choose a KuCoin API endpoint
  3. Enter your KuCoin API request into Apipheny
  4. Run the KuCoin API request in your Google Sheet

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

Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.

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.) Choose a KuCoin API endpoint

An endpoint is an API URL that returns the specific data you want from KuCoin. In this section, we will show you how to browse the KuCoin API documentation to find the URL that returns the specific data you need. If you’d like to see specific examples of URLs you can use, just skip to the next section.

To browse available endpoints and query requirements, go the KuCoin API documentation page here: https://docs.kucoin.com/#rest-api-2

All KuCoin endpoint URLs are created by appending an endpoint-specific path to the root URL: https://api.kucoin.com

There’s two types of endpoints available from the KuCoin API:

  1. Endpoints that do not require authentication (Public endpoints)
  2. Endpoints that do require authentication (Signed endpoints)

This tutorial covers how to use the public endpoints that do not require authentication. The only categories from the KuCoin API documentation that has public endpoints which require no API key are the Market Data endpoints and some of the Margin Trade endpoints.

Note: Signed KuCoin API endpoints that require HMAC SHA256 will not currently work with Apipheny, but endpoints that do not require HMAC SHA256 will work. Some KuCoin API endpoints require HMAC SHA256 and others don’t.

The reason signed endpoints don’t currently work with our app is because they require an additional parameter called signature, a keyed HMAC SHA256 signature with your secretKey as the key, and a concatenation of all the query’s parameters as the value passed to the HMAC operation.

Signed endpoints also require a timeStamp parameter, populated with the request’s millisecond timestamp. You can tell if an endpoint is signed or not because when you look at the documentation for that endpoint, it will say (Signature is required for this part.) next to the category title, as seen in the screenshot below:

Signature required section
Signature required section

Once you’ve looked through the KuCoin API documentation and chosen a public endpoint you want to use, you can go ahead and enter the URL into Apipheny and run your request.

In the next section, we cover making a request in more detail, along with some example requests.

Step 3.) Enter your KuCoin 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, POST, PUT, etc.) required by your API endpoint. For this example, we are using the GET method.

API URL: In Step 2, we explained how you can find the KuCoin REST API endpoint that you need. Now copy and paste your complete KuCoin 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 Part Order Book (aggregated), which gets a list of open orders for a symbol. This is what the whole URL looks like:

https://api.kucoin.com/api/v1/market/orderbook/level2_20?symbol=BTC-USDT

Headers: The Headers section of Apipheny should be left blank.

Just enter your API URL into Apipheny and click Run.

KuCoin API request entered into Apipheny
KuCoin API request entered into Apipheny

More Public Endpoint Examples

1.) The Get Mark Price endpoint, which gets the index price of the specified symbol. The URL for this endpoint is: https://api.kucoin.com/api/v1/mark-price/USDT-BTC/current

Get Mark Price endpoint
Get Mark Price endpoint

You can replace USD-BTC with other symbols.

2.) The Get Trade Histories endpoint, which gets the trade history for the specified symbol. The URL for this endpoint is: https://api.kucoin.com/api/v1/market/histories?symbol=BTC-USDT

Get Trade Histories endpoint
Get Trade Histories endpoint

You can replace USD-BTC with other symbols.

Step 4.) Run the KuCoin API request in your Google Sheet

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

KuCoin data imported into Google Sheets
KuCoin data imported into Google Sheets

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

After making a successful request to the Kucoin API, try querying a different KuCoin API endpoint, or try using one of the more advanced features in the Apipheny add-on.



Crypto API tutorials and more:


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?