LeaseWeb API for launching and managing VPS (v1)

License: Apache 2.0

The base URL for this API is: https://api.leaseweb.com/publicCloud/v1/

This API provides ways to launch and manage VPS.

BETA
This API is in BETA. Documentation might be incorrect or incomplete. Functionality might change with the final release.

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": "https://developer.leaseweb.com/errors/APP00800"
}

API Key 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.

Power

Start a specific resource (Instance, Load Balancer, Vps)

The resource must be stopped before the execution

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (resource)
Enum: "instances" "loadBalancers" "vps"

Type of resource (Instances, Load Balancers, or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID), loadBalancerId (UUID), or vpsId (numeric string).

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/start \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "400",
  • "errorDetails": { },
  • "errorMessage": "The API could not interpret your request correctly."
}

Stop a specific resource (Instance, Load Balancer, Vps)

The resource must be running before the execution

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (resource)
Enum: "instances" "loadBalancers" "vps"

Type of resource (Instances, Load Balancers, or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID), loadBalancerId (UUID), or vpsId (numeric string).

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/stop \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "400",
  • "errorDetails": { },
  • "errorMessage": "The API could not interpret your request correctly."
}

Reboot a specific resource (Instance, Load Balancer, Vps)

The resource must be running before the execution

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (resource)
Enum: "instances" "loadBalancers" "vps"

Type of resource (Instances, Load Balancers, or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID), loadBalancerId (UUID), or vpsId (numeric string).

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/reboot \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "400",
  • "errorDetails": { },
  • "errorMessage": "The API could not interpret your request correctly."
}

Credentials

List credentials stored for a specific resource (Instance or Vps).

Get all credentials stored for the resource

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (baseResource)
Enum: "instances" "vps"

Type of resource (Instances or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID) or vpsId (numeric string).

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/credentials \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "_metadata": {
    },
  • "credentials": [
    ]
}

Store credentials for a specific resource (Instance or Vps).

Store credential used for a specific resource.

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (baseResource)
Enum: "instances" "vps"

Type of resource (Instances or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID) or vpsId (numeric string).

Request Body schema: application/json
required
type
required
string (credentialType)
Enum: "OPERATING_SYSTEM" "CONTROL_PANEL"
username
required
string

Can contain only alphanumeric values and characters @, ., - and _

password
required
string

The password you'd like to store

Responses

Request samples

Content type
application/json
{
  • "password": "12341234",
  • "type": "OPERATING_SYSTEM",
  • "username": "root"
}

Response samples

Content type
application/json
{
  • "password": "12341234",
  • "type": "OPERATING_SYSTEM",
  • "username": "root"
}

Delete all credentials associated with a specific resource (Instance or Vps)

Delete all credentials stored for a given resource.

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (baseResource)
Enum: "instances" "vps"

Type of resource (Instances or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID) or vpsId (numeric string).

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/credentials \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "401",
  • "errorMessage": "You are not authorized to view this resource."
}

Get credentials by type for a specific resource (Instance or Vps).

Get credentials stored for the resource by their types

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (baseResource)
Enum: "instances" "vps"

Type of resource (Instances or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID) or vpsId (numeric string).

type
required
string (credentialType)
Enum: "OPERATING_SYSTEM" "CONTROL_PANEL"

Type of credential

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/credentials/%7Btype%7D \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "_metadata": {
    },
  • "credentials": [
    ]
}

Get credentials by type and username for a specific resource (Instance or Vps).

Get credentials by type and username

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (baseResource)
Enum: "instances" "vps"

Type of resource (Instances or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID) or vpsId (numeric string).

type
required
string (credentialType)
Enum: "OPERATING_SYSTEM" "CONTROL_PANEL"

Type of credential

username
required
string
Example: root

Username

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/credentials/%7Btype%7D/root \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "password": "12341234",
  • "type": "OPERATING_SYSTEM",
  • "username": "root"
}

Update credentials for a specific resource (Instance or Vps).

Update credentials for a given type and username

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (baseResource)
Enum: "instances" "vps"

Type of resource (Instances or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID) or vpsId (numeric string).

type
required
string (credentialType)
Enum: "OPERATING_SYSTEM" "CONTROL_PANEL"

Type of credential

username
required
string
Example: root

Username

Request Body schema: application/json
required
password
required
string

The new password

Responses

Request samples

Content type
application/json
{
  • "password": "12341234"
}

Response samples

Content type
application/json
{
  • "password": "12341234",
  • "type": "OPERATING_SYSTEM",
  • "username": "root"
}

Delete credentials for a specific resource (Instance or Vps).

Delete credential for a given type and username

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (baseResource)
Enum: "instances" "vps"

Type of resource (Instances or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID) or vpsId (numeric string).

type
required
string (credentialType)
Enum: "OPERATING_SYSTEM" "CONTROL_PANEL"

