How to authenticate spacectl on servers without a GUI

Last updated: September 15, 2025

If you need to use spacectl on a server or system without a graphical user interface (GUI), you can authenticate using API keys instead of browser-based authentication.

Setting up API key authentication

To authenticate without a browser, you'll need to configure the following environment variables:

  • SPACELIFT_API_KEY_ENDPOINT

  • SPACELIFT_API_KEY_ID

  • SPACELIFT_API_KEY_SECRET

Once these environment variables are correctly configured, spacectl will authenticate automatically.

Login command

After setting up the environment variables, use the following command to log in:

spacectl profile login --method api --endpoint "spacelifturl" "envname"

Replace spacelifturl with your Spacelift endpoint URL and envname with your environment name.

For more detailed information about spacectl authentication, please refer to our documentation.