Skip to content

Setting your API token#

Your Neptune API token is like a password to the application. By saving your token as an environment variable, you avoid putting it in your source code, which is more convenient and secure.

To find and save your API token:

  1. In the top-right corner of the app, click your avatar icon.
  2. Select Get Your API token.

    How to find your Neptune API token

  3. Depending on your system:

    1. From the API token dialog in Neptune, copy the export command.

      Example:

      export NEPTUNE_API_TOKEN="uyVrZXkiOiIzNTd..."
      
    2. Append the line to your .profile or other shell configuration file.

    1. From the API token dialog in Neptune, copy the export command.

      Example:

      export NEPTUNE_API_TOKEN="uyVrZXkiOiIzNTd..."
      
    2. Append the line to your .profile or other shell configuration file.

    1. From the API token dialog in Neptune, copy the setx command.

      Example:

      setx NEPTUNE_API_TOKEN "uyVrZXkiOiIzNTd..."
      
    2. Open a terminal app, such as PowerShell or Command Prompt.

    3. Paste the line you copied and press enter.
    4. To activate the change, restart the terminal app.
    from getpass import getpass
    
    run = neptune.init_run(
        project = ...
        api_token = getpass("Enter your Neptune API token: "),
    )
    

Result

Neptune will find your API token automatically. You don't need to pass it to the api_token parameter when initializing Neptune in your code.