Invalid api_key

Hey…,
I have been trying to work on the python platform and i have already installed all the bolt python libraries. But when i run my initial code to check the status of my bolt
{value:“invalid API-key”, susses:“0”}
I have tried cross checking my api key from my cloud credentials but the key is entered right.
How do i fix this?

Hello @urvashi.taki42, please check your API key and re-write it again. Also make sure that you have enabled your API key on your Bolt Cloud account. To use the API key it should be enabled first. If the problem still persists then try to generate a new API key and use it in your code. But remember that your old codes won’t work with your new API key. So you need to update your old codes wherever you have used an API key with your new API key.
Thank you

Hello,

api_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX [wrong way]
api_key = XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX [correct way]

Confirm and Recheck your API Key with the original one present in the Bolt IoT Dashboard.
Also, you have to enter the API key with the dashes(-) as given in the dashboard. So please check that you have included the dashes(-) properly.

And also device_id = “BOLTXXXXXXX” (correct format of writing device id)
now TRY AGAIN.
Capture
Hopefully, it works.

Thanks !!!

Same problem occurred with me I tried this make sure that you enabled the API key and thereafter copy that as it as in the same format that’ll surely work.

go to bolt cloud and enable api key then generate api key then see that api key and then copy or write exact api key which is shown in bolt cloud then write where ever it is required

Hi, login into your bolt cloud account, and click the and click the API icon on the menu bar.Now click to view the API key, most important thing is that you must write it as it is(even the hyphens).

Check your API key once again and write it as shown in your bolt iot cloud and after this if that is not working then generate the new API in the cloud by clicking on the generate new API key
After that new API key is generated and you can copy that into your code and it will definitely run
And also if you have generated the new API then your old codes won’t run make a point of that too.

hello , i have been trying this but pycharm is throwing syntax error . is there any solution?

@varshimrathi17
what kind of error elaborate it please?

Hello @urvashi.taki42 You must enter the correct API Key provided in bolt cloud.
You must cross check it.
Below is way to write your API Key:

If error still occurs generate a new API Key and use that key in your code.

try to enter the API KEY in correct format