Virtual Servers API (v2)

The base URL for this API is: https://api.leaseweb.com/cloud/v2

Errors

The API uses standard HTTP status codes to indicate the success or failure of the API call. The response will be JSON. Most APIs use the following format:

{
"errorCode" : "APP00800",
"errorMessage" : "The connection with the DB cannot be established.",
"correlationId" : "550e8400-e29b-41d4-a716-446655440000",
"userMessage" : "Cannot handle your request at the moment. Please try again later.",
"reference" : "http://developer.leaseweb.com/errors/APP00800"
}

Authentication

Authentication for the APIs is required. To authenticate your call, you will need to sent your API key as X-LSW-Auth header.

You can generate API keys in the Customer Portal.

Virtual servers

List virtual servers

Authorizations:
query Parameters
limit
integer
Default: 10

Limit the number of results returned

offset
integer
Default: 0

Return results starting from the given offset

Responses

200
401

Authentication is required.

403
500
503
get/virtualServers
https://api.leaseweb.com/cloud/v2/virtualServers

Request samples

Copy
curl --request GET \
  --url 'https://api.leaseweb.com/cloud/v2/virtualServers?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "virtualServers":
    [
    ],
  • "_metadata":
    {
    }
}

Inspect a virtual server

Authorizations:
path Parameters
virtualServerId
required
string
Example: 123242

Id of the virtual server

Responses

200
401

Authentication is required.

403
404
500
503
get/virtualServers/{virtualServerId}
https://api.leaseweb.com/cloud/v2/virtualServers/{virtualServerId}

Request samples

Copy
curl --request GET \
  --url https://api.leaseweb.com/cloud/v2/virtualServers/123242 \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "222903",
  • "reference": "Web server",
  • "customerId": "1301178860",
  • "dataCenter": "AMS-01",
  • "cloudServerId": null,
  • "state": "STOPPED",
  • "firewallState": "DISABLED",
  • "template": "Ubuntu 14.04 64 40 20140707T1340",
  • "serviceOffering": "S",
  • "sla": "Bronze",
  • "contract":
    {
    },
  • "hardware":
    {
    },
  • "iso":
    {
    },
  • "ips":
    [
    ]
}

Update a virtual server

Authorizations:
path Parameters
virtualServerId
required
string
Example: 123242

Id of the virtual server

Request Body schema: application/json
reference
required
string

The reference description for the virtual server

Responses

200
401

Authentication is required.

403
404
500
503
put/virtualServers/{virtualServerId}
https://api.leaseweb.com/cloud/v2/virtualServers/{virtualServerId}

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "reference": "My reference"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "222903",
  • "reference": "Web server",
  • "customerId": "1301178860",
  • "dataCenter": "AMS-01",
  • "cloudServerId": null,
  • "state": "STOPPED",
  • "firewallState": "DISABLED",
  • "template": "Ubuntu 14.04 64 40 20140707T1340",
  • "serviceOffering": "S",
  • "sla": "Bronze",
  • "contract":
    {
    },
  • "hardware":
    {
    },
  • "iso":
    {
    },
  • "ips":
    [
    ]
}

Power on

The power on call is an asynchronous call, meaning the power on will be performed as soon as possible.

Authorizations:
path Parameters
virtualServerId
required
string
Example: 123242

Id of the virtual server

Responses

202
401

Authentication is required.

403
404
500
503
post/virtualServers/{virtualServerId}/powerOn
https://api.leaseweb.com/cloud/v2/virtualServers/{virtualServerId}/powerOn

Request samples

Copy
curl --request POST \
  --url https://api.leaseweb.com/cloud/v2/virtualServers/123242/powerOn \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "cs01.237daad0-2aed-4260-b0e4-488d9cd55607",
  • "name": "virtualServers.powerOn",
  • "status": "PENDING",
  • "createdAt": "2016-12-31T01:00:59+00:00"
}

Power off

The power off call is an asynchronous call, meaning the power off will be performed as soon as possible.

Authorizations:
path Parameters
virtualServerId
required
string
Example: 123242

Id of the virtual server

Responses

202
401

Authentication is required.

403
404
500
503
post/virtualServers/{virtualServerId}/powerOff
https://api.leaseweb.com/cloud/v2/virtualServers/{virtualServerId}/powerOff

Request samples

Copy
curl --request POST \
  --url https://api.leaseweb.com/cloud/v2/virtualServers/123242/powerOff \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "cs01.237daad0-2aed-4260-b0e4-488d9cd55607",
  • "name": "virtualServers.powerOff",
  • "status": "PENDING",
  • "createdAt": "2016-12-31T01:00:59+00:00"
}

Reboot

The reboot call is an asynchronous call, meaning the reboot will be performed as soon as possible.

Authorizations:
path Parameters
virtualServerId
required
string
Example: 123242

Id of the virtual server

Responses

202
401

Authentication is required.

403
404
500
503
post/virtualServers/{virtualServerId}/reboot
https://api.leaseweb.com/cloud/v2/virtualServers/{virtualServerId}/reboot

Request samples

Copy
curl --request POST \
  --url https://api.leaseweb.com/cloud/v2/virtualServers/123242/reboot \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Respo