Authentication

Before running any CLI commands, you need to authenticate. There are two ways to do this; pick whichever fits how you're using the CLI.

Quick way: thoa login

The recommended method for interactive use. Run:

thoa login

This opens your browser to approve access, then stores a token locally at ~/.thoa/credentials (created with owner-only file permissions). If you're already logged in, running it again just confirms your session instead of reopening the browser.

thoa logout

Revokes the token and clears your local credentials. Safe to run even if you're offline: it still clears the local file if the server can't be reached.


Manual way: API key + environment variable

Better suited to CI/automation or headless environments where an interactive browser login isn't practical. If both are configured, the THOA_API_KEY environment variable always takes precedence over a thoa login session.

1. Create an API Key

You can create an API key here:
Create an API Key

Important: Anyone with access to this key can run jobs from your account and view, modify, or delete all of your datasets and results. Store it securely and never commit it to GitHub or share it.


2. Save the API Key

To use your API key with the CLI, it needs to be set as an environment variable called THOA_API_KEY.

To save it permanently:

macOS / Linux (bash / zsh)

You have two options:

Option 1: Manually edit your shell config file

Open your shell config file:

nano ~/.bashrc

(or ~/.zshrc if you are using zsh)

Add this line at the bottom:

export THOA_API_KEY="your-api-key-here"

Then reload your config:

source ~/.bashrc

Option 2: Append it automatically from the command line

echo 'export THOA_API_KEY="your-api-key-here"' >> ~/.bashrc
source ~/.bashrc

To set it just for the current session:

If you only want to set the API key temporarily (until you close the terminal), use the following:

macOS / Linux
export THOA_API_KEY="your-api-key-here"
Windows (PowerShell)
$env:THOA_API_KEY = "your-api-key-here"

These will only apply to the current terminal session. Once you close the terminal, you'll need to run the command again.