Cannot get Api Key


I am trying to connect my conbee II stick to homeassitant. However I am facing the issue that I guet the error couldn’t get API key.

Previously this was working fine but suddenly the integration highlighted it cannot connect to the gateway under the correct URL.

I have tried to access the URL below to check whether I can access the deconz api via the webbrowser:

When I do this I get the following error:
[{“error”:{“address”:"/",“description”:“unauthorized user”,“type”:1}}]

I have tried this with allowing phoscon to connect to a new app and without. However I am always getting this error and I am not sure how to resolve this.

At the same time I am not sure how I would be able to specify a user!?

I would be very grateful if someone could help me to resolve this issue pointing me in the right direction and get homeassistant up and running with deconz again.

Thanks for your help!

Hello, you are trying to get a new api key ?

This url, always give this result [{“error”:{“address”:"/",“description”:“unauthorized user”,“type”:1}}]

You need to make a POST request Getting Started - deCONZ REST-API with a body

Can make with cUrl

curl http://IP:PORT/api/ -X POST -d '{"devicetype": "TestKey"}'

Hello Samra,

thanks for your help and your hint that already helps me.
I think I am getting closerr to solve my issue.

Correct I am trying to add the deconz integration to Homeassistant.
previously this was working fine without any issue. However it suddenly stopped working and Homeassistant cannot connect to the gateway anymore. Hence I am setting up the integration once more, but Homeassistant cannot retrive the apit key.

I made the curl request as suggested by you when the gateway is unlocked (authenticate app pressed). this seems to fail with the following error:

running the command in postman gives the following error:
“error”: {
“address”: “/”,
“description”: “body contains invalid JSON”,
“type”: 2

using command prompt:
[{“error”:{“address”:"/",“description”:“body contains invalid JSON”,“type”:2}}]curl: (3) unmatched close brace/bracket in URL position 8:

Do you have any further hint for me on this?

Thanks for your support!

Use copy/pasete , you forget a " on the command prompt

Using postman, remove the space {"devicetype":"TestKey"} you have a typo in the body (it’s the json)

just a short update - I got it working now with postman - I added the ffolling arguments to postman:
{“devicetype”: “TestKey”}

I now get the feedback:
“success”: {
“username”: “693E3CAA6D”

However if I am trying to get an apikey with Homeassitant or Alexa it still fails and the applications cannot access the gateway.

same issue if I try the curl command via the ‘command prompt’

IDK how work alexa or HA, but you can use this api key now 693E3CAA6D, all applications can use same.

okay, then I basically need to find out how I can set up the integration manually and insert the api key I retrieved!?

In theory, IDK how work alexa or HA, but an api key is not reserved to an application.

Hey Hfink,
I have the same problem. The API-Key is there but I have no idea how to use it to connect it with my HA. In the log the only error is “discovery network reply error: Host not found” Is this a problem?
And did you find out something in the meantime?

Hey Blue,

I think you might have another issue.
Usually Home Assistant is retrieving the api key automatically. I have no idea why this wasn’t working for me, but luckily it’s back up and running.

When setting up the deconz integration in home assistant you must specify the following:

Host: - IP Adress of the deconz gateway.
Port: xxxx

You can find both of these information when you are accessing the Phoscon app via a browser.

The adreess will look something like this:,11,6,10&gwid=00212EFFFF04E12B - host in your deconz integration setup
yyyy - port in your deconz integration setup

I hope that information helps you and you can get it working.

Good luck

On your side it’s a discovery issue.
Deconz connect itself to an external adresse, and this url is used later by apps, can take a look youself here

The host can be OOF when you have done the request or can be a firewall rule.

It’s not a problem, some users disable this feature, but some setting will be not automatic (like the deconz API IP), and need to be done manualy without it.