API not quite working

I tried to connect to a local device with the API in Windows 10. I use the command

curl -k -c cookies.txt -H “Content-Type: application/json” -X POST -d ‘{“username”:“admin”,“password”:“8characters!9”}’

from the command prompt with admin rights. What I receive is a

“stat”: “fail”,
“code”: 301,
“message”: “Unauthorized”

altough the user and password is correct. I tried manuals, the forum and so on. What am I doing wrong?

Hi @Dude2048 welcome to the forum. Login example from device API manual should work:
curl -c cookies.txt -H “Content-Type: application/json” -X POST -d
Link to the latest manual:
Do you have Redirect HTTP to HTTPS disabled under System > Admin Security ? This error can be seen most of the time due to wrong used login credentials.

I used the latest manual, latest firmware, http to https direction (hence the -k option in curl to suppress the certificate). The command I used is the same that you gave to me.
Hardware used is a HD2 MAX hw revision 2.