Learn how to securely configure your Nixtla SDK API key using direct code or environment variables.
Diagram of the API Key configuration process
Option 1: Copy & Paste into Python
Option 2: Secure Method with Environment Variables
NIXTLA_API_KEY
. The Nixtla SDK automatically detects this environment variable without needing to manually pass it into NixtlaClient
.Temporary (Terminal Session)
export
command:NixtlaClient
without specifying the key:Permanent (.env file)
.env
in the same directory as your Python script with the following content:dotenv
package:.env
file to public repositories. Your API key grants access to your Nixtla account.validate_api_key
method of NixtlaClient
to confirm that you have correctly configured your API key. This method returns True
if your API key is valid, or False
otherwise: