Skip to main content

Environment Variables

Set your API key as an environment variable to use it across all SCANOSS CLI tools: macOS / Linux:
# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
echo 'export SCANOSS_API_KEY=your_api_key_here' >> ~/.bashrc
source ~/.bashrc
Windows (PowerShell):
# Set for current session
$env:SCANOSS_API_KEY = "your_api_key_here"

# Set permanently (current user)
[System.Environment]::SetEnvironmentVariable('SCANOSS_API_KEY', 'your_api_key_here', 'User')
After setting up the environment variable, restart your terminal to use it across all SCANOSS CLI tools.

SCANOSS-PY

To use the SCANOSS Python CLI, install it and run a scan. Basic scan (no API key required):
# macOS / Linux
scanoss-py scan -o results.json /path/to/code
# Windows (PowerShell)
scanoss-py scan -o results.json C:\path\to\code
With API key via environment variable:
# macOS / Linux
scanoss-py scan --key $SCANOSS_API_KEY -o results.json /path/to/code
# Windows (PowerShell)
scanoss-py scan --key $env:SCANOSS_API_KEY -o results.json C:\path\to\code

SCANOSS-JS

To use the SCANOSS JavaScript CLI, install it and run a scan. Basic scan (no API key required):
# macOS / Linux
scanoss-js scan /path/to/code
# Windows
scanoss-js scan C:\path\to\code
With API key via environment variable:
# macOS / Linux
scanoss-js scan --key $SCANOSS_API_KEY -o results.json /path/to/code
# Windows (PowerShell)
scanoss-js scan --key $env:SCANOSS_API_KEY -o results.json C:\path\to\code

SCANOSS-CC

SCANOSS Code Compare requires configuration with an API key. Configure with API key via environment variable:
# macOS / Linux
scanoss-cc configure --apiUrl https://api.scanoss.com --key $SCANOSS_API_KEY
# Windows (PowerShell)
scanoss-cc configure --apiUrl https://api.scanoss.com --key $env:SCANOSS_API_KEY
Verify your configuration: Your settings are stored in ~/.scanoss/scanoss-cc-settings.json (macOS/Linux) or %USERPROFILE%\.scanoss\scanoss-cc-settings.json (Windows). You can check this file to confirm your API key was saved correctly:
# macOS / Linux
cat ~/.scanoss/scanoss-cc-settings.json
# Windows (PowerShell)
Get-Content "$env:USERPROFILE\.scanoss\scanoss-cc-settings.json"

SBOM Workbench

The SBOM Workbench can be easily configured to use your API key:
  1. Navigate to File → Settings
  2. Create a new Knowledge Base API Key by clicking the ’+’ button
  3. In the new form, enter your credentials:
    • Base URL: https://api.scanoss.com
    • API Key: <your_api_key>
SBOM API Settings After adding your new KB API connection, your next scans will automatically run against the SCANOSS Service. Need help? Contact our AI assistant or check our FAQs.