Type of credential

username
required
string
Example: root

Username

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/credentials/%7Btype%7D/root \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "401",
  • "errorMessage": "You are not authorized to view this resource."
}

Reset the password for a specific resource (Instance or Vps).

The operation may take a few moments to complete.

You can obtain the new credential using the credentials endpoints

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (baseResource)
Enum: "instances" "vps"

Type of resource (Instances or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID) or vpsId (numeric string).

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/resetPassword \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "400",
  • "errorDetails": { },
  • "errorMessage": "The API could not interpret your request correctly."
}

ISOs

Attach ISO to a specific resource (Instance or Vps)

Resource must not have ISO attached, otherwise, it will return a validation error.

Available ISOs can be obtained using /v1/isos.

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (baseResource)
Enum: "instances" "vps"

Type of resource (Instances or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID) or vpsId (numeric string).

Request Body schema: application/json
required
isoId
required
string

The ISO ID, obtained using the ISO endpoints

Responses

Request samples

Content type
application/json
{
  • "isoId": "GRML"
}

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "400",
  • "errorDetails": { },
  • "errorMessage": "The API could not interpret your request correctly."
}

Detach ISO from a specific resource (Instance or Vps)

Resource must have ISO attached, otherwise, it will return a validation error

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (baseResource)
Enum: "instances" "vps"

Type of resource (Instances or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID) or vpsId (numeric string).

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/detachIso \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "400",
  • "errorDetails": { },
  • "errorMessage": "The API could not interpret your request correctly."
}

Metrics

Get data traffic metrics for a specific resource (Instance, Load Balancer, Vps)

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (resource)
Enum: "instances" "loadBalancers" "vps"

Type of resource (Instances, Load Balancers, or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID), loadBalancerId (UUID), or vpsId (numeric string).

query Parameters
from
string <date>

The start of the interval to get the metric

to
string <date>

The end of the interval to get the metric. Must be greater than the date provided in from

granularity
string
Value: "DAY"

How the metrics are grouped by

aggregation
string
Value: "SUM"

How the metrics are aggregated

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/metrics/datatraffic \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "_metadata": {
    },
  • "metrics": {
    }
}

VPS

Get VPS list

List and filter VPS

Authorizations:
X-LSW-Auth
query Parameters
limit
integer
Example: limit=20

Limit the number of results returned.

offset
integer
Example: offset=10

Return results starting from the given offset.

id
string
Example: id=123581321

Equipment Id

reference
string
Example: reference=Foo bar
state
string
Enum: "RUNNING" "STARTING" "STOPPED" "STOPPING"

The current state

pack
string
Enum: "Leaseweb VPS 1" "Leaseweb VPS 2" "Leaseweb VPS 3" "Leaseweb VPS 4" "Leaseweb VPS 5" "Leaseweb VPS 6"

Vps package type

region
string (regionName)
Enum: "eu-west-3" "us-east-1" "eu-central-1" "ap-southeast-1" "us-west-1" "eu-west-2" "ca-central-1"

region name

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/publicCloud/v1/vps?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE&id=SOME_STRING_VALUE&reference=SOME_STRING_VALUE&state=SOME_STRING_VALUE&pack=SOME_STRING_VALUE&region=SOME_STRING_VALUE' \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "_metadata": {
    },
  • "vps": [
    ]
}

Get VPS details

Get VPS details.

Authorizations:
X-LSW-Auth
path Parameters
vpsId
required
string
Example: 123581321

Vps ID

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/vps/123581321 \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "id": "123581321",
  • "pack": "Leaseweb VPS 2",
  • "resources": {
    },
  • "region": "eu-central-1",
  • "datacenter": "FRA-01",
  • "reference": "testing",
  • "image": {
    },
  • "marketAppId": null,
  • "state": "RUNNING",
  • "hasPublicIpV4": true,
  • "rootDiskSize": 50,
  • "ips": [
    ],
  • "contract": {
    },
  • "startedAt": "2024-10-24T21:13:25+00:00",
  • "iso": null
}

IPs

List IP addresses associated with a specific resource (Instance, Load Balancer, or Vps)

List the resource's IPs

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (resource)
Enum: "instances" "loadBalancers" "vps"

Type of resource (Instances, Load Balancers, or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID), loadBalancerId (UUID), or vpsId (numeric string).

query Parameters
version
integer (ipVersion)
Enum: 4 6

Ip version

nullRouted
boolean
ips
string

A list of IPs separated by |

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/ips \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "_metadata": {
    },
  • "ips": [
    ]
}

Get IP details for a specific resource (Instance, Load Balancer, or Vps)

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (resource)
Enum: "instances" "loadBalancers" "vps"

Type of resource (Instances, Load Balancers, or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID), loadBalancerId (UUID), or vpsId (numeric string).

