Documentation · Release 0.2.35

# Commands and API reference

UrbeStack is a web hosting control panel for Linux servers. You can perform the same operations through any of its three interfaces and get the same results.

## Interfaces

- **Web interface.** Administrators, resellers, and customers sign in at `https://your-server:8443` and use the administrator’s panel, the reseller’s panel, and the customer’s panel, respectively. This documentation uses 8443, the default port, throughout. You can choose a different port during installation and change it later with the `panel.port` setting.

- **Commands.** Every operation has a command you run as root at the server’s shell. Examples include [urbestack-domain-add](https://urbestack.com/docs/commands/urbestack-domain-add.md), [urbestack-mail-account-add](https://urbestack.com/docs/commands/urbestack-mail-account-add.md), and [urbestack-cert-issue](https://urbestack.com/docs/commands/urbestack-cert-issue.md). There are more than 300 commands, and each prints its usage with `--help`.

- **REST API.** The API provides more than 370 operations for billing systems, scripts, and your own tools. It accepts and returns JSON. Every server has an OpenAPI 3 document describing the API at `/usr/local/urbestack/openapi.json`.

## How the interfaces work together

The web interface accesses the server exclusively through the API. A program can use the API to do anything you can do in the web interface. For every change, the API runs the same command you would run at the server’s shell. When you add a domain from the web interface, a script, or the shell, the same code runs the same checks and produces the same result.

## Default API access

On a new server, the API is reachable only from the server itself at `http://127.0.0.1:8442/api`. The default value of `panel.api_local_port` is 8442. You can call it from the server’s shell or from scripts running on the server. Requests from the internet to any path under `/api/` on port `8443` receive `404`. The web interface continues to work because it calls the API from inside the server.

## Opening the API

An administrator can open the API from the administrator’s panel. In the “Security” section, open the “Settings” tab and turn on the “API reachable from outside” switch. You can also open it by running this command as root at the server’s shell.

```
urbestack-setting-set --key api.public --value true
```

Once opened, the API is reachable at `https://your-server:8443/api`. On the same tab, you can limit access by adding IP addresses or networks to the list of “trusted addresses”. When the list contains entries, only requests from those IP addresses or networks can reach the API. Requests from any other IP address receive `403`. When the list is empty, any IP address can reach the API.

To close the API to outside requests again, turn off the same switch. Scripts that call the API from outside the server then stop working.

## Tokens and scopes

Every API call carries a token in the `Authorization: Bearer TOKEN` header. You can create a token with this command at the server’s shell.

```
urbestack-token-create --user NAME --scopes LIST
```

You can also obtain a token by sending a user’s name and password to [POST /auth/login](https://urbestack.com/docs/api/post-auth-login.md).

A token belongs to a user and is limited to the operations that user may perform. Its scopes determine which areas of the API it can access. The default scope is `read`, which allows only read operations. The other scopes are `domains`, `dns`, `certificates`, `mail`, `databases`, `files`, `users`, `backups`, `settings`, `security`, `export`, `license`, and `all`.

## Commands

- [audit](https://urbestack.com/docs/commands/family/audit.md): 2 commands
- [auth](https://urbestack.com/docs/commands/family/auth.md): 1 command
- [backup](https://urbestack.com/docs/commands/family/backup.md): 12 commands
- [ban](https://urbestack.com/docs/commands/family/ban.md): 5 commands
- [bandwidth](https://urbestack.com/docs/commands/family/bandwidth.md): 1 command
- [botmail](https://urbestack.com/docs/commands/family/botmail.md): 14 commands
- [cert](https://urbestack.com/docs/commands/family/cert.md): 5 commands
- [cron](https://urbestack.com/docs/commands/family/cron.md): 5 commands
- [database](https://urbestack.com/docs/commands/family/database.md): 12 commands
- [db](https://urbestack.com/docs/commands/family/db.md): 1 command
- [disk](https://urbestack.com/docs/commands/family/disk.md): 1 command
- [dns](https://urbestack.com/docs/commands/family/dns.md): 35 commands
- [domain](https://urbestack.com/docs/commands/family/domain.md): 11 commands
- [export](https://urbestack.com/docs/commands/family/export.md): 1 command
- [fault](https://urbestack.com/docs/commands/family/fault.md): 1 command
- [file](https://urbestack.com/docs/commands/family/file.md): 16 commands
- [firewall](https://urbestack.com/docs/commands/family/firewall.md): 8 commands
- [foreign](https://urbestack.com/docs/commands/family/foreign.md): 1 command
- [ftp](https://urbestack.com/docs/commands/family/ftp.md): 5 commands
- [home](https://urbestack.com/docs/commands/family/home.md): 1 command
- [import](https://urbestack.com/docs/commands/family/import.md): 1 command
- [jail](https://urbestack.com/docs/commands/family/jail.md): 5 commands
- [job](https://urbestack.com/docs/commands/family/job.md): 5 commands
- [license](https://urbestack.com/docs/commands/family/license.md): 2 commands
- [load](https://urbestack.com/docs/commands/family/load.md): 7 commands
- [login](https://urbestack.com/docs/commands/family/login.md): 4 commands
- [mail](https://urbestack.com/docs/commands/family/mail.md): 38 commands
- [modsec](https://urbestack.com/docs/commands/family/modsec.md): 13 commands
- [move](https://urbestack.com/docs/commands/family/move.md): 15 commands
- [notify](https://urbestack.com/docs/commands/family/notify.md): 3 commands
- [package](https://urbestack.com/docs/commands/family/package.md): 4 commands
- [panel](https://urbestack.com/docs/commands/family/panel.md): 1 command
- [php](https://urbestack.com/docs/commands/family/php.md): 7 commands
- [plugin](https://urbestack.com/docs/commands/family/plugin.md): 8 commands
- [problem](https://urbestack.com/docs/commands/family/problem.md): 1 command
- [profile](https://urbestack.com/docs/commands/family/profile.md): 4 commands
- [protected](https://urbestack.com/docs/commands/family/protected.md): 7 commands
- [quota](https://urbestack.com/docs/commands/family/quota.md): 2 commands
- [rebuild](https://urbestack.com/docs/commands/family/rebuild.md): 1 command
- [release](https://urbestack.com/docs/commands/family/release.md): 1 command
- [restore](https://urbestack.com/docs/commands/family/restore.md): 1 command
- [security](https://urbestack.com/docs/commands/family/security.md): 1 command
- [service](https://urbestack.com/docs/commands/family/service.md): 8 commands
- [setting](https://urbestack.com/docs/commands/family/setting.md): 2 commands
- [ssh](https://urbestack.com/docs/commands/family/ssh.md): 4 commands
- [stats](https://urbestack.com/docs/commands/family/stats.md): 1 command
- [terms](https://urbestack.com/docs/commands/family/terms.md): 1 command
- [token](https://urbestack.com/docs/commands/family/token.md): 2 commands
- [traffic](https://urbestack.com/docs/commands/family/traffic.md): 1 command
- [update](https://urbestack.com/docs/commands/family/update.md): 7 commands
- [user](https://urbestack.com/docs/commands/family/user.md): 7 commands
- [version](https://urbestack.com/docs/commands/family/version.md): 1 command
- [web](https://urbestack.com/docs/commands/family/web.md): 2 commands
- [webmail](https://urbestack.com/docs/commands/family/webmail.md): 1 command

## API

- [auth](https://urbestack.com/docs/api/group/auth.md): 14 operations
- [users](https://urbestack.com/docs/api/group/users.md): 23 operations
- [domains](https://urbestack.com/docs/api/group/domains.md): 20 operations
- [dns](https://urbestack.com/docs/api/group/dns.md): 51 operations
- [settings](https://urbestack.com/docs/api/group/settings.md): 3 operations
- [php](https://urbestack.com/docs/api/group/php.md): 9 operations
- [jobs](https://urbestack.com/docs/api/group/jobs.md): 4 operations
- [export](https://urbestack.com/docs/api/group/export.md): 8 operations
- [certificates](https://urbestack.com/docs/api/group/certificates.md): 7 operations
- [mail](https://urbestack.com/docs/api/group/mail.md): 81 operations
- [security](https://urbestack.com/docs/api/group/security.md): 36 operations
- [license](https://urbestack.com/docs/api/group/license.md): 3 operations
- [updates](https://urbestack.com/docs/api/group/updates.md): 6 operations
- [databases](https://urbestack.com/docs/api/group/databases.md): 14 operations
- [files](https://urbestack.com/docs/api/group/files.md): 30 operations
- [cron](https://urbestack.com/docs/api/group/cron.md): 5 operations
- [backups](https://urbestack.com/docs/api/group/backups.md): 17 operations
- [foreign](https://urbestack.com/docs/api/group/foreign.md): 8 operations
- [move](https://urbestack.com/docs/api/group/move.md): 9 operations
- [services](https://urbestack.com/docs/api/group/services.md): 9 operations
- [web-server](https://urbestack.com/docs/api/group/web-server.md): 2 operations
- [load](https://urbestack.com/docs/api/group/load.md): 8 operations
- [plugins](https://urbestack.com/docs/api/group/plugins.md): 7 operations
