# Sign-in failed: Bad API Key \[solved\]

**URL:** <https://community.plotly.com/t/sign-in-failed-bad-api-key-solved/15600>\
**Category:** 📊 Plotly Python\
**Created:** [November 13, 2018, 3:13pm UTC](https://community.plotly.com/t/sign-in-failed-bad-api-key-solved/15600 "2018-11-13T15:13:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmiller](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dmiller](https://community.plotly.com/u/dmiller)\
**Post date:** [November 13, 2018, 3:13pm UTC](https://community.plotly.com/t/sign-in-failed-bad-api-key-solved/15600/1 "2018-11-13T15:13:36Z")

</div>

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](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?

Thanks

* * *

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