✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

failed: Bad API Key [solved]

Sorry about the newbie question - I’m likely doing something simple incorrectly.
I signed up for a demo account (user=admin) at the Plotly site.
I regenerated my API key and copied it locally.
Via set_credentials_file I created the following file (I’ve x’d out the api_key):
“username”: “admin”,
“api_key”: “xxxxxxxxxxxxxxxx”,
“proxy_username”: “”,
“proxy_password”: “”,
“stream_ids”: []

However in a Python 3.6 environment:
plotly.plotly.sign_in(“admin”, key from credentials file)
fails with
plotly.exceptions.PlotlyRequestError: Bad API key

I tried another key regeneration with the same problem.

Finally, when trying to create an online chart via py.plot() without a manual sign_in, I get:
plotly.exceptions.PlotlyRequestError: Aw, snap! You tried to use our API as the user ‘admin’, but the supplied API key doesn’t match our records. You can view your API key at https://plot.ly/settings/api

I’m pretty sure my copy and paste of the key was correct both times. Is there anything else that could be wrong?


This was my confusion between the instructions for accessing a demo On-Premise account, and a personal account. Everything is working correctly now.