Overview

Each API token consists of an API ID and an API key. Both are needed for authentication of all API commands.

API actions consist of a category label, action label, and a set of parameters. For example, to start a VM, the category label is "vm", action label is "start", and a "vm_id" parameter must be set. See the full API action list.

API requests are made over HTTPS. Once the server completes processing of your request, it will return a JSON-encoded response.

Usage

We provide open source (under MIT License) PHP and Python libraries for accessing the Luna Node Dynamic API. These libraries make interaction with the API easier, handling transaction from category, action, and parameters to the HTTPS request, and from the JSON-encoded response to a PHP associative array or Python dictionary. Get the libraries here.

Calculate the signature as SHA512-HMAC("{handler path}|{raw request message}|{nonce}"), using the API key as the HMAC key; here, we are signing the string formed from concatenating handler path, raw request message, and nonce delimited by pipe (|) characters

The legacy API isn't necessarily less secure than the newer API, as either way all API actions are encrypted under HTTPS; however, the new API does offer greater protection against timing attacks and hides the API key even if an attacker were able to successfully forge an SSL certificate. So, we encourage usage of the new API where it is not inconvenient, but we plan to maintain the legacy API indefinitely.

Action list

This list serves as a reference for available API actions. See API Detail for additional details for some API operations.

Note: for create command, net_id is a network ID number, securitygroups is a comma-separated list of security group ID numbers, scripts is a comma-separated list of script ID numbers, volume_id is the ID number of an unattached volume that the new VM should be booted from (if volume_id is set, image_id is not required), and affinity_group is an affinity group UUID. Also, if volume_id is set, then the driver is ide if volume_virtio is not set, or virtio of volume_virtio is set (value of volume_virtio is ignored). Finally, key_id is an SSH keypair ID, and set_password can be set if you want the system to add a startup script to set a randomly generated password (this is ignored if key_id is set; also, the system will set password by default for official templates).

policy (optional): geo-targeting policy, 'none' for no geo-targeting, 'latlong' to route to record with closest latitude/longitude to the user's location, and 'region' for hierarchical region-based routing

weight (optional): the record weight (this is used for load balancing or non-round-robin DNS failover)