Skip to main content
The rf login command authenticates you with the RunFlow API using your API key. Supports both default authentication and multi-tenant profile management.

Basic Usage

Interactive Mode

# Interactive login (prompts for API key)
rf login
# → Enter your API key: sk-xxx...
# ✓ Successfully authenticated

Non-Interactive Mode

# Direct login with API key
rf login --api-key sk-1234567890abcdef

Profile Management

Save multiple API keys as named profiles for easy switching between accounts:
# Save as named profile
rf login --profile production
# → Enter your API key: sk-xxx...
# ✓ Profile 'production' saved

# Save with API key directly
rf login --api-key sk-xxx... --profile staging

# Switch between profiles
rf switch production
rf switch staging
Learn more about managing multiple profiles in the Profiles documentation.

Options

OptionDescriptionExample
--api-key <key>Your RunFlow API keyrf login --api-key sk-xxx...
--profile <name>Save as named profilerf login --profile production
--api <url>Override API URLrf login --api https://api.runflow.ai

Examples

Default Login

# Saves to 'default' profile
rf login --api-key sk-1234567890abcdef

Named Profile Login

# Save multiple profiles
rf login --api-key sk-prod... --profile production
rf login --api-key sk-dev... --profile development
rf login --api-key sk-stag... --profile staging

Custom API URL

# Connect to self-hosted or custom API
rf login --api-key sk-xxx --api https://custom-api.company.com

Complete Multi-Tenant Setup

# Setup profiles for different clients/environments
rf login --profile client-acme
rf login --profile client-techco
rf login --profile personal

# Switch between them
rf switch client-acme
rf agents list

rf switch client-techco
rf agents list

What Happens After Login?

After successful authentication:
  1. Credentials Stored - API key saved in ~/.runflowrc
  2. Profile Created - Default or named profile created
  3. Tenant Info Retrieved - Tenant ID and name fetched from API
  4. Ready to Use - All CLI commands now work without --api-key
Example output:
✓ Successfully authenticated
✓ Tenant: ACME Corporation (tenant_abc123)
✓ Profile saved as: production

Configuration File

Credentials are stored in ~/.runflowrc:
{
  "currentProfile": "production",
  "profiles": {
    "default": {
      "apiKey": "sk-xxx...",
      "apiUrl": "https://api.runflow.ai",
      "tenantId": "tenant_123",
      "tenantName": "My Company"
    },
    "production": {
      "apiKey": "sk-prod...",
      "apiUrl": "https://api.runflow.ai",
      "tenantId": "tenant_prod",
      "tenantName": "ACME Corp"
    }
  }
}

Security Best Practices

API keys are stored in plain text in ~/.runflowrc. Ensure proper file permissions:
chmod 600 ~/.runflowrc
Recommendations:
  • Never share your ~/.runflowrc file
  • Don’t commit .runflowrc to version control
  • Use separate API keys for dev/staging/prod
  • Rotate keys regularly
  • Revoke unused keys from the dashboard

Getting Your API Key

  1. Go to RunFlow Dashboard
  2. Navigate to SettingsAPI Keys
  3. Click Create New API Key
  4. Copy the key (starts with sk-...)
  5. Use it with rf login

Multi-Tenant Workflows

Agency Managing Multiple Clients

# Setup client profiles
rf login --profile client-acme --api-key sk-acme...
rf login --profile client-techco --api-key sk-tech...

# Work with specific client
rf switch client-acme
rf create --name acme-support-bot --template rag-agent --yes

rf switch client-techco
rf create --name techco-assistant --template starter --yes

Developer: Dev/Staging/Prod

# Setup environment profiles
rf login --profile dev --api-key sk-dev...
rf login --profile staging --api-key sk-staging...
rf login --profile prod --api-key sk-prod...

# Develop locally
rf switch dev
rf create --name test-agent --template starter --yes
cd test-agent/
rf test

# Test on staging
rf switch staging
rf agents deploy

# Deploy to production
rf switch prod
rf agents deploy

Troubleshooting

Invalid API Key

rf login --api-key sk-invalid
# Error: Invalid API key
Solution: Check your API key from the dashboard and try again.

Network Connection Error

rf login --api-key sk-xxx
# Error: Cannot connect to API
Solution:
  • Check your internet connection
  • Verify API URL is correct
  • Check if API is accessible (firewall, VPN)

Permission Denied (Config File)

rf login --api-key sk-xxx
# Error: Permission denied: ~/.runflowrc
Solution:
# Fix file permissions
chmod 600 ~/.runflowrc

# Or remove and recreate
rm ~/.runflowrc
rf login --api-key sk-xxx

Overwriting Existing Profile

rf login --profile production
# Warning: Profile 'production' already exists. Overwrite? (y/N)
Solution: Confirm to overwrite or use a different profile name.

Command Shortcuts

# Override profile for single command
rf agents list --profile production

# Temporary API key for one command
rf agents list --api-key sk-temp...

# Use different API endpoint
rf agents list --api https://custom-api.company.com

Next Steps