Skip to main content

Saving an API Key

An API key is a unique identifier than grants the user access to Covalent Cloud. To obtain an API key, log in to Covalent Cloud and copy the key from the dashboard.

Saving API Keys

Make sure you have the Covalent Cloud SDK installed.

pip install -U covalent-cloud

Run the following to save your API key.

import covalent_cloud as cc

cc.save_api_key("your-api-key")

Once an API key is saved, it’s used automatically by the SDK thereafter. Saved API keys can be retrieved programmatically using cc.get_api_key().

Each account can only have one valid API key at a time. Generating a new API key from the Covalent Cloud dashboard invalidates the old one, be sure to update your saved key before using an API key for the first time.

Security

Treat your API key like a password. Never share it publicly or expose it in your code. When sharing your Covalent projects, consider referring the your API key via environment variable (e.g. os.getenv("CC_API_KEY")). It is good practice to refresh your API key regularly by generating a new one - this immediately invalidates any compromised keys.