API reference

Everything the panel does is available through the API. Every path below starts with https://your-panel:8443/api/v1.

Authentication

Create a token in the panel under API tokens and send it with each request.

curl -H "Authorization: Bearer klyrnvm_..." https://panel.example.com:8443/api/v1/vms

Requests and answers are JSON. A list takes page, page_size, sort and q, and answers with items, total, page, page_size and pages. A page holds 50 items unless you ask for more, up to 200.

Errors

An error answers with a code, a message and sometimes a hint.

{"error": {"code": "capacity", "message": "No host has 8 GB of memory free."}}
CodeStatusMeaning
invalid400The request is wrong. The message says which field
unauthenticated401The token is missing or no longer valid
forbidden403The token may not do this
not_found404Nothing has that id
conflict409The request clashes with something that exists
not_ready409The target is busy or not set up yet
capacity409No host has room. The message says what is short
rate_limited429Too many requests. Wait and try again
unavailable503The host is offline
internal500A fault on our side

Machines

A customer's token reaches only that customer's machines. Actions that take time answer with a task.

MethodPathWhat it does
GET/vmsList machines. Filter with status, node, project or q
POST/vmsCreate a machine
GET/vms/{id}Read one machine
PATCH/vms/{id}Change a machine's name or hostname
DELETE/vms/{id}Delete a machine. Send its name as confirm
POST/vms/{id}/startStart
POST/vms/{id}/shutdownShut down cleanly
POST/vms/{id}/rebootRestart
POST/vms/{id}/force-stopCut the power. Needs confirm
POST/vms/{id}/resetHard reset. Needs confirm
POST/vms/{id}/reset-passwordSet a new password. Leave password out to get a generated one, shown once
POST/vms/{id}/consoleOpen a console session. kind is vnc or serial
GET/vms/{id}/metricsProcessor, memory, disk and network over time. Takes res and hours
GET/vms/{id}/tasksTasks for this machine
GET/vms/{id}/activityWho did what to this machine
GET/vms/{id}/migration-targetsHosts this machine can move to. Administrators only
POST/vms/{id}/migrateMove the machine to another host. Administrators only

A chosen password needs 12 to 128 characters with three of lowercase, uppercase, digits and symbols. KLYRN VM never stores it.

Tasks

MethodPathWhat it does
GET/tasksList tasks. Filter with status, op, node or resource_kind
GET/tasks/{id}Read one task
GET/tasks/{id}/eventsThe steps of a task so far
POST/tasks/{id}/cancelCancel a running task
GET/eventsA live stream of changes, as server-sent events

Hosts

Administrators only.

MethodPathWhat it does
GET/nodesList hosts. Filter with state, mode or location
POST/nodes/bootstrapMake the command that adds a new host. The token is shown once
GET/nodes/{id}Read one host with its capacity and health
PATCH/nodes/{id}Rename a host, or set maintenance and overcommit
DELETE/nodes/{id}Remove a host. Refused while machines run on it
POST/nodes/{id}/preflightCheck the host again
GET/nodes/{id}/samplesCapacity by the hour. Takes hours

Images

MethodPathWhat it does
GET/imagesList the systems a machine can be built from
POST/imagesAdd your own image. Administrators only
PATCH/images/{id}Switch an image on or off. Administrators only
POST/images/{id}/pullDownload an image to a host ahead of time. Administrators only

Networks and addresses

Administrators only, apart from the calls on a customer's own machine.

MethodPathWhat it does
GET/networksList networks with their pools
POST/networksAdd a network
DELETE/networks/{id}Remove a network. Refused while addresses are in use
POST/networks/{id}/poolsAdd an address pool to a network
GET/poolsList pools with how full each one is
PATCH/pools/{id}Change a pool. Its range of addresses cannot change
GET/pools/{id}/allocationsEvery address in a pool and who holds it
POST/pools/{id}/reservationsSet addresses aside. A note is required
POST/pools/{id}/blockTake one address out of service
GET/vms/{id}/networkingA machine's addresses, firewall groups and traffic this month
POST/vms/{id}/ipsGive a machine another address, up to its plan's limit
POST/vms/{id}/ips/detachTake an address away. The first address stays

Firewall

MethodPathWhat it does
GET/security-groupsList your firewall groups
POST/security-groupsCreate a group. By default it blocks incoming and allows outgoing
POST/security-groups/{id}/rulesAdd a rule. Every machine in the group gets it at once
DELETE/security-groups/{id}/rules/{rid}Remove a rule
PUT/vms/{id}/security-groupsSet which groups a machine uses

Traffic and backups

MethodPathWhat it does
GET/trafficTraffic for every machine you can see. Takes period as YYYY-MM
GET/vms/{id}/trafficOne machine's traffic for twelve months
PUT/plans/{id}/trafficSet a plan's allowance and what happens at the limit. Administrators only
GET/backups/scheduleEach scheduled machine, its last backup and its next one
PUT/plans/{id}/backupsSet a plan's backup schedule. Administrators only

A lower allowance starts next month, so no machine is put over a limit it did not have. Saving a backup schedule deletes nothing by itself.

Plans, people and tokens

MethodPathWhat it does
GET, POST/plansList or add plans
GET, POST/projectsList or add projects
GET, POST/ssh-keysList or add your SSH keys
GET, POST/tokensList or create API tokens. A new token is shown once
GET/admin/usersList people. Administrators only
PATCH/admin/users/{id}Change a person's name, email or role
POST/admin/users/{id}/suspendSuspend a person. They see the reason you give
POST/admin/users/{id}/restoreLift a suspension
GET/activityThe audit log. Customers see their own entries

Billing API

A billing system uses these calls to sell machines. The token needs the provision scope. Every path starts with /provision.

MethodPathWhat it does
GET/provision/cataloguePlans, images and locations in one call
POST/provision/servicesCreate a service and its machine
GET/provision/services/{id}Read one service
GET/provision/by-ref/{ref}Find a service by your billing system's own id
POST/provision/services/{id}/suspendSuspend. No disk is touched
POST/provision/services/{id}/unsuspendLift the suspension
POST/provision/services/{id}/change-planResize the same machine to another plan
POST/provision/services/{id}/reinstallNew system, same machine, same address
POST/provision/services/{id}/terminateDelete. Needs confirm
POST/provision/services/{id}/retryTry again after a failed build
POST/provision/services/{id}/ssoA sign-in link for the customer. It works once, for 90 seconds
GET/provision/services/{id}/usageTraffic for a month

Send an idempotency_key with every create. If your billing system sends the same order twice, you get one machine and the same answer both times.

A service is provisioning, active, suspended, terminated or provisioning_failed. A failed build holds no address and no storage, and retry builds it again under the same id.

Discord WhatsApp