LeaseWeb API for launching and managing Public Cloud instances (v1)

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

This API provides ways to launch and manage Public Cloud instances.

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

Regions

List regions

Authorizations:
query Parameters
limit
integer
Default: 20
Example: limit=20

Limit the number of results returned.

offset
integer
Default: 0
Example: offset=10

Return results starting from the given offset.

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/regions \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Instance types

List instance types

Get instance types

Authorizations:
query Parameters
region
required
string
limit
integer >= 0
Default: 50
offset
integer >= 0
Default: 0

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/publicCloud/v1/instanceTypes?region=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Instance

Launch instance

Launch a Public Cloud instance.

Available regions can be obtained using /v1/regions.

Available Operating Systems can be obtained using /v1/operatingSystems.

Available instance types for your region can be obtained using /v1/instanceTypes.

Authorizations:
Request Body schema: application/json
region
required
string

Region to launch the instance into

type
string

Instance type

operatingSystemId
required
string

Operating System ID

marketAppId
string

Market App ID that must be installed into the instance

reference
string

An identifying name you can refer to the instance

contractType
required
string
Enum: "HOURLY" "MONTHLY"
contractTerm
required
integer
Enum: 0 1 3 6 12

Contract commitment. Used only when contract type is MONTHLY

billingFrequency
required
integer
Enum: 1 3 6 12

How often you wish to be charged. Used only when contract type is MONTHLY. '1' means every month, '3' every three months and so on.

rootDiskSize
integer

The root disk's size in GB. Must be at least 5 GB for Linux and FreeBSD instances and 50 GB for Windows instances

rootDiskStorageType
required
string
Enum: "LOCAL" "CENTRAL"

The root disk's storage type

sshKey
string

Public SSH key to be installed into the instance. Must be used only on Linux/FreeBSD instances

Responses

Request samples

Content type
application/json
{
  • "type": "lsw.m3.large",
  • "region": "eu-west-3",
  • "operatingSystemId": "UBUNTU_20_04_64BIT",
  • "reference": "my-webserver",
  • "contractTerm": 0,
  • "billingFrequency": 1,
  • "contractType": "HOURLY",
  • "rootDiskSize": 50,
  • "rootDiskStorageType": "CENTRAL"
}

Response samples

Content type
application/json
{
  • "customerId": "111111111",
  • "id": "15ca75e3-5b36-44af-98fe-e96cf402d17e",
  • "type": "lsw.m3.large",
  • "resources": {
    },
  • "region": "eu-west-3",
  • "reference": "web server",
  • "operatingSystem": {
    },
  • "state": "CREATING",
  • "publicIpV4": true,
  • "privateNetwork": false,
  • "startedAt": null,
  • "rootDiskSize": 5,
  • "rootDiskStorageType": "CENTRAL",
  • "ips": [ ],
  • "billingFrequency": 1,
  • "contractTerm": 0,
  • "contractType": "HOURLY",
  • "contractEndsAt": null,
  • "contractRenewalsAt": "2023-10-30T16:39:09+00:00",
  • "contractCreatedAt": "2023-10-30T16:39:09+00:00",
  • "iso": null,
  • "marketAppId": null
}

Get instance list

List and filter instances

Authorizations:
query Parameters
limit
integer
Default: 20
Example: limit=20

Limit the number of results returned.

offset
integer
Default: 0
Example: offset=10

Return results starting from the given offset.

ip
string <ip>
Example: ip=10.0.0.1
reference
string
Example: reference=my-webserver
id
string <uuid>
Example: id=a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11
filter
string
Example: filter=my-webserver

Using this parameter, you can filter by id, reference or IP.

contractType
string
Enum: "HOURLY" "MONTHLY"
Example: contractType=HOURLY
state
string
Enum: "RUNNING" "STARTING" "STOPPED" "STOPPING" "CREATING" "DESTROYED" "DESTROYING"
Example: state=RUNNING
region
string
Example: region=eu-west-3

Available regions can be found using the List Regions endpoint.

type
string
Example: type=lsw.c3.xlarge

Available instance types can be found using the List Instance Types endpoint.

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/publicCloud/v1/instances?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE&ip=SOME_STRING_VALUE&reference=SOME_STRING_VALUE&id=SOME_STRING_VALUE&filter=SOME_STRING_VALUE&contractType=SOME_STRING_VALUE&state=SOME_STRING_VALUE&region=SOME_STRING_VALUE&type=SOME_STRING_VALUE' \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Get instance details

