natbox API and command-line tool
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:
- Full access: everything below.
- Read only: see your servers, snapshots and usage, change nothing. Good for dashboards and monitoring.
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
- Base URL:
https://my.natbox.io/api/natbox/v1 - Send the key in every request:
Authorization: Bearer nbx_... - Requests with a body use JSON (
Content-Type: application/json). Every answer is JSON. - A server is named by its number:
vps123is123.
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
| Request | What it does | Access |
|---|---|---|
GET /me | The account and key you are using | Read |
GET /os | Systems you can install (debian13, ubuntu2604, ...) | Read |
GET /servers | All your servers | Read |
GET /servers/{id} | One server: state (running or stopped), os, ssh, ports, ipv6, and task while a reinstall runs | Read |
GET /servers/{id}/usage | Memory and disk now, plan limits, traffic this month. Add ?range=24h, 7d or 30d for the graph data | Read |
GET /servers/{id}/snapshots | Your snapshots and your plan's limit | Read |
POST /servers/{id}/start | Start (also /stop, /restart) | Full |
POST /servers/{id}/password | New root password, returned once | Full |
POST /servers/{id}/reinstall | Erase and reinstall, see below | Full |
POST /servers/{id}/snapshots | Take a snapshot | Full |
POST /servers/{id}/snapshots/{name}/restore | Go back to a snapshot | Full |
DELETE /servers/{id}/snapshots/{name} | Delete a snapshot | Full |
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."}}
| Status | Meaning |
|---|---|
401 | No key, or the key was deleted |
403 | The key is read only (read_only) |
404 | No such endpoint, or no server with that number on your account |
409 | Not possible right now: the server is suspended, stopped for a reinstall, or the action was refused (the message says why) |
422 | Something in the request is missing or wrong |
429 | Too 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.