How to Obtain a Kaggle API Key

kaggle
getting-started
tutorial
This tutorial provides a step-by-step guide to obtaining a Kaggle API key.
Author

Christian Mills

Published

May 17, 2023

Introduction

In this tutorial, I will guide you step-by-step to obtain a Kaggle API key, which you will need to access and download datasets from Kaggle using their API. This tutorial is suitable for beginners, even those who do not have a Kaggle account yet.

Create a Kaggle Account

  1. Visit Kaggle’s website at https://www.kaggle.com/

    kaggle-homepage

  2. Click on the Register button at the top-right corner of the page.

    kaggle-homepage-click-register-button

  3. Select the Register with your email option. Alternatively, you can sign up using Google, Facebook, or Yahoo accounts.

    kaggle-select-registration-method

  4. Fill in the required information, including your name, email, and password, then click Next.

    kaggle-enter-registration-info

  5. Click I agree to accept the Privacy and Terms agreement.

    kaggle-accept-privacy-and-terms-agreement

  6. Kaggle will email a six-digit code to verify your email address. Enter the code in the prompt and click Next to complete your account registration.

    kaggle-verify-email-with-six-digit-code

Sign in to Kaggle

  1. If you aren’t already signed in, click the Sign In button at the top-right corner of the Kaggle homepage.

    kaggle-homepage-click-sign-in-button

  2. Select the Sign in with your email option. Alternatively, you can sign in using Google, Facebook, or Yahoo accounts.

    kaggle-select-sign-in-method

  3. Enter your email/username and password, then click Sign In.

    kaggle-sign-in-page

Access your Kaggle Account Settings

  1. Click on your profile picture at the top-right corner of the page.

    kaggle-click-profile-picture

  2. In the popout menu, click the Settings option.

    kaggle-click-settings-menu-option

Generate Your Kaggle API Key

  1. Scroll to the API section in your Account settings and click the Create New API Token button.

    kaggle-account-settings-click-create-new-token

  2. Kaggle will generate a JSON file named kaggle.json and prompt you to save the file to your computer.

    kaggle-save-kaggle-json-file

  3. Download the kaggle.json file and save it to a secure location on your computer. This file contains your Kaggle API key and username.

Store the Kaggle API Key

Keep the kaggle.json file safe and secure, as it contains sensitive information. Remember to set the permissions for the kaggle.json file to be readable and writable only by you. Never share this file with anyone or upload it to public repositories.

If you plan to use the Kaggle API on your local machine, ensure the kaggle.json file is in the following location:

  • Windows:

    C:\Users\<username>\.kaggle\kaggle.json
  • Linux:

    ~/.kaggle/kaggle.json
  • macOS:

    /Users/<username>/.kaggle/kaggle.json

Conclusion

You have successfully obtained your Kaggle API key. You can now use it to download datasets from Kaggle using their API.

Questions:
  • Feel free to post questions or problems related to this tutorial in the comments below. I try to make time to address them on Thursdays and Fridays.

About Me:

I’m Christian Mills, a deep learning consultant specializing in practical AI implementations. I help clients leverage cutting-edge AI technologies to solve real-world problems.

Interested in working together? Fill out my Quick AI Project Assessment form or learn more about me.