Get details about the instance

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0 \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "customerId": "11111111",
  • "id": "5fd135a9-3ff6-4794-8b92-8cd8747a3ea3",
  • "type": "lsw.c3.4xlarge",
  • "resources": {
    },
  • "region": "eu-west-3",
  • "reference": "my-webserver",
  • "operatingSystem": {
    },
  • "state": "RUNNING",
  • "hasPublicIpV4": true,
  • "hasPrivateNetwork": false,
  • "rootDiskSize": 10,
  • "ips": [
    ],
  • "billingFrequency": 3,
  • "contractTerm": 3,
  • "contractType": "MONTHLY",
  • "contractEndsAt": "2024-02-01T00:00:00+00:00",
  • "startedAt": "2023-10-26T08:17:33+00:00",
  • "contractRenewalsAt": "2024-02-01T00:00:00+00:00",
  • "contractCreatedAt": "2023-10-26T08:17:19+00:00",
  • "iso": null,
  • "privateNetwork": {
    }
}

Terminate instance

Terminate Public Cloud instance

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0 \
  --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."
}

Update instance

Update the instance's reference, type, storage or contract type.

Eligible instance types for update can be obtained using /v1/instances/{instanceId}/instanceTypesUpdate.

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Request Body schema: application/json
type
string

Instance type

reference
string

An identifying name you can refer to the instance

contractType
string
Value: "MONTHLY"
contractTerm
integer
Enum: 0 1 3 6 12

Contract commitment. Can only be used when updating the contract type from HOURLY and MONTHLY.

billingFrequency
integer
Enum: 1 3 6 12

How often you wish to be charged. Can only be used when updating the contract type from HOURLY to MONTHLY. '1' means every month, '3' every three months and so on.

rootDiskSize
integer

The root disk's size in GB. Must be at least 5 GB for Linux and FreeBSD instances and 50 GB for Windows instances

Responses

Request samples

Content type
application/json
Example
{
  • "reference": "new-reference"
}

Response samples

Content type
application/json
{
  • "customerId": "111111111",
  • "salesOrgId": "2000",
  • "id": "15ca75e3-5b36-44af-98fe-e96cf402d17e",
  • "type": "lsw.m3.large",
  • "resources": {
    },
  • "region": "eu-west-3",
  • "reference": "web server",
  • "operatingSystem": {
    },
  • "state": "RUNNING",
  • "publicIpV4": true,
  • "privateNetwork": false,
  • "startedAt": null,
  • "rootDiskSize": 5,
  • "ips": [
    ],
  • "billingFrequency": 1,
  • "contractTerm": 0,
  • "contractType": "HOURLY",
  • "contractEndsAt": null,
  • "contractRenewalsAt": "2023-10-30T16:39:09+00:00",
  • "contractCreatedAt": "2023-10-30T16:39:09+00:00",
  • "iso": null
}

Cancel instance termination

Cancel the termination process of monthly instances. Must be executed prior to the instance's contractEndsAt.

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/cancelTermination \
  --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."
}

Get console access

Get console access to the instance

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/console \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

List available instance types for update

Get available instance types for update

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

query Parameters
limit
integer >= 0
Default: 50
offset
integer >= 0
Default: 0

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/instanceTypesUpdate?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

List OSes available for reinstall

List Operating Systems available for reinstall

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/reinstall/operatingSystems \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Reinstall instance

Recreates the instance, with optionally different Operating System and Markeplace App.

Cannot be performed when the instance has snapshots.

Available Operating Systems can be obtained using /v1/instances/{instanceId}/reinstall/operatingSystems.

Available Marketplace Apps can be obtained using /v1/operatingSystems/{operatingSystemId}/marketApps.

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Request Body schema: application/json
operatingSystemId
required
string

The Operating System ID

marketAppId
string

The Market App to be installed

Responses

Request samples

Content type
application/json
{
  • "operatingSystemId": "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."
}

Power

Start instance

The instance must be stopped before the execution

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/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 instance

The instance must be running before the execution

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/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 instance

The instance must be running before the execution

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/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 instance

Get all credentials stored for the instance

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/credentials \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Store credentials

Store credential used for the instance

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Request Body schema: application/json
type
required
string
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
{
  • "type": "OPERATING_SYSTEM",
  • "username": "another-user",
  • "password": "a$Ndes-3fad2-rfas@-"
}

Response samples

Content type
application/json
{
  • "type": "OPERATING_SYSTEM",
  • "username": "another-user",
  • "password": "a$Ndes-3fad2-rfas@-"
}

Delete all instance credentials

Delete all credentials stored for a given instance

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/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

Get credentials stored for the instance by their types

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

type
required
string
Example: OPERATING_SYSTEM

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/credentials/OPERATING_SYSTEM \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Get credentials by type and username

