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

go install github.com/team-telnyx/telnyx-cli/cmd/telnyx@latest
Ensure Go’s bin directory is in your PATH:
export PATH="$PATH:$(go env GOPATH)/bin"
Verify the installation:
telnyx --version

Step 2: Configure Authentication

Set your API key as an environment variable. You can get your API key from the Telnyx Portal.
export TELNYX_API_KEY=KEY_xxxxxxxxxxxxx
Add this line to your shell profile (~/.bashrc, ~/.zshrc, etc.) to persist it across sessions.

Verify Authentication

Test that your credentials are working:
telnyx balance retrieve
You should see your account balance information.

Step 3: Run Your First Commands

Check Your Balance

telnyx balance retrieve

List Your Phone Numbers

telnyx phone-numbers list

Search for Available Numbers

telnyx available-phone-numbers list --filter.country-code US --filter.limit 5

Send a Test Message

You’ll need a messaging-enabled phone number and a configured messaging profile.
telnyx messages 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 resource
telnyx phone-numbers --help
telnyx messages --help

# Get help for a specific action
telnyx messages send --help

Common Commands

CommandDescription
telnyx phone-numbers listList your phone numbers
telnyx available-phone-numbers listSearch available numbers
telnyx number-orders createPurchase phone numbers
telnyx messages sendSend an SMS/MMS message
telnyx calls dialInitiate an outbound call
telnyx balance retrieveCheck account balance
telnyx messaging-10dlc:brand listList 10DLC brands
telnyx messaging-10dlc:campaign listList 10DLC campaigns
telnyx ai:chat create-completionChat with AI models
telnyx ai:assistants listList AI assistants

Output Formats

The CLI supports multiple output formats:
# Auto format (default, interactive exploration)
telnyx phone-numbers list

# JSON format (for scripting)
telnyx phone-numbers list --format json

# YAML format
telnyx phone-numbers list --format yaml

# Pretty-print JSON
telnyx phone-numbers list --format pretty

# Filter output with GJSON
telnyx phone-numbers list --format json --transform "0.phone_number"

Debug Mode

To see full HTTP request/response details:
telnyx phone-numbers list --debug

Next Steps