Skip to content

Customer API keys & server sharing

Two self-service features for customers in the portal: API keys for the customer API, and sharing a server with another customer.

The customer API is off by default. Switch it on under Settings > Customer portal with the feature Customer API, for a customer group (the group’s portal features), or for one customer (customer page, tab Portal). Resellers can switch it per customer on their customer page.

On Account settings > API keys a customer creates a key with:

  • Name: shown in the list.
  • Expires on: optional; the key stops working after that day.
  • Allowed IPs: optional addresses or networks, one per line.
  • Read only: the key can read status, graphs and lists but change nothing.
  • Current password: needed to create a key.

The key (nxc_...) is shown once. Only a hash is stored. A customer can have up to 10 keys and revoke any of them at once. Admins viewing the portal as a customer cannot create or revoke keys.

Terminal window
curl -H "Authorization: Bearer nxc_..." https://panel.example.com/api/portal/v1/servers
curl -H "Authorization: Bearer nxc_..." -H "Content-Type: application/json" \
-d '{"action":"reboot"}' \
https://panel.example.com/api/portal/v1/hosts/1/guests/qemu/100/power

The full endpoint list is in the portal under Account settings > API keys > API reference (/portal/api): server list, status, spec, graphs, disk usage, traffic, power, power cycle, console, reinstall, root password, snapshots, backups and firewall. Answers use {"success": ..., "data": ..., "error": ...}.

For VMs there are also boot and rescue endpoints. They work for the owner only (never on a shared server) and need the portal features Boot order and firmware and Rescue system:

EndpointWhat it does
GET .../bootBoot order, firmware and rescue state.
POST .../boot/orderBoot first from first = disk, cd or net.
POST .../boot/firmwareSwitch firmware to seabios or ovmf (the VM must be stopped).
POST .../rescueRestart the VM into the rescue system.
POST .../rescue/endEnd rescue mode and boot from disk again.

... stands for /api/portal/v1/hosts/{hostId}/guests/qemu/{vmid}.

The API does exactly what the portal allows: the customer’s portal feature switches, a server lock, a suspended plan and a traffic suspension refuse the same actions. Limits per key: 60 requests per minute. A wrong key counts towards the API login jail.

StatusMeaning
401Unknown, revoked or expired key
403API or feature off, address not allowed, account blocked, portal off, read-only key used for a change
404Not one of the customer’s servers, or the share does not allow the action
409Server locked, suspended or busy
422Refused, the error says why
429Rate limit

The owner of a server opens the server page, Sharing, enters an email address and a role:

  • Manage: power, console, reinstall, root password, snapshots, backups and firewall.
  • View only: status and graphs.

Billing, renewals, upgrades, port forwards and deleting always stay with the owner.

The invited person gets an email with a link (valid 7 days). They sign in with that address and accept; the server then shows in their list with a Shared badge. Only a customer of the same provider (the same reseller, or the operator) can accept. The owner sees whether an invite is still open and can remove a share at any time; the other customer can Leave. An owner can send up to 10 invitations an hour, and one address gets at most 3 a day.

Shares end when the server is deleted or gets a new owner. They stay when the server is migrated or failed over. Shared servers are reachable through the customer API with the same role.

Audit entries: customer_api.key_create, customer_api.key_revoke, guest.share_invite, guest.share_accept, guest.share_remove, guest.share_leave. The server’s activity shows shared and unshared events.

NexoVirt is developed and designed by Nucez Software, your partner for custom software and web design.