Get credentials by type and username

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

type
required
string
Example: OPERATING_SYSTEM

Credential type

username
required
string
Example: root

Username

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/credentials/OPERATING_SYSTEM/root \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Update credentials

Update credentials for a given type and username

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

type
required
string
Example: OPERATING_SYSTEM

Credential type

username
required
string
Example: root

Username

Request Body schema: application/json
password
required
string

The new password

Responses

Request samples

Content type
application/json
{
  • "password": "@-n3w-Pa$$w0rD"
}

Response samples

Content type
application/json
{
  • "type": "OPERATING_SYSTEM",
  • "username": "another-user",
  • "password": "@-n3w-Pa$$w0rD"
}

Delete credentials

Delete credentials for a given type and username

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

type
required
string
Example: OPERATING_SYSTEM

Credential type

username
required
string
Example: root

Username

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/credentials/OPERATING_SYSTEM/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 instance password

The operation may take a few moments to complete.

You can obtain the new credential using the credentials endpoints

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/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."
}

Expenses

Get costs for a given month.

Authorizations:
path Parameters
equipmentId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Equipment's UUID

query Parameters
from
required
string <date>
Example: from=2023-11-01

Start date of the period to get costs for. It must be the first day of the month

to
string <date>
Example: to=2023-12-01

End date of the period to get costs for. This date needs to be exactly one month after the 'from' date. If this value is not passed, it will be calculated based on 'from' parameter

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/publicCloud/v1/equipments/695ddd91-051f-4dd6-9120-938a927a47d0/expenses?from=SOME_STRING_VALUE&to=SOME_STRING_VALUE' \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "billing": {
    }
}

ISO

List available ISOs

List all available ISO images

Authorizations:
query Parameters
limit
integer
Default: 20
Example: limit=20

Limit the number of results returned.

offset
integer
Default: 0
Example: offset=10

Return results starting from the given offset.

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/isos \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Attach ISO to instance

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

Available ISOs can be obtained using /v1/isos.

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Request Body schema: application/json
isoId
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 instance

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

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/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."
}

Operating Systems

List all available Operating Systems

Authorizations:
query Parameters
limit
integer
Default: 20
Example: limit=20

Limit the number of results returned.

offset
integer
Default: 0
Example: offset=10

Return results starting from the given offset.

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/operatingSystems \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Marketplace Apps

Get marketplace apps

Get all available marketplace apps.

Authorizations:

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/marketApps \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Metrics

Get instance data traffic metrics

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's 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/instances/695ddd91-051f-4dd6-9120-938a927a47d0/metrics/datatraffic \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Snapshots

List snapshots

List instance snapshots

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

query Parameters
limit
integer
Default: 20
Example: limit=20

Limit the number of results returned.

offset
integer
Default: 0
Example: offset=10

Return results starting from the given offset.

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/snapshots?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Create instance snapshot

The instance 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 instance.

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/snapshots \
  --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."
}

Get snapshot detail

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

snapshotId
required
string <uuid>

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/snapshots/%7BsnapshotId%7D \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Restore instance snapshot

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

snapshotId
required
string <uuid>

Responses

Request samples

curl --request PUT \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/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 instance snapshot

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

snapshotId
required
string <uuid>

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/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."
}

IP

List instance's IPs

List the instance's IPs

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

query Parameters
version
integer
Example: version=4
nullRouted
boolean
ips
string

A list of IPs separated by |

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/ips \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Get details about an instance's IP

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

ip
required
string <ip>
Example: 10.0.0.1

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/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": null,
  • "mainIp": false,
  • "nullRouted": false,
  • "ddos": {
    }
}

Update IP

Allows you to set the reverse lookup for the IP

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

ip
required
string <ip>
Example: 10.0.0.1
Request Body schema: application/json
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,
  • "nullRouted": false,
  • "ddos": {
    }
}

Null route IP

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

Only works for IPv4.

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

ip
required
string <ip>
Example: 10.0.0.1
Request Body schema: application/json
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
{
  • "comment": "Getting DDoS",
  • "automatedUnnulingAt": 2
}

Response samples

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

UnNull route IP

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

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

ip
required
string <ip>
Example: 10.0.0.1

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/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,
  • "nullRouted": true,
  • "ddos": {
    }
}

Private Network

Add instance to Private Network

Add instance to Private Network.

Cannot be performed when the instance has snapshots.

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request PUT \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/addToPrivateNetwork \
  --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."
}

Remove instance from Private Network

Remove instance from Private Network.

Cannot be performed when the instance has snapshots.

