Overview

VirtFusion Global API

You can use this API to access all Administrator API endpoints, such as the server API to deploy and manage servers, or the system API to configure and manage the system.

The API is organized around REST. All requests should be made over SSL. All request and response bodies, including errors, are encoded in JSON.

Base URL

https://cp.domain.com/api/v1

Replace the host with your Control Server's address. Every path in this reference is relative to it.

Authentication

Every request carries an API token as a bearer token. Tokens are created under Configuration → API in the admin area, where each token can be restricted to a list of IP addresses, given a rate limit and an expiry.

Authorization: Bearer <token>
Accept: application/json

A missing, invalid or expired token returns 401 with no body.

Responses

Successful responses wrap their payload in data. Paged lists use the paginator envelope described under Pagination; the results and page query parameters move through the set. Errors return a JSON body with an errors array, or msg on the older endpoints. Every operation page lists the statuses it can return.

StatusMeaning
200Done. The payload is under data.
201Created. The new record is under data.
204Done. There is no response body.
401The token is missing, invalid or expired. There is no body.
403The token does not have the permission the endpoint requires.
404The record the path names does not exist.
409The request conflicts with the current state, such as an action on a server that is not in the right state for it.
422The input was rejected. errors names what was wrong.
423The server is locked: tasks are pending in its queue, or Do Not Disturb is on. Retry later.
424A dependent step failed, such as a profile or pack that could not be applied.
429Too many requests. See Rate limiting below.
503The server's hypervisor is in maintenance mode, or a status check failed.

Token permissions

A token carries a list of permissions, chosen when it is created under Configuration → API. The list is an opt-in set of the operations considered dangerous, and a token is allowed every operation that is not on it. Ticking nothing therefore grants everything except the listed operations, and ticking an operation grants that one as well. An operation that requires a permission says so on its own page and answers 403 without it.

PermissionOperations it covers
Create ServerCreate a server
Build ServerBuild a server
Change Server PackageChange a server's package
Delete ServerDelete a server
Reset Server PasswordReset a server's password
Rescue ServerStart and end a rescue session, and read its login details
Elevate ServerElevate a server, commit a drive and discard an elevation
Delete Server DiskDelete a disk from a server
Create UserCreate a user
Reset User PasswordReset a user's password
Authenticate UserCreate an authentication token for a user or one of their servers
Modify UserModify a user
Delete UserDelete a user

Rate limiting

Two limits apply, both measured per minute.

Requests per token

Each token has a Rate Limit (RPM), set when the token is created or edited under Configuration → API. The default is 5000 requests per minute; 0 removes the limit for that token. Every response carries the token's standing:

HeaderMeaning
X-RateLimit-LimitThe token's requests per minute.
X-RateLimit-RemainingRequests left in the current minute.
X-RateLimit-ResetUnix timestamp at which the minute resets.

Once the limit is reached, requests are refused with 429, the body {"errors": ["Too Many Requests"]} and a Retry-After header giving the seconds to wait. Refused requests do not count against the limit, so a client that honours Retry-After recovers at the reset.

Failed authentication per address

An address that fails authentication 10 times within a minute is refused for the rest of that minute with 429, a Retry-After header and the body {"errors": ["Too many authentication attempts. Try again later."], "retry_after_seconds": 42}. A successful request clears the count.

Groups

GeneralConnectivity and token checks.2 operationsHypervisorsHypervisor inventory and performance metrics.5 operationsHypervisor GroupsHypervisor groups and their aggregated resources.3 operationsServersCreate, build, modify and manage servers.20 operationsServers/NetworkIPv4 assignment and the network whitelist for a server's interfaces.18 operationsServers/Network/FirewallPer-interface firewall state and rulesets.11 operationsServers/Network/TrafficTraffic allowance, traffic policy and traffic blocks.5 operationsServers/PowerQueued power actions.4 operationsServers/Backup ManagerBackup Manager actions scoped to one server.3 operationsServers/Migration/HybridOffline (hybrid) migration: destinations, start, retry, complete and revert.8 operationsServers/Migration/LiveLive migration with libvirt: start, status, resume and recovery actions.7 operationsServers/Hypervisor AssetsAttach, detach and order hypervisor assets such as passthrough devices.6 operationsIP BlocksIP blocks, their IPv4 addresses and reservations.25 operationsReverse DNSPTR records on IPv4 and IPv6 addresses, and the reverse DNS zones that carry them.4 operationsBackup ManagerBackup Manager backups and jobs across all servers.5 operationsBackups (Deprecated)Legacy backup system. Superseded by Backup Manager.1 operationsDNSDNS service configuration.1 operationsMediaISO images and operating system templates.9 operationsPackagesServer packages.6 operationsQueue & TasksQueued tasks and their progress.1 operationsSSH KeysSSH public keys on user accounts.4 operationsUsersUser accounts.1 operationsUsers/External Rel ID & Rel StrUser operations addressed by external relation ID or relation string, for billing integrations.6 operationsSelf ServiceSelf-service resource packs, credit and currencies.8 operationsSelf Service/External Relational IDSelf-service operations for a user addressed by external relation ID.11 operationsHypervisors/Networks5 operationsHypervisors/IP Blocks5 operationsServers/Elevate4 operationsServers/Rescue3 operationsServers/Media3 operationsServers/Storage7 operations