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
srvctloutput (JSON or YAML) with tools likejqoryqto build lightweight automation without a full SDK.
Key concepts
| Term | Description |
|---|---|
| Resource | An object you manage via the CLI, such as a dedicated server or load balancer. |
| Command | An operation performed on a resource, such as add, get, or delete. |
| Option / flag | Additional arguments that modify a command. A flag stands alone (e.g., -f); an option carries a value (e.g., --output=json). |
| Context | A named set of credentials and configuration for one account or API token. Multiple contexts allow you to switch between accounts. |
| Configuration | A YAML file that stores your contexts and global settings. |
Installation
macOS
brew tap serverscom/serverscom
brew install srvctlLinux
-
Download the archive for your architecture from GitHub releases. For example,
srvctl_0.1.0_linux_amd64.zipfor Linux on AMD64. -
Extract and make the binary executable:
unzip srvctl_*_linux_amd64.zip
chmod +x srvctl- Move
srvctlto a directory on yourPATH(e.g.,/usr/local/bin) or add its directory to~/.bashrc:
export PATH=/path/to/srvctl/folder:$PATH
source ~/.bashrcWindows
- Download the archive for your architecture from GitHub releases.
- Extract the archive.
- Run the
srvctl.exeexecutable.
Getting started
-
Generate a Public API token in the API Tokens section of the Customer Portal.
-
Log in to create your first context:
srvctl login my-accountYou will be prompted for the API token. The new context is set as default automatically.
- Verify the context was created:
srvctl context list- Explore available resources and commands using the built-in help:
srvctl --help
srvctl <resource> --help
srvctl <resource> <command> --helpCommand structure
All commands follow the same pattern:
srvctl <resource> <command> [<options>]Standard commands available on most resources:
| Command | Description | Example |
|---|---|---|
list / ls | List resources | srvctl hosts list |
add | Create a new resource | srvctl ssh-keys add --input ssh-key.json |
get | Get details of a resource by ID | srvctl hosts ebm get <id> |
update | Update a resource by ID | srvctl ssh-keys update <fingerprint> -n <name> |
delete | Remove a resource by ID | srvctl 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:
| Flag | Alias | Description |
|---|---|---|
--all | -A | Fetch all pages of results |
--output | -o | Output format: text (default), json, or yaml |
--no-header | Suppress column headers in text output | |
--field | -f | Limit output to specific fields: -f ID -f Status |
--field-list | List available fields for the current resource | |
--verbose | -v | Show the full HTTP request and response |
--config | -c | Path 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.jsonExample 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:
- Global config — applied to all contexts unless overridden.
- Context config — overrides global config for the active context.
- 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 updateContext management
| Command | Description |
|---|---|
srvctl login <name> | Create a new context and authenticate |
srvctl context list | List all contexts |
srvctl context update <name> --default | Set a context as default |
srvctl context delete <name> | Delete a context (--force required for the default) |
Available resources
| Resource | CLI command | Description |
|---|---|---|
| Account balance | srvctl account balance | View current account balance |
| Hosts (all types) | srvctl hosts list | List all servers across types |
| Dedicated servers | srvctl hosts ebm <command> | Manage dedicated (enterprise bare metal) servers |
| Scalable Bare Metal | srvctl hosts sbm <command> | Manage SBM servers |
| Invoices | srvctl invoices <command> | View and retrieve invoices |
| SSH keys | srvctl ssh-keys <command> | Manage SSH keys |
| Locations | srvctl locations <command> | List and inspect locations |
| Server models | srvctl server-models <command> | Browse available server models |
| Racks | srvctl racks <command> | Manage private racks |
| SSL certificates | srvctl ssl <command> | Manage custom and Let's Encrypt certificates |
| L2 segments | srvctl l2-segments <command> | Manage private L2 network segments |
| Kubernetes clusters | srvctl k8s <command> | Manage Kubernetes clusters |
| Load balancers | srvctl lb <l4|l7> <command> | Manage L4 and L7 load balancers |
| Network pools | srvctl network-pools <command> | Manage network pools and subnets |
| Remote Block Storage | srvctl rbs <command> | Manage RBS volumes |
| Cloud instances | srvctl cloud-instances <command> | Manage cloud computing instances |
| Cloud regions | srvctl cloud-regions <command> | Browse regions, images, flavors, snapshots |
| Cloud volumes | srvctl cloud-volumes <command> | Manage cloud block storage volumes |
| Cloud backups | srvctl cloud-backups <command> | Manage cloud volume backups |