# Kaggle API
- Goal: Enable download kaggle competitions data by kaggle API
- Reference: [<i class="fa fa-book fa-fw"></i> Kaggle API](https://github.com/Kaggle/kaggle-api)
Step 1: install kaggle
---
for linux users
```
pip install --user kaggle
```
Step 2: add kaggle to PATH
---
the default location of kaggle is `~/.local/bin`
1. modify `~/.bashrc`
```
nano ~/.bashrc
```
2. add the path to any row
```
export PATH=$PATH:/home/username/.local/bin/
```
3. set path
```
source ~/.bashrc`
```
Step 3: API credentials (modified from reference)
---
To use the Kaggle API, sign up for a Kaggle account at https://www.kaggle.com. Then go to the 'Account' tab of your user profile (https://www.kaggle.com/<username>/account) and select 'Create API Token'. This will trigger the download of kaggle.json, a file containing your API credentials. Place this file in the location
```
~/.kaggle/kaggle.json
```
For your security, ensure that other users of your computer do not have read access to your credentials. On Unix-based systems you can do this with the following command:
```
chmod 600 ~/.kaggle/kaggle.json
```
###### tags: `Kaggle API`