Skip to main content
This quickstart guide will help you install the Telnyx CLI, configure authentication, and run your first commands.

Prerequisites

Step 1: Install the CLI

npm install -g @telnyx/api-cli
Verify the installation:
telnyx --version

Step 2: Configure Authentication

The CLI needs your API key to authenticate with Telnyx. You can get your API key from the Telnyx Portal. Run the setup wizard:
telnyx auth setup
You’ll be prompted to enter your API key. The key is stored securely in ~/.config/telnyx/config.json.

Environment Variable

Alternatively, set your API key as an environment variable:
export TELNYX_API_KEY=KEY_xxxxxxxxxxxxx

Verify Authentication

Check that your credentials are working:
telnyx auth status
You should see your account information and connection status.

Step 3: Run Your First Commands

Check Your Balance

telnyx billing balance

List Your Phone Numbers

telnyx number list

Search for Available Numbers

telnyx number search --country US --limit 5

Send a Test Message

You’ll need a messaging-enabled phone number and a configured messaging profile.
telnyx message send \
  --from +15551234567 \
  --to +15559876543 \
  --text "Hello from the Telnyx CLI!"

Step 4: Explore Commands

Get Help

# List all commands
telnyx --help

# Get help for a specific command
telnyx number --help
telnyx message send --help

Enable Autocomplete

Set up shell autocomplete for faster command entry:
telnyx autocomplete
Follow the instructions to add autocomplete to your shell configuration.

Common Commands

CommandDescription
telnyx auth setupConfigure API authentication
telnyx auth statusCheck authentication status
telnyx number listList your phone numbers
telnyx number searchSearch available numbers
telnyx message sendSend an SMS/MMS message
telnyx message listList sent/received messages
telnyx call dialInitiate an outbound call
telnyx billing balanceCheck account balance
telnyx 10dlc brand listList 10DLC brands
telnyx ai chatChat with AI models

Output Formats

The CLI supports multiple output formats:
# Table format (default, human-readable)
telnyx number list

# JSON format (for scripting)
telnyx number list --json

# Specific fields only
telnyx number list --json | jq '.[].phone_number'

Next Steps