ip
required
string <ip>
Example: 10.0.0.1

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/ips/%7Bip%7D \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "ip": "10.0.0.1",
  • "prefixLength": "28",
  • "version": 4,
  • "reverseLookup": "a-valid-domain.xpto",
  • "mainIp": false,
  • "networkType": "INTERNAL",
  • "nullRouted": true,
  • "ddos": {
    }
}

Update the IP address for a specific resource (Instance, Load Balancer, or Vps)

Allows you to set the reverse lookup for the IP

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (resource)
Enum: "instances" "loadBalancers" "vps"

Type of resource (Instances, Load Balancers, or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID), loadBalancerId (UUID), or vpsId (numeric string).

ip
required
string <ip>
Example: 10.0.0.1
Request Body schema: application/json
required
reverseLookup
required
string

Responses

Request samples

Content type
application/json
{
  • "reverseLookup": "a-valid-domain.xpto"
}

Response samples

Content type
application/json
{
  • "ip": "10.0.0.1",
  • "prefixLength": "28",
  • "version": 4,
  • "reverseLookup": "a-valid-domain.xpto",
  • "mainIp": false,
  • "networkType": "INTERNAL",
  • "nullRouted": true,
  • "ddos": {
    }
}

Null route IP address for a specific resource (Instance, Load Balancer, or Vps)

Null route an IP. It may take a few minutes before the change is propagated across the network.

Only works for IPv4.

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (resource)
Enum: "instances" "loadBalancers" "vps"

Type of resource (Instances, Load Balancers, or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID), loadBalancerId (UUID), or vpsId (numeric string).

ip
required
string <ip>
Example: 10.0.0.1
Request Body schema: application/json
optional
comment
string

The reason why the IP is being null-routed

automatedUnnulingAt
integer [ 1 .. 17520 ]

If provided, reverts the operation automatically in the specified value, in hours

Responses

Request samples

Content type
application/json
{
  • "automatedUnnulingAt": 2,
  • "comment": "Getting DDoS"
}

Response samples

Content type
application/json
{
  • "ip": "10.0.0.1",
  • "prefixLength": "28",
  • "version": 4,
  • "reverseLookup": "a-valid-domain.xpto",
  • "mainIp": false,
  • "networkType": "INTERNAL",
  • "nullRouted": true,
  • "ddos": {
    }
}

Remove an IP null route for a specific resource (Instance, Load Balancer, or Vps)

Remove an IP null route. It may take a few minutes before the change is propagated across the network

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (resource)
Enum: "instances" "loadBalancers" "vps"

Type of resource (Instances, Load Balancers, or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID), loadBalancerId (UUID), or vpsId (numeric string).

ip
required
string <ip>
Example: 10.0.0.1

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/ips/%7Bip%7D/unnull \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "ip": "10.0.0.1",
  • "prefixLength": "28",
  • "version": 4,
  • "reverseLookup": "a-valid-domain.xpto",
  • "mainIp": false,
  • "networkType": "INTERNAL",
  • "nullRouted": true,
  • "ddos": {
    }
}

Reinstall

List images available for reinstall

List Images available for reinstall

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (baseResource)
Enum: "instances" "vps"

Type of resource (Instances or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID) or vpsId (numeric string).

query Parameters
limit
integer
Example: limit=20

Limit the number of results returned.

offset
integer
Example: offset=10

Return results starting from the given offset.

custom
boolean

Filters the list to include only custom images.

standard
boolean
Example: standard=true

Filters the list to include only standard images.

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/publicCloud/v1/%7Bresource%7D/%7BresourceId%7D/reinstall/images?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE&custom=SOME_BOOLEAN_VALUE&standard=SOME_BOOLEAN_VALUE' \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "images": [
    ],
  • "_metadata": {
    }
}

Reinstall a specific resource (Instance or Vps)

Recreates the resource, with optionally different Image and Marketplace App.

Cannot be performed when the instance has snapshots.

Available Images can be obtained using /v1/{resource}/{instanceId}/reinstall/images.

Available Marketplace Apps can be obtained using /v1/images/{imageId}/marketApps.

Authorizations:
X-LSW-Auth
path Parameters
resource
required
string (baseResource)
Enum: "instances" "vps"

Type of resource (Instances or Vps).

resourceId
required
string

Resource ID, which can be an instanceId (UUID) or vpsId (numeric string).

Request Body schema: application/json
required
imageId
required
string

The Image ID

marketAppId
string

The Market App to be installed

Responses

Request samples

Content type
application/json
{
  • "imageId": "UBUNTU_22_04_64BIT"
}

Response samples

Content type
application/json
{
  • "correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be",
  • "errorCode": "400",
  • "errorDetails": { },
  • "errorMessage": "The API could not interpret your request correctly."
}