API and automation
The berth command line
An overview of the berth CLI on the server: the command tree by area, how it talks to the agent, --local, reading secrets from stdin, JSON output and everyday examples.
On this page
berth is the command-line tool on the server itself. It covers everything the panel does, from creating a customer to migrating a Plesk server, and some things the panel deliberately leaves to root, such as approving a domain move or trusting an extension publisher. You never need it for daily work, but it is the natural tool for scripts, configuration management and for the moments when the web interface is not reachable.
How it runs
- Run
berthon the server as root. Some read commands also work for members of theberthgroup, but they get only what the panel itself may do. - By default a command talks to berth-agent, the small root service that performs privileged work, over its local socket. The agent validates each operation and runs it in a separate subprocess, exactly as it does for the panel. See Architecture.
- Many commands accept
--local: run the operation in-process as root instead of through the agent. That is useful when the agent itself is the problem, and during installation or recovery. - Changes made with the CLI land in the same panel database and the same activity log as changes made in the panel.
Finding your way: --help
Every level has help:
berth --help # all top-level commands with a one-line description
berth backup --help # the subcommands of backup
berth backup schedule add --help # the flags of one commandShell completion is available for bash, zsh, fish and PowerShell:
berth completion bash > /etc/bash_completion.d/berthThe panel shows the matching CLI command next to many actions, which is a quick way to learn the right flags.
The command tree by area
There are more than 100 top-level commands. Grouped by what they are for:
| Area | Commands |
|---|---|
| Setup and lifecycle | install, uninstall, doctor, repair, rescue, dr, update, license, release, offline-bundle, version, modules, export, status, task, job, watchdog, vulndb |
| Customers and tenancy | customer, subscription, plan, reseller, brand, transfer, search, quota, lock, egress, beleid |
| Access | admin, admins, approvals, sso, token, ssh, sftp, sshd, admin-term, audit, auditwatch, privacy, evidence, incident |
| Integrations | webhook, extension, homeassistant, ai, openapi, fleet |
| Websites | domain, php, tls, cdn, geoip, ip, render, sjablonen, files, ftp, cron, git |
| Mail and DNS | mail, mail-reports, lists, dns |
| Databases and backups | database, backup |
| Applications | software, wp, joomla, drupal, nextcloud, matomo, laravel, app, container, docker, sysapp |
| Monitoring and logs | uptime, webvitals, stats, logs, logdrain, report, notify, alert, siem |
| Server management | system, service, service-backup, service-update, component, unit, proc, ports, inventory, integrity, hardening, mitigation, maintenance, snapshot, storage, panel, agent, security, waf |
| Migration | migrate, migration, import |
The server-management commands that have no page of their own in this library are explained here: admins and sshd in Firewall and bans, sysapp in system apps, ip in Customers and packages, system local-config in How changes go live, sjablonen in Web server settings, service-update in Services and diagnostics, and system repos and system lifecycle in OS updates and maintenance.
Most commands have subcommands: berth mail account add, berth backup history restore, berth migration cutover … go.
Addressing things
Commands use the same names as the panel:
- a customer by login:
--customer acme; - a subscription by its system user:
--sysuser acme; - a domain by name:
--domain acme.nl; - a mailbox by address:
--address info@acme.nl; - a package by name:
--plan basis.
Passwords and secrets: never on the command line
Arguments end up in the shell history and are visible in the process list to other users. Berth therefore never takes a password or key as a plain argument. Commands that need one read it from standard input or from a file:
| Pattern | Used by, for example |
|---|---|
--password-stdin | customer add, customer login add, reseller create, ftp add, migration add |
--key-file -, --token-file, --secret-file | DNS provider tokens, AI provider keys, S3 keys, API tokens of another server |
--code-file - | license activate |
--passphrase-file - | transfer export, import and pull |
--client-secret-file - | sso set |
Typical use:
printf '%s\n' "$PW" | berth customer add --login acme --name "Acme" \
--email info@acme.nl --password-stdin
berth dns account-add --provider cloudflare --name cf --token-file /root/cf-token.txt
berth license activate --code-file - < licence-code.txtSecrets that Berth generates (a mailbox password left empty, an API token, a webhook secret) are printed once. Store them where they belong straight away.
Output for scripts
- Many read commands accept
--json, for exampleberth status --json,berth doctor --json,berth search acme --json,berth backup list --json,berth task list --json. berth doctorandberth hardeningexit with status 1 when a check fails, so they fit in monitoring or a deploy pipeline.berth statusalways exits 0, even when something is pending.- Long work runs as a job or background task.
berth job log <id> --followandberth task show <id> --waitfollow it until it is done; many commands accept--waitthemselves.
Everyday examples
Customers and packages (details):
berth plan set --name basis --php 8.3 --disk-mb 10240 --max-domains 5 --max-mailboxes 20
berth customer create --customer acme --domain acme.nl --plan basis --tls --email info@acme.nl
berth subscription usage --sysuser acme
berth subscription suspend --sysuser acme --reason "Invoice overdue"Mail and DNS (mailboxes, DNS):
berth mail enable --domain acme.nl
berth mail account add --address info@acme.nl --quota-mb 2048
berth mail status --domain acme.nl --check
berth dns link --domain acme.nl --auto && berth dns apply --domain acme.nlBackups and restore (restoring data):
berth backup schedule list
berth backup history restore --sysuser acme --at "2026-10-28 14:00" \
--domain acme.nl --path httpdocs/wp-config.phpServer health and updates (OS updates, updating Berth):
berth doctor
berth system updates
berth update --check
berth logs --unit nginx --priority err --since 1hFinding things:
berth search acme # domains, mailboxes, aliases, databases, subscriptions, customers, logins
berth status # background tasks, pending actions and noticesThings only root can do
A few actions are deliberately not available in the panel or the API, so that a compromised panel process cannot perform them. They are done on the server as root:
- approving a request to move a domain to another subscription (
berth domain move-approve); - trusting an extension publisher (
berth extension trust add); - changing the server policy with hard limits that packages cannot loosen (
berth beleid); - installing an unsigned or HTTP extension (
berth extension install).
When the panel is down
The CLI does not depend on the web interface. If the panel daemon will not start, berth doctor shows why, berth repair re-renders configuration from the database and fixes ownership, and berth rescue opens a recovery menu that works even without the database. See Rescue mode and Services and diagnostics.
Related
- REST API: the same functions over HTTPS, with tokens.
- Installing Berth:
berth installand its options.