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 VPS

The VPS must be stopped before the execution

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

VPS ID

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/vps/999999999/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 VPS

The VPS must be running before the execution

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

VPS ID

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/vps/999999999/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 VPS

The VPS must be running before the execution

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

VPS ID

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/vps/999999999/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 VPS

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

VPS ID

Responses

Request samples

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

Response samples

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

Store credentials for a specific VPS

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

VPS ID

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 VPS

Delete all credentials stored for a given VPS.

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

VPS ID

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/publicCloud/v1/vps/999999999/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 VPS

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

VPS ID

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/vps/999999999/credentials/%7Btype%7D \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

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

Get VPS credential by type and username.

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

VPS ID

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/vps/999999999/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 given type and username

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

VPS ID

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 VPS credential

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

VPS ID

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/vps/999999999/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 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
vpsId
required
string
Example: 999999999

VPS ID

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/vps/999999999/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 VPS

VPS 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
vpsId
required
string
Example: 999999999

VPS ID

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 VPS

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

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

VPS ID

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/vps/999999999/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 VPS

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

VPS ID

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/vps/999999999/metrics/datatraffic \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

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

Snapshots

List snapshots

List VPS snapshots

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

VPS ID

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.

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/publicCloud/v1/vps/999999999/snapshots?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

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

Create VPS snapshot

The VPS must be running before the execution.

The time taken to create the snapshot depends on several factors, including memory size and usage.

Allowed only one snapshot per VPS.

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

VPS ID

Request Body schema: application/json
required
name
required
string

A name to identify your snapshot

Responses

Request samples

Content type
application/json
{
  • "name": "my snapshot"
}

Response samples

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

Get snapshot detail

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

VPS ID

snapshotId
required
string <uuid>

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/vps/999999999/snapshots/%7BsnapshotId%7D \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "created": "2023-11-02T07:31:28+0000",
  • "displayName": "snapshot 1",
  • "id": "ef73e9e2-95cd-49ef-940f-a24e6ad6c4a0",
  • "state": "READY"
}

Restore VPS snapshot

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

VPS ID

snapshotId
required
string <uuid>

Responses

Request samples

curl --request PUT \
  --url https://api.leaseweb.com/publicCloud/v1/vps/999999999/snapshots/%7BsnapshotId%7D \
  --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."
}

Delete VPS snapshot

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

VPS ID

snapshotId
required
string <uuid>

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/publicCloud/v1/vps/999999999/snapshots/%7BsnapshotId%7D \
  --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."
}

IPs

List IP addresses associated with a specific VPS

List the VPS's IPs

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

VPS ID

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/vps/999999999/ips \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

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

Get IP details for a specific VPS

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

VPS ID

ip
required
string <ip>
Example: 10.0.0.1

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/vps/999999999/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 VPS

Allows you to set the reverse lookup for the IP

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

VPS ID

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 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
vpsId
required
string
Example: 999999999

VPS ID

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 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
vpsId
required
string
Example: 999999999

VPS ID

ip
required
string <ip>
Example: 10.0.0.1

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/vps/999999999/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

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

VPS ID

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/vps/999999999/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 VPS

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

Cannot be performed when the VPS 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
vpsId
required
string
Example: 999999999

VPS ID

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."
}

Get console access

Get console access to the VPS

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

VPS ID

Responses

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=999999999

VPS 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: 999999999

VPS ID

Responses

Request samples

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

Response samples

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