How to authenticate using an API key
Authenticating your Q-CTRL account using an API key
You can seamlessly authenticate to the Q-CTRL platform using API key-based authentication by passing an API key from your Python client environment. Note that this is separate from your hardware provider's credentials, which are constructed via credentials functions and passed during function calls.
In this guide, you will learn how to:
- Retrieve your API key.
- Authenticate using your API key.
- Set an environment variable to persist authentication (optional).
Sign in to your Q-CTRL account. Under Sign in and security, copy the pre-generated API key. You also have the ability to generate additional keys.
In your client environment, you can call the
authenticate_qctrl_account method and pass the respective API key to authenticate with the Q-CTRL platform.
import fireopal api_key = "YOUR_QCTRL_API_KEY" fireopal.authenticate_qctrl_account(api_key=api_key)
To avoid re-authenticating, you may choose to simply set the
QCTRL_API_KEY environment variable to your key's value. Note that if you don't set the environment variable or call
authenticate_qctrl_account explicitly, you will be redirected to a browser for authentication.
export QCTRL_API_KEY = "YOUR_QCTRL_API_KEY"