Authorizations:
path Parameters
instanceId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Instance's ID

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/publicCloud/v1/instances/695ddd91-051f-4dd6-9120-938a927a47d0/removeFromPrivateNetwork \
  --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."
}

Load balancer

Launch Load balancer

Launch a Load balancer.

Available regions can be obtained using /v1/regions.

Available load balancer types for your region can be obtained using /v1/loadBalancerTypes.

Authorizations:
Request Body schema: application/json
region
required
string

Region to launch the load balancer into

type
required
string

Load balancer type

reference
string

An identifying name you can refer to the load balancer

contractType
required
string
Enum: "HOURLY" "MONTHLY"

The contract applicable for the load balancer

billingFrequency
required
integer
Enum: 1 3 6 12

How often you wish to be charged. Used only when contract type is MONTHLY. '1' means every month, '3' every three months and so on.

rootDiskStorageType
required
string
Enum: "LOCAL" "CENTRAL"

The root disk's storage type

targetPort
required
integer

The port that the registered instances listen to

Responses

Request samples

Content type
application/json
{
  • "type": "lsw.m3.large",
  • "region": "eu-west-3",
  • "reference": "my-loadbalancer-1",
  • "billingFrequency": 1,
  • "contractType": "HOURLY",
  • "rootDiskStorageType": "CENTRAL",
  • "targetPort": 443
}

Response samples

Content type
application/json
{
  • "customerId": "1111111",
  • "id": "3b30340a-050f-4424-8e50-e846e8fc07e9",
  • "type": "lsw.c3.large",
  • "resources": {
    },
  • "region": "eu-west-3",
  • "reference": "my-loadbalancer-1",
  • "state": "CREATING",
  • "ips": [ ],
  • "billingFrequency": 1,
  • "contractTerm": 0,
  • "contractType": "HOURLY",
  • "contractEndsAt": "2025-03-07T10:32:51+00:00",
  • "startedAt": "2024-03-07T10:32:51+00:00",
  • "contractRenewalsAt": "2024-03-07T11:02:48+00:00",
  • "contractCreatedAt": "2024-03-07T10:32:51+00:00",
  • "configuration": {
    }
}

Get load balancer list

List and filter load balancers

Authorizations:
query Parameters
limit
integer
Default: 20
Example: limit=20

Limit the number of results returned.

offset
integer
Default: 0
Example: offset=10

Return results starting from the given offset.

ip
string <ip>
Example: ip=10.0.0.1
reference
string
Example: reference=my-lb
id
string <uuid>
Example: id=a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11
filter
string
Example: filter=my-lb

Using this parameter, you can filter by id, reference or IP.

contractType
string
Enum: "HOURLY" "MONTHLY"
Example: contractType=HOURLY
state
string
Enum: "RUNNING" "STARTING" "STOPPED" "STOPPING" "CREATING" "DESTROYED" "DESTROYING"
Example: state=RUNNING
region
string
Example: region=eu-west-3

Available regions can be found using the List Regions endpoint.

type
string
Example: type=lsw.c3.xlarge

Available load balancer types can be found using the List Load Balacer Types endpoint.

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/publicCloud/v1/loadBalancers/?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE&ip=SOME_STRING_VALUE&reference=SOME_STRING_VALUE&id=SOME_STRING_VALUE&filter=SOME_STRING_VALUE&contractType=SOME_STRING_VALUE&state=SOME_STRING_VALUE&region=SOME_STRING_VALUE&type=SOME_STRING_VALUE' \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Get load balancer details

Get details about the load balancer

Authorizations:
path Parameters
loadBalancerId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Load balancer ID

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/loadBalancers/695ddd91-051f-4dd6-9120-938a927a47d0 \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "customerId": "1111111",
  • "id": "3b30340a-050f-4424-8e50-e846e8fc07e9",
  • "type": "lsw.c3.large",
  • "resources": {
    },
  • "region": "eu-west-3",
  • "reference": "my-loadbalancer-1",
  • "state": "RUNNING",
  • "ips": [
    ],
  • "billingFrequency": 1,
  • "contractTerm": 0,
  • "contractType": "HOURLY",
  • "contractEndsAt": "2025-03-07T10:32:51+00:00",
  • "startedAt": "2024-03-07T10:32:51+00:00",
  • "contractRenewalsAt": "2024-03-07T11:02:48+00:00",
  • "contractCreatedAt": "2024-03-07T10:32:51+00:00",
  • "configuration": {
    }
}

Delete load balancer

Terminate a Load balancer

Authorizations:
path Parameters
loadBalancerId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Load balancer ID

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/publicCloud/v1/loadBalancers/695ddd91-051f-4dd6-9120-938a927a47d0 \
  --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."
}

