Error: error setting up project: api key format error: invalid api key format

When creating the bucket generates this error.

What is the solution?

Hello and welcome to the forum!

Can you try creating a new API key and running the setup again? Be sure to copy the whole API key and paste :slight_smile:

1 Like

Some times when you copy, it also copy aditional space with it, in the end.

I had the same issue, in the uplink setup it should trim whitespace

I hate to resurrect a “solved” issue, but I get this error still after running setup multiple times with multiple API Keys, making sure there was no white space at the end any time I try to run any command. It essentially renders the gateway useless. I can start the gateway after setup but that is about it. Anybody have any other ideas? Thanks so much!

1 Like

Hello @Lazydayz137,
Welcome to the forum!

Do you use the Powershell? If so, please, copy the API key line by line. Sometimes the Powershell inserts carriage return to the line at the border of the window and can copy it to the buffer. You can easily check that behavior - paste the copied key to the text editor, it should be one line.

If you use the API key from the browser, make sure that you do not use any ad blockers and other extensions in your browser which could break the content.
Also, make sure that you use the latest version of the gateway/uplink.

Still doesn’t work for me :cry: - even though I’ve copied and pasted the API key one part by one part and downloaded the latest Windows binary exe file.

Has someone encountered same problem and managed to solve it?

Ok I somehow solved it myself - first I delete the existing data that storj saved on my Windows, specifically I delete the folder in Users[your username]\AppData\Roaming\Storj

And then during the setup process, I only use characters in lowercase for my access name this time and then it works for me.
Hopefully anyone who sees this could replicate it yourself.

2 Likes

not sure about you guys …

i tried with my windows gateway setup… i am stuck at the API key

PS C:\Users\lee\Desktop\gateway> .\gateway.exe setup
Select your satellite:
[1] us-central-1.tardigrade.io
[2] europe-west-1.tardigrade.io
[3] asia-east-1.tardigrade.io
Enter number or satellite address as “@:” [1]: 3
Enter your API key: xxxxxxxxxx
Enter your encryption passphrase:
Enter your encryption passphrase again:
Error: gateway setup error: uplink: api key format error: invalid api key format

i tried putting the api key line by line… same error… is there something wrong on asia satelite? i got same error on europe as well…

If you want to setup gateway interactively, you need to generate an access token (formerly known as API key):


If you generated a usual Access Grant with passphrase, then you can import it to the Gateway:

In this case you do not need to perform an interactive setup.

Hi Alexey,
manage to find the solution in another thread. thanks bro…

1 Like