What is Kaggle API Key? How to get my Kaggle Key?

What is Kaggle Key?

Have you tried using Kaggle Datasets? If you directly want to use a Kaggle Dataset you might be asked for a Kaggle Username and Kaggle Key. This is Kaggle's way of verifying a user trying to access their Data. The `opendatasets` library uses the Kaggle Official API Key for downloading datasets from Kaggle.

How to get my Kaggle Key?

Kaggle Credentials

Follow these steps to find your API credentials:

  1. Sign in to https://kaggle.com/, then click on your profile picture on the top right and select “My Account” from the menu.
  2. Scroll down to the “API” section and click “Create New API Token”. This will download a file kaggle.json with the following contents:
{"username":"YOUR_KAGGLE_USERNAME","key":"YOUR_KAGGLE_KEY"}
  1. When you run opendatsets.download, you will be asked to enter your username & Kaggle API, which you can get from the file downloaded in step 2.

Note: You need to download the kaggle.json file only once.
Note: The key might be expired/invalid after months of inactivity. If you get any similar error like the Key is invalid/Access Denied for the API you might need to re-download the new Kaggle Key and use it.

Source → GitHub - JovianML/opendatasets: A curated collection of datasets for data analysis & machine learning, downloadable with a single Python command

2 Likes