CLI (srvctl)

srvctl is the open-source command-line tool for Servers.com. It is built on the Public API and lets you create, inspect, and manage your infrastructure without leaving the terminal — including dedicated servers, cloud instances, load balancers, networking, and more.

The source code is available on GitHub.

Use cases

  • Automation and scripting: integrate infrastructure management into your CI/CD pipelines, shell scripts, or custom workflows.
  • Power-user workflows: work faster by staying in the terminal and composing commands with familiar UNIX tools.
  • Programmatic access: combine srvctl output (JSON or YAML) with tools like jq or yq to build lightweight automation without a full SDK.

Key concepts

TermDescription
ResourceAn object you manage via the CLI, such as a dedicated server or load balancer.
CommandAn operation performed on a resource, such as add, get, or delete.
Option / flagAdditional arguments that modify a command. A flag stands alone (e.g., -f); an option carries a value (e.g., --output=json).
ContextA named set of credentials and configuration for one account or API token. Multiple contexts allow you to switch between accounts.
ConfigurationA YAML file that stores your contexts and global settings.

Installation

macOS

brew tap serverscom/serverscom
brew install srvctl

Linux

  1. Download the archive for your architecture from GitHub releases. For example, srvctl_0.1.0_linux_amd64.zip for Linux on AMD64.

  2. Extract and make the binary executable:

unzip srvctl_*_linux_amd64.zip
chmod +x srvctl
  1. Move srvctl to a directory on your PATH (e.g., /usr/local/bin) or add its directory to ~/.bashrc:
export PATH=/path/to/srvctl/folder:$PATH
source ~/.bashrc

Windows

  1. Download the archive for your architecture from GitHub releases.
  2. Extract the archive.
  3. Run the srvctl.exe executable.

Getting started

  1. Generate a Public API token in the API Tokens section of the Customer Portal.

  2. Log in to create your first context:

srvctl login my-account

You will be prompted for the API token. The new context is set as default automatically.

  1. Verify the context was created:
srvctl context list
  1. Explore available resources and commands using the built-in help:
srvctl --help
srvctl <resource> --help
srvctl <resource> <command> --help

Command structure

All commands follow the same pattern:

srvctl <resource> <command> [<options>]

Standard commands available on most resources:

CommandDescriptionExample
list / lsList resourcessrvctl hosts list
addCreate a new resourcesrvctl ssh-keys add --input ssh-key.json
getGet details of a resource by IDsrvctl hosts ebm get <id>
updateUpdate a resource by IDsrvctl ssh-keys update <fingerprint> -n <name>
deleteRemove a resource by IDsrvctl ssh-keys delete <fingerprint>

Sub-resource commands follow the pattern list-<subresource>, get-<subresource>, and so on. For example:

srvctl hosts ebm list-connections <id>
srvctl hosts ebm list-networks <id>

Global flags

These flags are available on every command:

FlagAliasDescription
--all-AFetch all pages of results
--output-oOutput format: text (default), json, or yaml
--no-headerSuppress column headers in text output
--field-fLimit output to specific fields: -f ID -f Status
--field-listList available fields for the current resource
--verbose-vShow the full HTTP request and response
--config-cPath to a custom configuration file

Creating resources with JSON input

Resources such as dedicated servers, load balancers, and L2 segments are created using a JSON file that mirrors the Public API request body. The add command provides a template link when you run it without input.

srvctl hosts ebm add --input dedicated-server.json

Example ssh-key.json:

{
  "name": "my-key",
  "public_key": "ssh-rsa AAAA..."
}

Configuration file

The default configuration path is $HOME/.config/srvctl/config.yaml. You can override it with the SRVCTL_CONFIG_PATH environment variable or the --config flag.

Example configuration:

globalConfig:
  http-timeout: 30
  output: text
defaultContext: default
contexts:
  - name: default
    endpoint: https://api.servers.com/v1
    token: <your-api-token>
    config:
      verbose: false
  - name: staging
    endpoint: https://api.servers.com/v1
    token: <staging-api-token>

Settings are resolved in order of increasing priority:

  1. Global config — applied to all contexts unless overridden.
  2. Context config — overrides global config for the active context.
  3. Command-line flags — override everything for the current command.

To update configuration without editing the file:

srvctl --http-timeout 60 config global update
srvctl --output json config context update

Context management

CommandDescription
srvctl login <name>Create a new context and authenticate
srvctl context listList all contexts
srvctl context update <name> --defaultSet a context as default
srvctl context delete <name>Delete a context (--force required for the default)

Available resources

ResourceCLI commandDescription
Account balancesrvctl account balanceView current account balance
Hosts (all types)srvctl hosts listList all servers across types
Dedicated serverssrvctl hosts ebm <command>Manage dedicated (enterprise bare metal) servers
Scalable Bare Metalsrvctl hosts sbm <command>Manage SBM servers
Invoicessrvctl invoices <command>View and retrieve invoices
SSH keyssrvctl ssh-keys <command>Manage SSH keys
Locationssrvctl locations <command>List and inspect locations
Server modelssrvctl server-models <command>Browse available server models
Rackssrvctl racks <command>Manage private racks
SSL certificatessrvctl ssl <command>Manage custom and Let's Encrypt certificates
L2 segmentssrvctl l2-segments <command>Manage private L2 network segments
Kubernetes clusterssrvctl k8s <command>Manage Kubernetes clusters
Load balancerssrvctl lb <l4|l7> <command>Manage L4 and L7 load balancers
Network poolssrvctl network-pools <command>Manage network pools and subnets
Remote Block Storagesrvctl rbs <command>Manage RBS volumes
Cloud instancessrvctl cloud-instances <command>Manage cloud computing instances
Cloud regionssrvctl cloud-regions <command>Browse regions, images, flavors, snapshots
Cloud volumessrvctl cloud-volumes <command>Manage cloud block storage volumes
Cloud backupssrvctl cloud-backups <command>Manage cloud volume backups

On this page