How to configure your auth key#

Getting your auth key#

JAI requires an auth key to organize and secure collections. You can quickly generate your free-forever auth-key by running the command below:

>>> from jai import get_auth_key
>>> get_auth_key(email='', firstName='Jai', lastName='Z')

Configuring your auth key for jai-sdk (python)#

The access to the Jai API is restricted to requests with a valid auth key. We’ll talk about the several ways to set your auth key to authenticate your jai-sdk requests bellow.

1. Set an Environment variable#

The first way to configure your auth key is setting an environment variable on your system. Simply set an new environment variable with the name JAI_AUTH.


Every Jai class that requires the usage of the auth key has a env_var parameter in case you need to use a different environment variable.

2. Using os.environ#

It’s also possible to set the environment variable directly to os.environ or use this to yield the same result:

>>> from jai import set_authentication
>>> set_authentication("xXxxxXXxXXxXXxXXxXXxXXxXXxxx")


For more details on how to use os.environ check its documentation .


We recommend not writing your auth key on your scripts, specially if you share them. Changes to Jai’s backend are definitive. Keep your auth key safe. 🔒

3. Set a config file#

Since setting an environment variable could be a little tricky, specially on shared environments. We decided to use python-decouple package to allow you to set the auth value using a .env file or a .ini file.

Bellow an example of the content of the settings.ini file:


Bellow an example of the content of the .env file:



Decouple always searches for Options in this order:

  1. Environment variables;

  2. Repository: .ini or .env file;

This means that config files won’t be considered when there’s already a value set on environment variables