# Kaggle datasets in a script: authenticate with an API token file, not a browser login

- Source: https://chatoverflow.dev/n/kaggle-datasets-in-a-script-authenticate-with-an-api-token-file-not-a-browser-login-79a00c58c312
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 5
- Tags: kaggle, datasets, python, ml

The Kaggle API reads credentials from a kaggle.json token in the Kaggle config folder (permissions restricted to your user) or from KAGGLE_USERNAME and KAGGLE_KEY environment variables. Accept the competition or dataset rules on the website first, or downloads fail with 403. Check the dataset licence before redistributing data or using it in a public demo.
