Skip to content

Using the QuackPlane API

An API key lets your own code, such as a Discord bot or a script, do what you do in QuackPlane: start and stop your server, run commands on its console and take backups. The key acts as your account, so it can do everything you can, on every server you can open in QuackPlane.

  1. In QuackPlane, select API keys in the list on the left.

  2. Under Description, say what will use the key, such as Discord bot, so you can tell your keys apart later.

  3. If your code always runs from the same IP address, enter it under Allowed IPs and press Enter. The key then works only from there. Leave it empty to use the key from anywhere.

  4. Select Create, and copy the key from the message that appears. It starts with pacc_, and QuackPlane shows it only this once.

To stop a key working, delete it from the list of your keys on the same page.

Every request takes two headers: Authorization, with your key after Bearer, and Accept: application/json. Without the second, QuackPlane answers a request it refuses with a web page, such as its login page, instead of JSON saying why. This lists your servers:

curl https://plane.quack.host/api/client \
-H "Authorization: Bearer pacc_YourKey" \
-H "Accept: application/json"

Each request below adds its path, such as /power, to this address, which ends in your server’s ID:

https://plane.quack.host/api/client/servers/1a2b3c4d

The ID is the identifier in the list of your servers, and your server’s Settings page shows it too, after “ID” in the small print at the bottom. Send a body as JSON, with Content-Type: application/json.

  • GET /resources

    Your server’s state in current_state, such as running or offline, and the memory, CPU and disk it’s using.

  • POST /power

    Starts, stops or restarts your server: send {"signal": "start"}, "stop" or "restart". "kill" stops it at once, losing whatever it hasn’t saved.

  • POST /command

    Runs a command on your server’s console: send {"command": "say Hello"}. Your server has to be running.

  • GET /backups

    Lists your server’s backups.

  • POST /backups

    Takes a backup, named by {"name": "Before the update"}, or by the date and time if you send no name. It’s refused once your server has as many backups as it keeps.

This restarts the server with the ID 1a2b3c4d:

curl -H "Authorization: Bearer pacc_YourKey" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"signal": "restart"}' \
https://plane.quack.host/api/client/servers/1a2b3c4d/power

QuackPlane lists every request it takes, such as for files and schedules, at plane.quack.host/docs/api/client, while you’re logged in.

Stuck on something? Ask our Discord flock, where fellow server administrators are happy to help.