Welcome to the Forum

Creating an account is currently only possible via registration at SimFin.

Specified API key is invalid error

edited December 2021 in Help/Support
I was trying to execute the following the below codes (copied from the basic tutorial) but kept getting errors 'ServerException: SimFin server error: The specified api key is invalid.' I have installed the simfin as well as have a valid key. What could be the cause of this? Does it not work with python 3.7 or above? Thanks!

import simfin as sf

# Set your SimFin+ API-key for downloading data.

# Set the local directory where data-files are stored.
# The directory will be created if it does not already exist.

# Download the data from the SimFin server and load into a Pandas DataFrame.
df = sf.load_income(variant='annual', market='us')

# Print the first rows of the data.

This is the full error...
Dataset "us-income-ttm" not on disk.
ServerException Traceback (most recent call last)

~\Anaconda3\lib\site-packages\simfin\load.py in load(dataset, variant, market, parse_dates, index, refresh_days)
131 # Download file if it does not exist on local disk, or if it is too old.
--> 132 _maybe_download_dataset(**dataset_args, refresh_days=refresh_days)
134 # Lambda function for converting strings to dates. Format: YYYY-MM-DD

~\Anaconda3\lib\site-packages\simfin\download.py in _maybe_download_dataset(refresh_days, **kwargs)
289 url = _url_dataset(**kwargs)
--> 291 return _maybe_download(name=dataset_name, path=path,
292 download_path=download_path,
293 url=url, refresh_days=refresh_days)

~\Anaconda3\lib\site-packages\simfin\download.py in _maybe_download(name, url, path, download_path, refresh_days)
237 # Download the file from the SimFin server.
238 # This is assumed to succeed unless an exception is raised.
--> 239 _download(url=url, download_path=download_path)
241 if download_path.endswith('zip'):

~\Anaconda3\lib\site-packages\simfin\download.py in _download(url, download_path)
166 # Raise exception with the error message from the server.
--> 167 raise ServerException(error)
169 # Or if another error occurred.

ServerException: SimFin server error: The specified api key is invalid.


  • Hi,

    it shouldn't be related to the Python version at all.

    Your API key is working fine for me (but you shouldn't post it here publicly in the forum, I edited your post now).

    If you still have problems, please write an e-mail to info@simfin.com
This discussion has been closed.