natbox.io

natbox API and command-line tool

Every plan, including the free trial. JSON over HTTPS.

Everything you do on the Manage and Snapshots tabs of the client area, you can also do from a script, a CI job or an AI agent: list your servers, start, stop and restart them, reinstall with another system, reset the root password, take and restore snapshots, and read CPU, memory, disk and traffic.

1. Create an API key

Sign in at my.natbox.io/account/api (account menu, API keys), give the key a name and pick its access:

The key starts with nbx_ and is shown once. We keep only a scrambled copy, so store it somewhere safe, like your password manager or your CI system's secrets. A key never gives access to billing, invoices or your account password, and we email you each time a key is created. Delete a key on the same page and it stops working at once. You can have up to 10 keys.

2. The natbox command-line tool

One file, no dependencies, Python 3.8 or newer. On Linux or macOS:

mkdir -p ~/.local/bin
curl -fsSL https://natbox.io/assets/downloads/natbox -o ~/.local/bin/natbox
chmod +x ~/.local/bin/natbox
natbox login

natbox login asks for your key and saves it in ~/.config/natbox/key, readable only by you. In CI, set the environment variable NATBOX_API_KEY instead. On Windows, download the same file and run it with python natbox list.

natbox list                          # your servers
natbox show vps123                   # state, SSH command, ports, IPv6
natbox start vps123                  # also: stop, restart
natbox ssh vps123                    # connect with SSH
natbox ssh vps123 -- uptime          # run one command
natbox password vps123               # new root password, shown once
natbox os                            # systems you can install
natbox reinstall vps123 debian13     # erase and reinstall, asks first
natbox usage vps123                  # CPU, memory, disk, traffic
natbox snapshots vps123              # list snapshots
natbox snapshot vps123               # take one
natbox restore vps123 user-20261205-101500
natbox snapshot-delete vps123 user-20261205-101500

Add --json to any command for the raw API answer, and --yes to skip the questions in scripts.

3. API basics

curl -H "Authorization: Bearer $NATBOX_API_KEY" https://my.natbox.io/api/natbox/v1/servers
{"servers":[{"id":123,"name":"vps123","label":"My bot","plan":"Box","status":"active",
  "expires_at":"2027-01-05","trial":false,"cancelled":false,"url":"https://my.natbox.io/services/123"}]}

4. Endpoints

RequestWhat it doesAccess
GET /meThe account and key you are usingRead
GET /osSystems you can install (debian13, ubuntu2604, ...)Read
GET /serversAll your serversRead
GET /servers/{id}One server: state (running or stopped), os, ssh, ports, ipv6, and task while a reinstall runsRead
GET /servers/{id}/usageMemory and disk now, plan limits, traffic this month. Add ?range=24h, 7d or 30d for the graph dataRead
GET /servers/{id}/snapshotsYour snapshots and your plan's limitRead
POST /servers/{id}/startStart (also /stop, /restart)Full
POST /servers/{id}/passwordNew root password, returned onceFull
POST /servers/{id}/reinstallErase and reinstall, see belowFull
POST /servers/{id}/snapshotsTake a snapshotFull
POST /servers/{id}/snapshots/{name}/restoreGo back to a snapshotFull
DELETE /servers/{id}/snapshots/{name}Delete a snapshotFull

Snapshots follow the same rules as in the client area, including your plan's snapshot limit. Changes work while a server is active; a suspended server can be listed but not changed.

5. Reinstall

A reinstall erases the whole disk, so it needs the server's name in confirm:

curl -X POST -H "Authorization: Bearer $NATBOX_API_KEY" -H "Content-Type: application/json" \
  -d '{"os":"debian13","confirm":"vps123"}' https://my.natbox.io/api/natbox/v1/servers/123/reinstall

It answers 202 straight away and runs in the background, usually for under a minute and at most a few minutes. Check GET /servers/123 until task.state is done (or failed), then call POST /servers/123/password to get a root password. We never keep the password, so it is not part of the reinstall answer. Your ports, IPv4 and IPv6 addresses stay the same. If you ordered a one-click app, reinstall with Debian 12 or Ubuntu 24.04 and the app is installed again.

6. Errors and limits

Errors come with an HTTP status and a short message you can show to a person:

{"error":{"code":"read_only","message":"This API key is read only. Create a key with full access to make changes."}}
StatusMeaning
401No key, or the key was deleted
403The key is read only (read_only)
404No such endpoint, or no server with that number on your account
409Not possible right now: the server is suspended, stopped for a reinstall, or the action was refused (the message says why)
422Something in the request is missing or wrong
429Too many requests; retry_after says how many seconds to wait

Limits: 120 requests a minute per key, and 10 changes a minute per account (start, stop, restart, password, reinstall and snapshots together, the same as in the client area).

7. Examples

Restart a server after each deploy, in GitHub Actions with the key saved as a secret:

- name: Restart my natbox server
  run: |
    curl -fsS -X POST -H "Authorization: Bearer ${{ secrets.NATBOX_API_KEY }}" \
      https://my.natbox.io/api/natbox/v1/servers/123/restart

A snapshot every night before you run updates, from any computer with cron:

0 3 * * * NATBOX_API_KEY=nbx_... /home/me/.local/bin/natbox snapshot vps123

A fresh test server for each test run:

natbox reinstall vps123 debian13 --yes && natbox password vps123

AI agents: give the agent a read-only key to check on your servers, or a full key on a server you use for experiments. The agent can read this page to learn the API.

Questions or a missing endpoint? Open a ticket or ask on Telegram. Keep your keys secret: anyone with a full key can reinstall your servers.