Bandwidth Voice and Message API command line interface
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Bandwidth Voice and Message API command line interface

Build Status


Using precompiled binary

Go to releases and download archive file for your platform. Unpack it to any directory which added to environment variable PATH.

Using docker

# This is optional step. If you omit it the image will be downloaded on the first run.

docker pull docker pull bandwidthexamples/bandwidth-cli

# to get latest develop version run
docker pull docker pull bandwidthexamples/bandwidth-cli:develop

From sources

Extract sources and then run

# Install dep (tool to manage dependencies)
go get -u

# Install dependencies
dep ensure

# Build the app
go build


Run bandwidth-cli --help to see all available commands. Run bandwidth-cli <command> --help to see command specific available subcommands and options.

All commands require Bandwidth Messaging and Voice API auth data. You can pass them via global options --user-id, --api-token and --api-secret (like bandwidth-cli --user-id id -api-token token --api-secret secret applications list). These options should be passed before any command. Also you can pass auth data via environment variables BANDWIDTH_USER_ID, BANDWIDTH_API_TOKEN and BANDWIDTH_API_SECRET. Also you can save auth data into encrypted config file. Run for that bandwidth-cli setup and follow instructions. Config file will be save in user profile directory. If you want to save it in current directory use option --local after setup.

Some commands have required options. If you ommit them in command line they will be required on command execution.

# This commmand will create a domain without any interactions with user
bandwidth-cli domains create --name my-domain

# This command will ask domain name
bandwidth-cli domains create


# List your all (first 1000) applications
bandwidth-cli applications list --size 1000

# Delete an application
bandwidth-cli delete applications --id your-app-id

# Delete an application and related with it phone numbers and endpoints
bandwidth-cli delete applications --id your-app-id --force

# List latest errors
bandwidth-cli errors list

# Get detailes of an error
bandwidth-cli errors get --id your-error-id

# Download media file
bandwidth-cli media download --name your-media-file-name --file-path /path/to/save/downloaded/file

# Show 10 messages sent to given number
bandwidth-cli messages list --to your-number --size 10

# Send a SMS
bandwidth-cli messages create --from you-number1 --to your-number --text message-text

# Send a MMS
bandwidth-cli messages create --from you-number1 --to your-number --text message-text --media-url https://host/path/to/remote/image1.jpg --media-file /path/to/local/image2.jpg

# Make a call
bandwidth-cli calls create --from you-number1 --to your-number

Using with docker

Replace bandwidth-cli to docker run -i -t --rm bandwidthexamples/bandwidth-cli in all demos above to have ability to use bandwidth-cli via docker.

# List your all (first 1000) applications
docker run -i -t --rm bandwidthexamples/bandwidth-cli applications list --size 1000

# Download media file with name image.png into current directory
docker run -i -t -v $PWD:/data --rm bandwidthexamples/bandwidth-cli media download --name image.png --file-path /data/image.png

# Save auth data to local file (to use them add -v $PWD:/data to any docker command)
docker run -i -t -v $PWD:/data --rm bandwidthexamples/bandwidth-cli setup --local

# Send a MMS
docker run -i -t -v $PWD:/data --rm bandwidthexamples/bandwidth-cli messages create --from you-number1 --to your-number --text message-text --media-file /data/image2.jpg # file image.jpg should be in current directory

Bash completion

Download helper script and make it executable

curl -L -o /your/path/to/bash_autocomplete
chmod +x /your/path/to/bash_autocomplete

Source the /your/path/to/bash_autocomplete file in your .bashrc file while setting the PROG variable to bandwidth-cli:

PROG=bandwidth-cli source /your/path/to/bash_autocomplete/bash_autocomplete

Restart your terminal session.


  1. Fork (
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the go test ./... command and confirm that it passes
  6. Run gofmt -s
  7. Create a new Pull Request