TOPICS
API

API Quickstart

For the Quickstart, we will create our API ID and key, and use it to create a VM.

First, create the API keypair from the API tab. You can leave the name and restrictions empty, or set them if desired.

Next, get the Python library and save it.

Create a Python script in the same directory:

from lndynamic3 import LNDynamic
api_id = '{API ID}'
api_key = '{API KEY}'
client = LNDynamic(api_id, api_key)
params = {
	'hostname': 'myvm',
	'plan_id': 'm.4',
	'image_id': '94953',
}
print(client.request('vm', 'create', params))

If you run the script, you should see that a VM gets created!