Skip to main content
This CLI is deprecated. The new Telnyx CLI uses environment variables only (TELNYX_API_KEY). Profile management is not available in the new CLI.

Authentication Methods

The legacy CLI supports three authentication methods, checked in order: flag → environment variable → config file.
telnyx auth setup
You’ll be prompted to enter your API key. Configuration is stored in ~/.config/telnyx/config.json.

2. Environment Variable

export TELNYX_API_KEY=KEY_xxxxxxxxxxxxx

3. Command-Line Flag

telnyx number list --api-key KEY_xxxxxxxxxxxxx

Verify Authentication

telnyx auth status
Example output:
✓ Authenticated

Account:     My Company
Email:       developer@example.com
Balance:     $125.50
Profile:     default

Multiple Profiles

Use named profiles to manage multiple Telnyx accounts or environments.

Create a Profile

telnyx auth setup --profile production
telnyx auth setup --profile staging

List Profiles

telnyx profile list

Use a Profile

telnyx number list --profile production
telnyx billing balance --profile staging

Set Default Profile

telnyx profile set-default production

Delete a Profile

telnyx profile delete staging

Configuration File

The CLI stores configuration in ~/.config/telnyx/config.json:
{
  "defaultProfile": "production",
  "profiles": {
    "default": {
      "apiKey": "KEY_xxxxxxxxxxxxx"
    },
    "production": {
      "apiKey": "KEY_yyyyyyyyyyyyy"
    },
    "staging": {
      "apiKey": "KEY_zzzzzzzzzzzzz"
    }
  }
}
Keep your config file secure. It contains sensitive API keys. The file is created with restricted permissions (600) by default.

Environment Variables

VariableDescription
TELNYX_API_KEYAPI key (overrides config file)
TELNYX_PROFILEDefault profile name
TELNYX_CONFIG_DIRCustom config directory

Getting Your API Key

  1. Log in to the Telnyx Portal
  2. Navigate to API Keys
  3. Click Create API Key
  4. Copy the key (it won’t be shown again)
API keys start with KEY_. If you’re using a v1 API key, you’ll need to create a new v2 key.

Next Steps

Command Reference

Full command reference for the legacy CLI