Update load balancer

Update load balancer configurations

Authorizations:
path Parameters
loadBalancerId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Load balancer ID

Request Body schema: application/json
type
string

Load balancer type

reference
string

An identifying name you can refer to the load balancer

contractType
string
Enum: "HOURLY" "MONTHLY"
object
balance
string
Enum: "ROUNDROBIN" "LEASTCONN" "SOURCE"

Algorithm to be used for load balancer

object
xForwardedFor
boolean

Is xForwardedFor enabled or not

idleTimeOut
integer

Time to close the connection if load balancer is idle

targetPort
integer

Port on which the backend (target) servers are listening to handle incoming requests

Responses

Request samples

Content type
application/json
{
  • "type": "lsw.m3.xlarge",
  • "reference": "foo",
  • "targetPort": 9000,
  • "xForwardedFor": false,
  • "contractType": "HOURLY",
  • "balance": "roundrobin",
  • "idleTimeOut": 60
}

Response samples

Content type
application/json
{
  • "customerId": "11111111",
  • "id": "d930cf34-0fdb-406d-b3d0-75add3eb5efe",
  • "type": "lsw.c3.large",
  • "resources": {
    },
  • "region": "eu-west-3",
  • "reference": "my-loadbalancer1",
  • "state": "RUNNING",
  • "ips": [
    ],
  • "billingFrequency": 1,
  • "contractTerm": 0,
  • "contractType": "HOURLY",
  • "contractEndsAt": null,
  • "startedAt": null,
  • "contractRenewalsAt": "2024-02-29T10:33:07+00:00",
  • "contractCreatedAt": "2024-02-29T10:33:06+00:00",
  • "configuration": {
    }
}

Create listener

Create listener

Authorizations:
path Parameters
loadBalancerId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Load balancer ID

Request Body schema: application/json
protocol
required
string
Enum: "HTTPS" "HTTP" "TCP"
port
required
integer

Port that the listener listens to

object

Responses

Request samples

Content type
application/json
{
  • "protocol": "HTTPS",
  • "port": 443,
  • "certificate": {
    }
}

Response samples

Content type
application/json
{
  • "protocol": "HTTPS",
  • "port": 80,
  • "id": "fac06878-6655-4956-8ea7-124a97f133ab"
}

Get listener details

Get details about a listener

Authorizations:
path Parameters
loadBalancerId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Load balancer ID

listenerId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Listener ID

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/publicCloud/v1/loadBalancers/695ddd91-051f-4dd6-9120-938a927a47d0/listeners/695ddd91-051f-4dd6-9120-938a927a47d0 \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "protocol": "HTTPS",
  • "port": 80,
  • "id": "fac06878-6655-4956-8ea7-124a97f133ab"
}

Update a listener

Authorizations:
path Parameters
loadBalancerId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Load balancer ID

listenerId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Listener ID

Request Body schema: application/json
protocol
required
string
Enum: "HTTPS" "HTTP" "TCP"
port
required
integer
object

Required if listener type is HTTPS

Responses

Request samples

Content type
application/json
{
  • "protocol": "HTTPS",
  • "port": "443",
  • "certificate": {
    }
}

Response samples

Content type
application/json
{
  • "protocol": "HTTPS",
  • "port": 443,
  • "id": "fac06878-6655-4956-8ea7-124a97f133ab"
}

Delete load balancer listener

Delete a listener

Authorizations:
path Parameters
loadBalancerId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Load balancer ID

listenerId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Listener ID

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/publicCloud/v1/loadBalancers/695ddd91-051f-4dd6-9120-938a927a47d0/listeners/695ddd91-051f-4dd6-9120-938a927a47d0 \
  --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."
}

List registered targets

List targets registered in a load balancer.

Authorizations:
path Parameters
loadBalancerId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Load balancer ID

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/publicCloud/v1/loadBalancers/695ddd91-051f-4dd6-9120-938a927a47d0/targets \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Register targets

Register targets in a load balancer. Instances must be running and have private network enabled so they can be registered.

Authorizations:
path Parameters
loadBalancerId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Load balancer ID

Request Body schema: application/json
Array of objects

Responses

Request samples

Content type
application/json
{
  • "targets": [
    ]
}

Response samples

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

Deregister targets

Deregister targets registered in a load balancer.

Authorizations:
path Parameters
loadBalancerId
required
string <uuid>
Example: 695ddd91-051f-4dd6-9120-938a927a47d0

Load balancer ID

Request Body schema: application/json
Array of objects

Responses

Request samples

Content type
application/json
{
  • "targets": [
    ]
}

Response samples

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