LeaseWeb API

With the LeaseWeb APIs you can manage your infrastructure and other resources with LeaseWeb. Using the REST principle, the API is designed to have predictable resources and responses using standard HTTP Status codes. JSON will be returned in all responses from the API, unless stated otherwise.

Authentication

curl "https://api.leaseweb.com/v1/" -H "X-Lsw-Auth: asfee-23eqeq-23eeded-23eqed"

You authenticate to the LeaseWeb API by providing an API key in your request header. You can generate your API key at the Self Service Center. To use your key include your API key to all API request in a header that looks like the follwing:

X-Lsw-Auth: fasfee-23eqeq-23eeded-23eqed

All API calls must be made over HTTPS. The base URL is: https://api.leaseweb.com/v1


Domains

The Domain resources are domain names you have purchased at LeaseWeb or from a domain name registrar and that you are managing at LeaseWeb DNS infrastructure. This resource gives you control over each domain name.

List your Domains

curl --request GET \
  --url https://api.leaseweb.com/v1/domains \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/domains",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/domains", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/domains")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
"domains": [
    {
        "domain": {
            "code": 1000,
            "domain": "yourname.tld",
            "status": "normal",
            "ttl": 300,
            "readableStatus": "This domain is registered by LeaseWeb.",
            "startDate": "Apr 1, 2015",
            "contractTerm": "1 year(s)",
            "monthlyPrice": "0.99",
            "isEditable": "true"
        }
    },
    {
        "domain": {
            "code": 1000,
            "domain": "seconddomain.com",
            "status": "normal",
            "ttl": 300,
            "readableStatus": "This domain is registered by LeaseWeb.",
            "startDate": "Aug 1, 2009",
            "contractTerm": "1 year(s)",
            "monthlyPrice": "0.49",
            "isEditable": "true"
        }
    }
  ]
}

To retrieve a list of all of your domains, send a GET request to /v1/domains.

The response will be a JSON object with key domains containing an array of your domains, each of which contain the standard domain attributes:

Name Type Description
code integer Status code. Anything different than 1000 indicates an error
domain string The domain name
status string Status of the domain resource
ttl integer TTL of the domain resource
readableStatus string The long readable version of status
startDate date Contract start date for the domain resource
contractTerm integer Contract term for the domain resource
monthlyPrice float Price for the domain resource
isEditable boolean Boolean to indicate of you can edit the domain resources

Retrieve a Domain

curl --request GET \
  --url https://api.leaseweb.com/v1/domains/leaseweb.com \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/domains/leaseweb.com",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/domains/leaseweb.com", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/domains/leaseweb.com")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "domain": {
      "code": 1000,
      "domain": "yourname.tld",
      "status": "normal",
      "ttl": 300,
      "readableStatus": "This domain is registered by LeaseWeb.",
      "startDate": "Apr 1, 2015",
      "contractTerm": "1 year(s)",
      "monthlyPrice": "0.99",
      "isEditable": "true"
  }
}

To get details about a specific Domain resource, send a GET request to /v1/domains/{domainname}.

The response will be a JSON object with key domain containing the standard domain attributes:

Name Type Description
code integer Status code. Anything different than 1000 indicates an error
domain string The domain name
status string Status of the domain resource
ttl integer TTL of the domain resource
readableStatus string The long readable version of status
startDate date Contract start date for the domain resource
contractTerm integer Contract term for the domain resource
monthlyPrice float Price for the domain resource
isEditable boolean Boolean to indicate of you can edit the domain resources

Update a Domain

curl --request PUT \
  --url https://api.leaseweb.com/v1/domains/leaseweb.com \
  --header 'x-lsw-auth: 213423-2134234-234234-23424' \
  --data ttl=3600
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/domains/leaseweb.com",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "ttl=3600",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

payload = "ttl=3600"

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("PUT", "/v1/domains/leaseweb.com", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/domains/leaseweb.com")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'
request.body = "ttl=3600"

response = http.request(request)
puts response.read_body

Response Body

  {
  "domain": {
      "code": 1000,
      "domain": "yourname.tld",
      "status": "normal",
      "ttl": 300,
      "readableStatus": "This domain is registered by LeaseWeb.",
      "startDate": "Apr 1, 2015",
      "contractTerm": "1 year(s)",
      "monthlyPrice": "0.99",
      "isEditable": "true"
  }
}

To update the TTL of your Domain resource, send a PUT request to /v1/domains/{domainname}. The request should contain the following form parameters:

Name Type Description
ttl integer TTL value for your Domain resource

The response will be a JSON object with key domain containing the standard domain attributes:

Name Type Description
code integer Status code. Anything different than 1000 indicates an error
domain string The domain name
status string Status of the domain resource
ttl integer TTL of the domain resource
readableStatus string The long readable version of status
startDate date Contract start date for the domain resource
contractTerm integer Contract term for the domain resource
monthlyPrice float Price for the domain resource
isEditable boolean Boolean to indicate of you can edit the domain resources

List all Domain Records

curl --request GET \
  --url https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/domains/leaseweb.com/dnsRecords", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "dnsRecords": [
    {
      "dnsRecord": {
          "id": "860421",
          "host": "sub.yourname.tld",
          "type": "A",
          "content": "10.10.3.10"
      }
    },
    {
        "dnsRecord": {
            "id": "1554494",
            "host": "test.yourname.t;d",
            "type": "MX",
            "content": "10.11.12.13",
            "priority":  100
        }
    }
  ]
} 

To retrieve a list of all of your domains, send a GET request to /v1/domains/yourdomain.tld/dnsRecords.

The response will be a JSON object with key dnsRecords containing an array of your DNS Rrecords, each of which contain the standard DNS attributes:

Name Type Description
id integer A unique identifier for the DNS record
host string The name for the DNS record
type string The DNS record type. Values accepted: A, AAAA, CNAME, MX, SRV, …
content string Value for the DNS record
priority integer The priority for MX or SRV records

Create a new DNS Record

curl --request POST \
  --url https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords \
  --header 'x-lsw-auth: 213423-2134234-234234-23424' \
  --data 'host=www.yourdomain.tld&type=A&content=85.17.96.111&priority='
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "host=www.yourdomain.tld&type=A&content=85.17.96.111&priority=",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

payload = "host=www.yourdomain.tld&type=A&content=85.17.96.111&priority="

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("POST", "/v1/domains/leaseweb.com/dnsRecords", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'
request.body = "host=www.yourdomain.tld&type=A&content=85.17.96.111&priority="

response = http.request(request)
puts response.read_body

Response Body

  {
  "dnsRecord": {
      "id": "860421",
      "host": "sub.yourname.tld",
      "type": "A",
      "content": "10.10.3.10"
  }
}

To create a new DNS Record for your domain, send a POST request to /v1/domains/yourdomain.tld/dnsRecords. The request should contain the following form parameters:

Name Type Description
host string The name for the DNS record
type string The DNS record type. Values accepted: A, AAAA, CNAME, MX, SRV, …
content string Value for the DNS record
priority integer The priority for MX or SRV records

The response will be a JSON object with key dnsRecord containing an object of your new DNS Rrecords, each of which contain the standard DNS attributes:

Name Type Description
id integer A unique identifier for the DNS record
host string The name for the DNS record
type string The DNS record type. Values accepted: A, AAAA, CNAME, MX, SRV, …
content string Value for the DNS record
priority integer The priority for MX or SRV records

Retrieve a DNS Record

curl --request GET \
  --url https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords/12345 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords/12345",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/domains/leaseweb.com/dnsRecords/12345", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords/12345")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "dnsRecord": {
      "id": "860421",
      "host": "sub.yourname.tld",
      "type": "A",
      "content": "10.10.3.10"
  }
}

To get details about a specific DomainRecord resource, send a GET request to /v1/domains/{domainname}/dnsRecords/{recordId}.

The response will be a JSON object with key dnsRecord containing the standard Domain Record attributes:

Name Type Description
id integer A unique identifier for the DNS record
host string The name for the DNS record
type string The DNS record type. Values accepted: A, AAAA, CNAME, MX, SRV, …
content string Value for the DNS record
priority integer The priority for MX or SRV records

Update a DNS Record

curl --request PUT \
  --url https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords/12345 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424' \
  --data 'id=12345&host=www.yourdomain.tld&type=A&content=85.17.96.112&priority='
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords/12345",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "id=12345&host=www.yourdomain.tld&type=A&content=85.17.96.112&priority=",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

payload = "id=12345&host=www.yourdomain.tld&type=A&content=85.17.96.112&priority="

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("PUT", "/v1/domains/leaseweb.com/dnsRecords/12345", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords/12345")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'
request.body = "id=12345&host=www.yourdomain.tld&type=A&content=85.17.96.112&priority="

response = http.request(request)
puts response.read_body

Response Body

  {
  "dnsRecord": {
      "id": "860421",
      "host": "sub.yourname.tld",
      "type": "A",
      "content": "10.10.3.10"
  }
}

To update the DomainRecord resource, send a PUT request to /v1/domains/{domainname}/dnsRecords/{recordId}. The request should contain the following form parameters:

Name Type Description
id integer A unique identifier for the DNS record
name string The name for the DNS record
type string The DNS record type. Values accepted: A, AAAA, CNAME, MX, SRV, …
data string Value for the DNS record
priority integer The priority for MX or SRV records

The response will be a JSON object with key dnsRecord containing the standard Domain Record attributes:

Name Type Description
id integer A unique identifier for the DNS record
host string The name for the DNS record
type string The DNS record type. Values accepted: A, AAAA, CNAME, MX, SRV, …
content string Value for the DNS record
priority integer The priority for MX or SRV records

Remove a DNS Record

curl --request DELETE \
  --url https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords/12345 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords/12345",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("DELETE", "/v1/domains/leaseweb.com/dnsRecords/12345", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords/12345")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

To delete a specific DomainRecord resource, send a DELETE request to /v1/domains/{domainname}/dnsRecords/{recordId}.

On success the DomainRecord resource will be deleted and the response status will be a 200 with no body returned.

Bare Metal Servers

The Bare Metal Servers resources are bare metal servers you have running at LeaseWeb. This resource gives you control over each bare metal server. You can reboot and reinstall the server via this resource.

List your Bare Metal servers

curl --request GET \
  --url https://api.leaseweb.com/v1/bareMetals \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/bareMetals", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "bareMetals": [
    {
        "bareMetal": {
            "reference": null,
            "bareMetalId": "24123",
            "serverName": "ABD0211",
            "serverType": "Bare Metal"
        }
    },
    {
        "bareMetal": {
            "reference": null,
            "bareMetalId": "28374",
            "serverName": "ABD0212",
            "serverType": "Bare Metal"
        }
    }
  ]
}

To retrieve a list of all of your bare metal servers, send a GET request to /v1/bareMetals.

The response will be a JSON object with key bareMetals containing an array of your bare metal servers, each of which contain the following attributes:

Name Type Description
bareMetalId string The identifier of the bare metal resource
serverName string The name of the bare metal server
serverType string The type of the bare metal resource
reference string A reference for the bare metal server

Retrieve a Bare Metal server

curl --request GET \
  --url https://api.leaseweb.com/v1/bareMetals/12345 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/bareMetals/12345", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
    "bareMetal": {
        "reference": null,
        "location": {
            "site": "AMS-01",
            "cabinet": "18",
            "rackspace": "-",
            "combinationLock": "-"
        },
        "server": {
            "ram": "2GB",
            "kvm": "No",
            "serverType": "Preinstalled evo-pbox18 ECR9130",
            "processorType": "Amd Single-Core Sempron 2600+",
            "processorSpeed": "1830 Mhz",
            "numberOfCpus": 1,
            "numberOfCores": 1,
            "hardDisks": " 1x1TB ",
            "hardwareRaid": "No"
        },
        "network": {
            "dataPack": "Bandwidth (NL - Flat) - 500 Mbps (Volume)",
            "ipmi": {
                "gateway": "10.19.25.126",
                "ip": "10.19.25.101",
                "netmask": "255.255.255.192",
                "network": "10.19.25.64",
                "type": "ILO"
            },
            "ipsFreeOfCharge": "1",
            "ipsAssigned": 1,
            "excessIpsPrice": "0.00",
            "dataPackExcess": {
                "type": "",
                "value": "0.00",
                "unit": ""
            },
            "macAddresses": {
                "mac": [
                    "00:13:D3:A8:2A:B2",
                    "00:13:D3:A8:2A:B3"
                ]
            }
        },
        "extras": [],
        "bareMetalId": "12345",
        "serverName": "LSW - TEST",
        "serverType": "Bare Metal",
        "serverHostingPack": {
            "reference": null,
            "bareMetalId": "12345",
            "serverName": "LSW - TEST",
            "serverType": "Bare Metal",
            "serverPrice": 60,
            "startDate": "Feb 1, 2015",
            "endDate": "",
            "contractTerm": "1 year(s)"
        },
        "serverSpecifications": [],
        "serviceLevelAgreement": {
            "sla": "Basic - 24x7x24"
        },
        "datacenterAccessCards": {
            "accessCards": [
                "0",
                []
            ]
        }
    }
}

To get information about a specific bare metal servers, send a GET request to /v1/bareMetals/{bareMetalId}.

The response will be a JSON object contain the following attributes:

Name Type Description
bareMetalId integer The identifier of the bare metal resource
serverName string The name of the bare metal server
serverType string The type of the bare metal resource
reference string A reference for the bare metal server
location object An object with location information
server object An object with server information
network object An object with network information
serverHostingPack object An object with pack information
serviceLevelAgreement object An object with SLA information
extras object DEPRICATED
serverSpecifications object DEPRICATED
datacenterAccessCards object DEPRICATED

The location object contains the following attributes:

Name Type Description
site string The site where the bare metal server is located
cabinet string The cabinet the bare metal server is located in
rackspace string DEPRICATED
combinationLock string DEPRICATED

The server object contains the following attributes:

Name Type Description
ram string The amount of RAM in the bare metal server
kvm string Flag to indicate KVM is available in the bare metal server (Yes/No)
serverType string Type of bare metal server
processorType string Processor type of the bare metal server
processorSpeed string Clock speed of the processor
numberOfCpus integer Number of processors in the bare metal server
numberOfCores integer Number of cores per processor
hardDisks string Amount and size of harddisks (eg: 1x1TB), comma separated
hardDiskList array Array of harddisks amount and size
hardwareRaid string Flag to indicate the bare metal server is equipped with hardware raid (Yes/No)

The network object contains the following attributes:

Name Type Description
dataPack string Human readable name of the datapack
ipsFreeOfCharge integer Amount of IPs you can get with your bare metal server free of charge
ipsAssigned integer Amount of IPs assigned to the bare metal server
excessIpsPrice float Price per IP for extra IPs
dataPackExcess object An object with information about datapack over usage
ipmi object An object with IPMI information
macAddresses array An array with key mac containing all mac adresses of the bare metal server
pricePerMonth float Monthly price of the datapack

The IPMI object contains the following attributes:

Name Type Description
ip string IP address of the IPMI device
netmask string Netmask of the IPMI device
network string Network address of the IPMI device
gateway string Gateway address of the IPMI device
type string Type of the IPMI device, either ILO or DRAC

The dataPackExcess object contains the following attributes:

Name Type Description
type string The datapack type, either bandwidth or datatraffic
value float Price used for overusage calcaction per measurement unit
unit string Measuring unit used for overusage calculation

The serverHostingPack object contains the following attributes:

Name Type Description
reference string Reference set for the bare metal server
bareMetalId integer The identifier of the bare metal resource
serverName string The name of the bare metal server
serverPrice float Monthly price of the bare metal server
serverType string The type of the bare metal resource
startDate date Bare metal contract start date
endDate date Bare metal contract end date
contractTerm string Applied contract term

The serviceLevelAgreement object contains the following attributes:

Name Type Description
sla string Human readable name of the SLA agreement
pricePerMonth float Monthly price of the SLA agreement

Update a Bare Metal server

curl --request PUT \
  --url https://api.leaseweb.com/v1/bareMetals/12345 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424' \
  --data reference=My%20Reference
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "reference=My%20Reference",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

payload = "reference=My%20Reference"

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("PUT", "/v1/bareMetals/12345", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'
request.body = "reference=My%20Reference"

response = http.request(request)
puts response.read_body

Response Body

  {
    "bareMetal": {
        "reference": null,
        "location": {
            "site": "AMS-01",
            "cabinet": "18",
            "rackspace": "-",
            "combinationLock": "-"
        },
        "server": {
            "ram": "2GB",
            "kvm": "No",
            "serverType": "Preinstalled evo-pbox18 ECR9130",
            "processorType": "Amd Single-Core Sempron 2600+",
            "processorSpeed": "1830 Mhz",
            "numberOfCpus": 1,
            "numberOfCores": 1,
            "hardDisks": " 1x1TB ",
            "hardwareRaid": "No"
        },
        "network": {
            "dataPack": "Bandwidth (NL - Flat) - 500 Mbps (Volume)",
            "ipmi": {
                "gateway": "10.19.25.126",
                "ip": "10.19.25.101",
                "netmask": "255.255.255.192",
                "network": "10.19.25.64",
                "type": "ILO"
            },
            "ipsFreeOfCharge": "1",
            "ipsAssigned": 1,
            "excessIpsPrice": "0.00",
            "dataPackExcess": {
                "type": "",
                "value": "0.00",
                "unit": ""
            },
            "macAddresses": {
                "mac": [
                    "00:13:D3:A8:2A:B2",
                    "00:13:D3:A8:2A:B3"
                ]
            }
        },
        "extras": [],
        "bareMetalId": "12345",
        "serverName": "LSW - TEST",
        "serverType": "Bare Metal",
        "serverHostingPack": {
            "reference": null,
            "bareMetalId": "12345",
            "serverName": "LSW - TEST",
            "serverType": "Bare Metal",
            "serverPrice": 60,
            "startDate": "Feb 1, 2015",
            "endDate": "",
            "contractTerm": "1 year(s)"
        },
        "serverSpecifications": [],
        "serviceLevelAgreement": {
            "sla": "Basic - 24x7x24"
        },
        "datacenterAccessCards": {
            "accessCards": [
                "0",
                []
            ]
        }
    }
}

To update the reference of a bare metal server, send a PUT request to /v1/bareMetals/{bareMetalId}. The request must contain the following form parameter:

Name Type Description
reference string A new reference you want to set to the bare metal server

The response will be a JSON object contain the following attributes:

Name Type Description
bareMetalId integer The identifier of the bare metal resource
serverName string The name of the bare metal server
serverType string The type of the bare metal resource
reference string A reference for the bare metal server
location object An object with location information
server object An object with server information
network object An object with network information
serverHostingPack object An object with pack information
serviceLevelAgreement object An object with SLA information
extras object DEPRICATED
serverSpecifications object DEPRICATED
datacenterAccessCards object DEPRICATED

The location object contains the following attributes:

Name Type Description
site string The site where the bare metal server is located
cabinet string The cabinet the bare metal server is located in
rackspace string DEPRICATED
combinationLock string DEPRICATED

The server object contains the following attributes:

Name Type Description
ram string The amount of RAM in the bare metal server
kvm string Flag to indicate KVM is available in the bare metal server (Yes/No)
serverType string Type of bare metal server
processorType string Processor type of the bare metal server
processorSpeed string Clock speed of the processor
numberOfCpus integer Number of processors in the bare metal server
numberOfCores integer Number of cores per processor
hardDisks string Amount and size of harddisks (eg: 1x1TB), comma separated
hardDiskList array Array of harddisks amount and size
hardwareRaid string Flag to indicate the bare metal server is equipped with hardware raid (Yes/No)

The network object contains the following attributes:

Name Type Description
dataPack string Human readable name of the datapack
ipsFreeOfCharge integer Amount of IPs you can get with your bare metal server free of charge
ipsAssigned integer Amount of IPs assigned to the bare metal server
excessIpsPrice float Price per IP for extra IPs
dataPackExcess object An object with information about datapack over usage
macAddresses array An array with key mac containing all mac adresses of the bare metal server
pricePerMonth float Monthly price of the datapack

The dataPackExcess object contains the following attributes:

Name Type Description
type string The datapack type, either bandwidth or datatraffic
value float Price used for overusage calcaction per measurement unit
unit string Measuring unit used for overusage calculation

The serverHostingPack object contains the following attributes:

Name Type Description
reference string Reference set for the bare metal server
bareMetalId integer The identifier of the bare metal resource
serverName string The name of the bare metal server
serverType string The type of the bare metal resource
startDate date Bare metal contract start date
endDate date Bare metal contract end date
contractTerm string Applied contract term

The serviceLevelAgreement object contains the following attributes:

Name Type Description
sla string Human readable name of the SLA agreement
pricePerMonth float Monthly price of the SLA agreement

Retrieve switchport status

curl --request GET \
  --url https://api.leaseweb.com/v1/bareMetals/12345/switchPort \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/switchPort",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/bareMetals/12345/switchPort", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/switchPort")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
    "switchPort": {
        "status": "open",
        "switchNode": 1,
        "serverId": 1234,
        "serverName": "My Server"
    }
}

To retrieve the status of your switch port connected to your bare metal server, send a GET request to /v1/bareMetals/{bareMetalId}/switchPort.

The response will be a JSON object with key switchPort containing the following attributes:

Name Type Description
status string Indication whether the port is “open” or “closed”
serverId integer Bare metal server identiefier
serverName string Bare metal server name
switchNode integer Port identifier for this bare metal server

Open the switch port

curl --request POST \
  --url https://api.leaseweb.com/v1/bareMetals/12345/switchPort/open \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/switchPort/open",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("POST", "/v1/bareMetals/12345/switchPort/open", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/switchPort/open")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
    "switchPort": {
        "status": "open",
        "switchNode": 1,
        "serverId": 1234,
        "serverName": "My Server"
    }
}

To open the switch port connected to the bare metal server, send a POST request request to /v1/bareMetals/{bareMetalId}/switchPort/open.

The response will be a JSON object with key switchPort containing the following attributes:

Name Type Description
status string Indication whether the port is “open” or “closed”
serverId integer Bare metal server identiefier
serverName string Bare metal server name
switchNode integer Port identifier for this bare metal server

Close the switch port

curl --request POST \
  --url https://api.leaseweb.com/v1/bareMetals/12345/switchPort/close \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/switchPort/close",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("POST", "/v1/bareMetals/12345/switchPort/close", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/switchPort/close")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
    "switchPort": {
        "status": "closed",
        "switchNode": 1,
        "serverId": 1234,
        "serverName": "My Server"
    }
}

To close the switch port connected to the bare metal server, send a POST request request to /v1/bareMetals/{bareMetalId}/switchPort/close.

The response will be a JSON object with key switchPort containing the following attributes:

Name Type Description
status string Indication whether the port is “open” or “closed”
serverId integer Bare metal server identiefier
serverName string Bare metal server name
switchNode integer Port identifier for this bare metal server

Retrieve power status

curl --request GET \
  --url https://api.leaseweb.com/v1/bareMetals/12345/powerStatus \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/powerStatus",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/bareMetals/12345/powerStatus", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/powerStatus")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
    "powerStatus": {
        "status": "on",
        "serverId": 1234,
        "serverName": "My Server"
    }
}

To retrieve the power port status of your bare metal server, send a GET request to /v1/bareMetals/{bareMetalId}/powerStatus.

The response will be a JSON object with key powerStatus containing the following attributes:

Name Type Description
status string Indication whether the power port is “on” or “off”
serverId integer Bare metal server identiefier
serverName string Bare metal server name

NOTE: Blade servers are not supported yet. We are doing our best to support it as soon as possible.

List all IPs

curl --request GET \
  --url https://api.leaseweb.com/v1/bareMetals/12345/ips \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/ips",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/bareMetals/12345/ips", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/ips")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "ips": [
    {
      "ip": {
        "ip": "4.3.2.1",
        "reverseLookup": "hosted-by.leaseweb.com.",
        "nullRouted": false,
        "ipDetails": {
          "gateway": "4.3.2.254",
          "mask": "255.255.255.0"
        },
        "billingInformation": {
            "startDate": "Feb 1, 2014",
            "endDate": null,
            "price": "0.00"
        },
        "serverId": "1234",
        "serverType": "Bare Metal",
        "serverName": "My Server"
      }
    }
  ]
}

To retrieve a list of all of your bare metal server IPs, send a GET request to /v1/bareMetals/{bareMetalId}/ips.

The response will be a JSON object with key ips containing an array of your IPs, each of which contain the standard IP attributes:

Name Type Description
ip string The IP
reverseLookup string The reverse lookup set for the IP
nullRouted boolean Boolean to indicate if the IP is null-routed
serverId integer Identifier of the server using the IP
serverType string The type of server using the IP (Bare Metal, Cloud,…)
serverName string Name assigned to the server
ipDetails object Object containing information about netmask and gateway
billingInformation object Object containing information about billing

The ipDetails object contains the following attributes:

Name Type Description
gateway string The gateway to be used for the IP resource
netmask string The reverse lookup set for the IP resource

The billingInformation object contains the following attributes:

Name Type Description
price string Monthly price for the IP resource
startDate string The start date for the IP resource
endDate string The end date of the IP resource

Retrieve an IP

curl --request GET \
  --url https://api.leaseweb.com/v1/bareMetals/12345/ips/85.17.96.111 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/ips/85.17.96.111",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/bareMetals/12345/ips/85.17.96.111", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/ips/85.17.96.111")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "ip": {
    "ip": "4.3.2.1",
    "reverseLookup": "hosted-by.leaseweb.com",
    "nullRouted": false,
    "ipDetails": {
      "gateway": "4.3.2.254",
      "mask": "255.255.255.0"
    },
    "billingInformation": {
      "startDate": "Feb 1, 2014",
      "endDate": null,
      "price": "0.00"
    },
    "serverId": "1234",
    "serverType": "Bare Metal",
    "serverName": "My Server"
  }
}

To retrieve a single IP resource for a bare metal server, send a GET request to /v1/bareMetals/1234/ips/{ipAddress}.

The response will be a JSON object with key ip containing the standard IP attributes:

Name Type Description
ip string The IP
reverseLookup string The reverse lookup set for the IP
nullRouted boolean Boolean to indicate if the IP is null-routed
serverId integer Identifier of the server using the IP
serverType string The type of server using the IP (Bare Metal, Cloud,…)
serverName string Name assigned to the server
ipDetails object Object containing information about netmask and gateway
billingInformation object Object containing information about billing

The ipDetails object contains the following attributes:

Name Type Description
gateway string The gateway to be used for the IP resource
netmask string The reverse lookup set for the IP resource

The billingInformation object contains the following attributes:

Name Type Description
price string Monthly price for the IP resource
startDate string The start date for the IP resource
endDate string The end date of the IP resource

Update an IP

curl --request PUT \
  --url https://api.leaseweb.com/v1/bareMetals/12345/ips/85.17.96.111 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424' \
  --data 'reverseLookup=my-reverse.hostname.com&nullRouted=0'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/ips/85.17.96.111",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "reverseLookup=my-reverse.hostname.com&nullRouted=0",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

payload = "reverseLookup=my-reverse.hostname.com&nullRouted=0"

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("PUT", "/v1/bareMetals/12345/ips/85.17.96.111", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/ips/85.17.96.111")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'
request.body = "reverseLookup=my-reverse.hostname.com&nullRouted=0"

response = http.request(request)
puts response.read_body

Response Body

  {
  "ip": {
    "ip": "4.3.2.1",
    "reverseLookup": "hosted-by.leaseweb.com",
    "nullRouted": false,
    "ipDetails": {
      "gateway": "4.3.2.254",
      "mask": "255.255.255.0"
    },
    "billingInformation": {
      "startDate": "Feb 1, 2014",
      "endDate": null,
      "price": "0.00"
    },
    "serverId": "1234",
    "serverType": "Bare Metal",
    "serverName": "My Server"
  }
}

To update the reverse lookup or to nullroute an IP for a bare metal server, send a PUT request to /v1/bareMetals/1234/ips/{ipAddress}. The request should contain one of the following form parameters:

Name Type Description
reverseLookup string The reverse lookup for the IP resource
nullRouted boolean A boolean indicating whether the IP should be nullrouted (0=false, 1=true)

Retrieve network usage

curl --request GET \
  --url https://api.leaseweb.com/v1/bareMetals/12345/networkUsage \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/networkUsage",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/bareMetals/12345/networkUsage", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/networkUsage")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  # Bandwidth

{
    "bandwidth": {
        "measurement": {
            "node": {
                "in": "-",
                "out": "-",
                "total": "44.85 Mbps"
            },
            "total": "44.85 Mbps",
            "average": "44.85 Mbps"
        },
        "overusage": "0 bps",
        "serverId": "1234",
        "serverName": "My server",
        "interval": {
            "from": "11-06-2014",
            "to": "10-07-2014"
        },
        "monthlyThreshold": "0 Mbps"
    }
}

# Data traffic

{
    "dataTraffic": {
        "measurement": {
            "node": {
                "in": "10.3 GB",
                "out": "25.4 GB",
                "total": "35.7 GB"
            },
            "total": "35.7 GB"
        },
        "overusage": "0 B",
        "serverId": "1234",
        "serverName": "My server",
        "interval": {
            "from": "01-01-2014",
            "to": "10-06-2014"
        },
        "monthlyThreshold": "0 GB"
    }
}

To retrieve the network usage of your bare metal server, send a GET request to /v1/bareMetals/{bareMetalId}/networkUsage.

You can use the following querystring paramaters:

Name Type Description
dateFrom string Start date of the usage calculation, format: DD-MM-YYYY
dateTo string End date of the usage calculation, format: DD-MM-YYYY

The response will be a JSON object containing the following attributes:

Name Type Description
bandwidth object Object with bandwidth information
datatraffic obect Object with datatraffic information

Both the bandwidth object and the datatraffic object contain the following attributes:

Name Type Description
measurement object Object containing measurement information
overusage string Amount of overusage including the unit, for example: “1.2 Mbps”
serverId integer Bare metal server identifier
serverName string Bare metal server name
interval object Object containg the measurement date range information
monthlyTreshold string

The measurement object contains the following attrbutes:

Name Type Description
node object Small object with attributes “in”, “out” and “total” representing the usage per measured network port
total string Totale usage over the given interval
average string Average bandwidth usage over the given interval. Only for bandwidth measurements.

The interval object contains the following attrbutes:

Name Type Description
from string Start date of the measurement
to string End date of the measurement

Retrieve bandwidth usage

curl --request GET \
  --url https://api.leaseweb.com/v1/bareMetals/12345/networkUsage/bandwidth \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/networkUsage/bandwidth",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/bareMetals/12345/networkUsage/bandwidth", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/networkUsage/bandwidth")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

To retrieve the bandwidth usage of your bare metal server, send a GET request to /v1/bareMetals/{bareMetalId}/networkUsage/bandwidth.

You can use the following querystring paramaters:

Name Type Description
dateFrom string Start date of the usage calculation, format: DD-MM-YYYY
dateTo string End date of the usage calculation, format: DD-MM-YYYY

You can also send an Accept header with values application/json for JSON response or image/png to retrieve the bandwidth as an image.

The response will be a JSON object with key bandwidth containing the following attributes:

Name Type Description
measurement object Object containing measurement information
overusage string Amount of overusage including the unit, for example: “1.2 Mbps”
serverId integer Bare metal server identifier
serverName string Bare metal server name
interval object Object containg the measurement date range information
monthlyTreshold string

The measurement object contains the following attrbutes:

Name Type Description
node object Small object with attributes “in”, “out” and “total” representing the usage per measured network port
total string Totale usage over the given interval
average string Average bandwidth usage over the given interval

The interval object contains the following attrbutes:

Name Type Description
from string Start date of the measurement
to string End date of the measurement

Retrieve datatraffic usage

curl --request GET \
  --url https://api.leaseweb.com/v1/bareMetals/12345/networkUsage/datatraffic \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/networkUsage/datatraffic",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/bareMetals/12345/networkUsage/datatraffic", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/networkUsage/datatraffic")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

To retrieve the datatraffc used by your bare metal server, send a GET request to /v1/bareMetals/{bareMetalId}/networkUsage/datatraffic.

You can use the following querystring paramaters:

Name Type Description
dateFrom string Start date of the usage calculation, format: DD-MM-YYYY
dateTo string End date of the usage calculation, format: DD-MM-YYYY

You can also send an Accept header with values application/json for JSON response or image/png to retrieve the bandwidth as an image.

The response will be a JSON object with key bandwidth containing the following attributes:

Name Type Description
measurement object Object containing measurement information
overusage string Amount of overusage including the unit, for example: “1.2 Mbps”
serverId integer Bare metal server identifier
serverName string Bare metal server name
interval object Object containg the measurement date range information
monthlyTreshold string

The measurement object contains the following attrbutes:

Name Type Description
node object Small object with attributes “in”, “out” and “total” representing the usage per measured network port
total string Totale usage over the given interval

The interval object contains the following attrbutes:

Name Type Description
from string Start date of the measurement
to string End date of the measurement

Reboot a server

curl --request POST \
  --url https://api.leaseweb.com/v1/bareMetals/12345/powerCycle \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/powerCycle",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("POST", "/v1/bareMetals/12345/powerCycle", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/powerCycle")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body


To reboot the bare metal server, send a POST request request to /v1/bareMetals/{bareMetalId}/powerCycle.

The response will be a HTTP 202 OK.

Launch a re-installation

curl --request POST \
  --url https://api.leaseweb.com/v1/bareMetals/12345/install \
  --header 'x-lsw-auth: 213423-2134234-234234-23424' \
  --data 'osId=138&hdd=%7B%3F%3F%7D%0A&raidLevel=1&numberDisks=3'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/install",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "osId=138&hdd=%7B%3F%3F%7D%0A&raidLevel=1&numberDisks=3",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

payload = "osId=138&hdd=%7B%3F%3F%7D%0A&raidLevel=1&numberDisks=3"

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("POST", "/v1/bareMetals/12345/install", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/install")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'
request.body = "osId=138&hdd=%7B%3F%3F%7D%0A&raidLevel=1&numberDisks=3"

response = http.request(request)
puts response.read_body

Response Body


To re-install the bare metal server with a new operating system, send a POST request request to /v1/bareMetals/{bareMetalId}/install.

The request should contain the following form parameters:

Name Type Required Description
osId integer true The operating system Id
hdd object false The hdd partition schema.
raidLevel integer false The SW RAID level i.e. 0, 1, 5, 6, 10.
numberDisks integer false The number of disks you want to apply SW RAID on.

The hdd schema object has three elements: 1: disk (string) – The disk name (eg: /dev/sda) 2: params (array) – Partition list schemes 3: bootable (integer) – Index of the bootable partition (eg: 0)

Params is a numeric key base array from “0” to the number of partitions you want to create. Each with the following elements: 1: type (string) – The filesystem type (eg: ext3) 2: size (integer) – Size of the partition in MB (eg: 10000) 3: mountpoint (string) – The partition mount point (eg: /home). This is mandatory for the root partition (“/”) |

The response will be a HTTP 200 OK.

The status of the installation or password can be requested by doing a GET request to /v1/bareMetals/{bareMetalId}/installationStatus.

Launch rescue mode

curl --request POST \
  --url https://api.leaseweb.com/v1/bareMetals/12345/rescueMode \
  --header 'x-lsw-auth: 213423-2134234-234234-23424' \
  --data osId=138
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/rescueMode",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "osId=138",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

payload = "osId=138"

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("POST", "/v1/bareMetals/12345/rescueMode", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/rescueMode")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'
request.body = "osId=138"

response = http.request(request)
puts response.read_body

Response Body


To re-install the bare metal server with a new operating system, send a POST request request to /v1/bareMetals/{bareMetalId}/rescueMode.

The request should contain the following form parameters:

Name Type Description
osId integer The operating system Id

The response will be a HTTP 200 OK.

The status of the rescue mode or password can be requested by doing a GET request to /v1/bareMetals/{bareMetalId}/installationStatus.

Retrieve root password

curl --request GET \
  --url https://api.leaseweb.com/v1/bareMetals/12345/rootPassword \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/rootPassword",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/bareMetals/12345/rootPassword", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/rootPassword")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  image/png

PNG

<binary image content>

To retrieve the initial the bare metal serverroot password, send a GET request request to /v1/bareMetals/{bareMetalId}/rootPassword.

You can set the Accept header to application/json to receive a JSON response or (default) to image/png to receive an image (PNG). If the header is set to application/json the response will be a JSON object with the following attribute:

Name Type Description
rootpassword string The initial root password

Retrieve installation status

curl --request GET \
  --url https://api.leaseweb.com/v1/bareMetals/12345/installationStatus \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/installationStatus",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/bareMetals/12345/installationStatus", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/installationStatus")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "installationStatus": {
    "code": 1000,
    "description": "Normal",
    "serverPackId": "1234",
    "serverName": "My_Server"
  }
}

To retrieve the status of a requested installation, send a GET request request to /v1/bareMetals/{bareMetalId}/installationStatus.

If you have added a public RSA key in the Customer Portal, this call will return the initial root and rescuemode password (RSA encrypted).

The response will be a JSON object with key installationStatus, containing the following attributes:

Name Type Description
code integer Success code (normally 1000)
description string Status of the installation or server. Normal indicates server is not being installed at the moment and operates as normal
serverPackId integer Identifier of the bare metal server
serverPackName string Name of the bare metal server
initRootPassword string
DEPRECATED
This field is deprecated. Please use /rootPassword instead.

The initial root password set during the last installation. Will only appear when a RSA key has been set in the Customer Portal

Retrieve a list of DHCP leases

curl --request GET \
  --url https://api.leaseweb.com/v1/bareMetals/12345/leases \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/leases",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/bareMetals/12345/leases", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/leases")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  [
    {
        "_metadata": {
            "totalCount": 1,
            "limit": 10,
            "offset": 0
        },
        "leases": [
            {
                "ip": "192.168.0.100",
                "mac": "68:B5:99:CE:E3:01",
                "options": [
                    {
                        "name": "Bootfile Name",
                        "optionId": "67",
                        "policyName": null,
                        "type": "String",
                        "userClass": "",
                        "value": "undionly.kpxe",
                        "vendorClass": ""
                    },
                    {
                        "name": "DNS Servers",
                        "optionId": "6",
                        "policyName": null,
                        "type": "IPv4Address",
                        "userClass": "",
                        "value": "8.8.8.8, 8.8.8.4",
                        "vendorClass": ""
                    },
                    {
                        "name": "Boot Server Host Name",
                        "optionId": "66",
                        "policyName": null,
                        "type": "String",
                        "userClass": "",
                        "value": "192.168.0.150",
                        "vendorClass": ""
                    },
                    {
                        "name": "Bootfile Name",
                        "optionId": "67",
                        "policyName": null,
                        "type": "String",
                        "userClass": "gPXE",
                        "value": "http://95.211.51.8/server/getPxeConfig/serverId/11895/key/bf59bdac764fe8ab62646fce063d8429",
                        "vendorClass": ""
                    }
                ],
                "scope": "192.168.0.64"
            }
        ]
    }
]

To retrieve a list of DHCP leases, send a GET request to /v1/bareMetals/{bareMetalId}/leases.

The response will be a JSON object with key leases containing the following attribute:

Name Type Description
ip string The assigned IP for the DHCP lease
mac string The MAC address the DHCP lease is assigned to
scope string The scope of the DHCP lease
options object An object of DHCP lease options

The options object is an array of DHCP lease options, each of which contains the following attributes:

Name Type Description
name string Name of the DHCP option
optionId string DHCP option identifier
policyName string DHCP option policy name
type string DHCP option type
userClass string DHCP option user class
value string Value used for the DHCP option
vendorClass string DHCP option vendor class

Create a new DHCP lease

curl --request POST \
  --url https://api.leaseweb.com/v1/bareMetals/12345/leases \
  --header 'x-lsw-auth: 213423-2134234-234234-23424' \
  --data 'bootfile_name=http%3A%2F%2Fget.myinstallation.pxe%2F123&boot_server_host_name=92.168.0.230&domain_name_server=8.8.8.8'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/leases",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "bootfile_name=http%3A%2F%2Fget.myinstallation.pxe%2F123&boot_server_host_name=92.168.0.230&domain_name_server=8.8.8.8",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

payload = "bootfile_name=http%3A%2F%2Fget.myinstallation.pxe%2F123&boot_server_host_name=92.168.0.230&domain_name_server=8.8.8.8"

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("POST", "/v1/bareMetals/12345/leases", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/leases")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'
request.body = "bootfile_name=http%3A%2F%2Fget.myinstallation.pxe%2F123&boot_server_host_name=92.168.0.230&domain_name_server=8.8.8.8"

response = http.request(request)
puts response.read_body

To create a new DHCP leases, send a POST request request to /v1/bareMetals/{bareMetalId}/leases.

The request must contain the following form parameters:

Name Type Description
bootFileName string The URL of PXE boot you want your server to boot from
bootServerHostName string The TFTP server ip where to download the operating system image
domainNameServerIp string The Domain Name Server IP used

On success the reponse will be a HTTP 204 No Content.

Delete a DHCP lease

curl --request DELETE \
  --url https://api.leaseweb.com/v1/bareMetals/12345/leases \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/leases",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("DELETE", "/v1/bareMetals/12345/leases", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/leases")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

To delete a DHCP lease resource, send a DELETE request request to /v1/bareMetals/{bareMetalId}/leases.

On success the reponse will be a HTTP 204 No Content.

Retrieve a DHCP lease

curl --request GET \
  --url https://api.leaseweb.com/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  [
    {
        "ip": "192.168.0.100",
        "mac": "68:B5:99:CE:E3:01",
        "options": [
            {
                "name": "Bootfile Name",
                "optionId": "67",
                "policyName": null,
                "type": "String",
                "userClass": "",
                "value": "undionly.kpxe",
                "vendorClass": ""
            },
            {
                "name": "DNS Servers",
                "optionId": "6",
                "policyName": null,
                "type": "IPv4Address",
                "userClass": "",
                "value": "8.8.8.8, 8.8.8.4",
                "vendorClass": ""
            },
            {
                "name": "Boot Server Host Name",
                "optionId": "66",
                "policyName": null,
                "type": "String",
                "userClass": "",
                "value": "192.168.0.150",
                "vendorClass": ""
            },
            {
                "name": "Bootfile Name",
                "optionId": "67",
                "policyName": null,
                "type": "String",
                "userClass": "gPXE",
                "value": "http://95.211.51.8/server/getPxeConfig/serverId/11895/key/bf59bdac764fe8ab62646fce063d8429",
                "vendorClass": ""
            }
        ],
        "scope": "192.168.0.64"
    }
]

To retrieve a DHCP lease resource for a specific MAC address, send a GET request request to /v1/bareMetals/{bareMetalId}/leases/{macaddress}.

The response will be a JSON object containing the following attribute:

Name Type Description
ip string The assigned IP for the DHCP lease
mac string The MAC address the DHCP lease is assigned to
scope string The scope of the DHCP lease
options object An object of DHCP lease options

The options object is an array of DHCP lease options, each of which contains the following attributes:

Name Type Description
name string Name of the DHCP option
optionId string DHCP option identifier
policyName string DHCP option policy name
type string DHCP option type
userClass string DHCP option user class
value string Value used for the DHCP option
vendorClass string DHCP option vendor class

Delete a DHCP lease

curl --request DELETE \
  --url https://api.leaseweb.com/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("DELETE", "/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/bareMetals/12345/leases/28:B5:99:CE:E3:01")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

To delete a DHCP lease resource for a specific MAC address, send a DELETE request request to /v1/bareMetals/{bareMetalId}/leases/{macaddress}.

On success the reponse will be a HTTP 204 No Content.

Private Racks

The Private Racks resources are private racks you have at LeaseWeb. This resource gives you information about private racks and control over them.

List your Private Racks

curl --request GET \
  --url https://api.leaseweb.com/v1/privateRacks \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/privateRacks",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/privateRacks", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/privateRacks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "privateRacks": [
    {
      "privateRack": {
        "privateRackId": "24123"
      }
    },
    {
      "privateRack": {
        "privateRackId": "28374"
      }
    }
  ]
}

To retrieve a list of all of your private racks, send a GET request to /v1/privateRacks.

The response will be a JSON object with key privateRacks containing an array of your private racks, each of which contain the following attributes:

Name Type Description
privateRackId string The identifier of the private rack resource

Retrieve a Private Rack resource

curl --request GET \
  --url https://api.leaseweb.com/v1/privateRacks/12345 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/privateRacks/12345",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/privateRacks/12345", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/privateRacks/12345")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "privateRack" : {
    "serviceLevelAgreement" : {
      "sla": "Basic - 24x7x24"
    },
    "serverHostingPack" : {
      "privateRackId" : "123456",
      "startDate": "Feb 1, 2015",
      "reference" : null,
      "privateRackName" : "LSW - TEST"
    },
    "privateRackId" : "123456",
    "location" : {
      "cabinet" : "1",
      "site" : "AMS-01",
      "suite" : "1.11"
    },
    "privateRackName" : "LSW - TEST"
  }
}

To get information about a specific private rack, send a GET request to /v1/privateRacks/{privateRackId}.

The response will be a JSON object contain the following attributes:

Name Type Description
privateRackId integer The identifier of the private rack resource
privateRackName string The name of the private rack
location object An object with location information
serverHostingPack object An object with pack information
serviceLevelAgreement object An object with SLA information

The location object contains the following attributes:

Name Type Description
site string The site where the private rack is located
cabinet string The cabinet the private rack is located in
suite string The suite number of the private rack

The serverHostingPack object contains the following attributes:

Name Type Description
reference string Reference set for the private rack
privateRackId integer The identifier of the private rack resource
privateRackName string The name of the private rack
startDate date Bare metal contract start date
endDate date Bare metal contract end date

The serviceLevelAgreement object contains the following attributes:

Name Type Description
sla string Human readable name of the SLA agreement

List all IPs

curl --request GET \
  --url https://api.leaseweb.com/v1/privateRacks/12345/ips \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/privateRacks/12345/ips",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/privateRacks/12345/ips", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/privateRacks/12345/ips")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "ips": [
    {
      "ip": {
        "privateRackId" : "1234",
        "ip": "4.3.2.1",
        "billingInformation": {
            "startDate": "Feb 1, 2014",
            "endDate": null,
            "price": "0.00"
        },
        "nullRouted": false
      }
    }
  ]
}

To retrieve a list of all of your private rack IPs, send a GET request to /v1/privateRacks/{privateRackId}/ips.

The response will be a JSON object with key ips containing an array of your IPs, each of which contain the standard IP attributes:

Name Type Description
ip string The IP
privateRackId integer Identifier of the private rack
billingInformation object Object containing information about billing
nullRouted boolean Boolean to indicate if the IP is null-routed

The billingInformation object contains the following attributes:

Name Type Description
price string Monthly price for the IP resource
startDate string The start date for the IP resource
endDate string The end date of the IP resource

Retrieve an IP

curl --request GET \
  --url https://api.leaseweb.com/v1/privateRacks/12345/ips/85.17.96.111 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/privateRacks/12345/ips/85.17.96.111",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/privateRacks/12345/ips/85.17.96.111", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/privateRacks/12345/ips/85.17.96.111")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "ip": {
    "privateRackId": "1234",
    "ip": "4.3.2.1",
    "reverseLookup": "hosted-by.leaseweb.com",
    "nullRouted": false,
    "billingInformation": {
      "startDate": "Feb 1, 2014",
      "endDate": null,
      "price": "0.00"
    }
  }
}

To retrieve a single IP resource for a private rack, send a GET request to /v1/privateRacks/1234/ips/{ipAddress}.

The response will be a JSON object with key ip containing the standard IP attributes:

Name Type Description
ip string The IP
reverseLookup string The reverse lookup set for the IP
nullRouted boolean Boolean to indicate if the IP is null-routed
privateRackId string Identifier of the private rack associated to the IP
billingInformation object Object containing information about billing

The billingInformation object contains the following attributes:

Name Type Description
price string Monthly price for the IP resource
startDate string The start date for the IP resource
endDate string The end date of the IP resource

Update an IP

curl --request PUT \
  --url https://api.leaseweb.com/v1/privateRacks/12345/ips/85.17.96.111 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424' \
  --data 'reverseLookup=my-reverse.hostname.com&nullRouted=0'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/privateRacks/12345/ips/85.17.96.111",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "reverseLookup=my-reverse.hostname.com&nullRouted=0",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

payload = "reverseLookup=my-reverse.hostname.com&nullRouted=0"

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("PUT", "/v1/privateRacks/12345/ips/85.17.96.111", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/privateRacks/12345/ips/85.17.96.111")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'
request.body = "reverseLookup=my-reverse.hostname.com&nullRouted=0"

response = http.request(request)
puts response.read_body

Response Body

  {
  "ip": {
    "privateRackId": "1234",
    "ip": "4.3.2.1",
    "reverseLookup": "hosted-by.leaseweb.com",
    "nullRouted": false,
    "billingInformation": {
      "startDate": "Feb 1, 2014",
      "endDate": null,
      "price": "0.00"
    }
  }
}

To update the reverse lookup or to nullroute an IP for a private rack, send a PUT request to /v1/privateRacks/1234/ips/{ipAddress}. The request should contain one of the following form parameters:

Name Type Description
reverseLookup string The reverse lookup for the IP resource
nullRouted boolean A boolean indicating whether the IP should be nullrouted (0=false, 1=true)

IPs

The IP resources are IPs connected to one of your bare metal server or cloud instances. You can manage your IPs via this resource (change the reverse lookup for example).

Get all your IPs

curl --request GET \
  --url https://api.leaseweb.com/v1/ips \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/ips",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/ips", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/ips")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "ips": [
      {
          "ip": {
              "ip": "1.2.3.4",
              "reverseLookup": "hosted-by.leaseweb.com",
              "nullRouted": false,
              "billingInformation": {
                  "price": "1.00",
                  "startDate": "Mar 1, 2010",
                  "endDate": null
              },
              "serverId": "12345",
              "serverType": "Bare Metal",
              "serverName": "TEST SERVER",
              "ipDetails": {
                  "gateway": "1.2.3.254",
                  "mask": "255.255.255.0"
              }
          }
      },
      {
          "ip": {
              "ip": "1.2.3.5",
              "reverseLookup": "test.leaseweb.com",
              "ipDetails": {
                  "gateway": "1.2.3.254",
                  "mask": "255.255.255.0"
              },
              "nullRouted": false,
              "billingInformation": {
                  "price": "0.00",
                  "startDate": "Apr 1, 2015",
                  "endDate": null
              },
              "serverId": "12346",
              "serverType": "Bare Metal",
              "serverName": "TEST SERVER2"
          }
      }
  ]
}

To retrieve a list of all of your IPs, send a GET request to /v1/ips.

The response will be a JSON object with key ips containing an array of your IPs, each of which contain the standard IP attributes:

Name Type Description
ip string The IP
reverseLookup string The reverse lookup set for the IP
nullRouted boolean Boolean to indicate if the IP is null-routed
serverId integer Identifier of the server using the IP
serverType string The type of server using the IP (Bare Metal, Cloud,…)
serverName string Name assigned to the server
ipDetails object Object containing information about netmask and gateway
billingInformation object Object containing information about billing

The ipDetails object contains the following attributes:

Name Type Description
gateway string The gateway to be used for the IP resource
netmask string The reverse lookup set for the IP resource

The billingInformation object contains the following attributes:

Name Type Description
price string Monthly price for the IP resource
startDate string The start date for the IP resource
endDate string The end date of the IP resource

You can use the following query filters:

Name Type Description
nullRouted boolean Flag to filter by nullrouted IP (0=false, 1=true)

Get a single IP

curl --request GET \
  --url https://api.leaseweb.com/v1/ips/85.17.96.111 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/ips/85.17.96.111",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/ips/85.17.96.111", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/ips/85.17.96.111")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "ip": {
    "ip": "1.2.3.4",
    "reverseLookup": "hosted-by.leaseweb.com",
    "nullRouted": false,
    "billingInformation": {
        "price": "1.00",
        "startDate": "Mar 1, 2010",
        "endDate": null
    },
    "serverId": "12345",
    "serverType": "Bare Metal",
    "serverName": "TEST SERVER",
    "ipDetails": {
        "gateway": "1.2.3.254",
        "mask": "255.255.255.0"
    }
  }
}

To retrieve a single IP resource, send a GET request to /v1/ips/{ipAddress}.

The response will be a JSON object with key ip containing the standard IP attributes:

Name Type Description
ip string The IP
reverseLookup string The reverse lookup set for the IP
nullRouted boolean Boolean to indicate if the IP is null-routed
serverId integer Identifier of the server using the IP
serverType string The type of server using the IP (Bare Metal, Cloud,…)
serverName string Name assigned to the server
ipDetails object Object containing information about netmask and gateway
billingInformation object Object containing information about billing

The ipDetails object contains the following attributes:

Name Type Description
gateway string The gateway to be used for the IP resource
netmask string The reverse lookup set for the IP resource

The billingInformation object contains the following attributes:

Name Type Description
price string Monthly price for the IP resource
startDate string The start date for the IP resource
endDate string The end date of the IP resource

Update a single IP

curl --request PUT \
  --url https://api.leaseweb.com/v1/ips/85.17.96.111 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424' \
  --data 'reverseLookup=my-reverse.hostname.com&nullRouted=0'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/ips/85.17.96.111",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "reverseLookup=my-reverse.hostname.com&nullRouted=0",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

payload = "reverseLookup=my-reverse.hostname.com&nullRouted=0"

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("PUT", "/v1/ips/85.17.96.111", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/ips/85.17.96.111")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'
request.body = "reverseLookup=my-reverse.hostname.com&nullRouted=0"

response = http.request(request)
puts response.read_body

Response Body

  {
  "ip": {
    "ip": "1.2.3.4",
    "reverseLookup": "hosted-by.leaseweb.com",
    "nullRouted": false,
    "billingInformation": {
        "price": "1.00",
        "startDate": "Mar 1, 2010",
        "endDate": null
    },
    "serverId": "12345",
    "serverType": "Bare Metal",
    "serverName": "TEST SERVER",
    "ipDetails": {
        "gateway": "1.2.3.254",
        "mask": "255.255.255.0"
    }
  }
}

To update the reverse lookup or to nullroute an IP resource, send a PUT request to /v1/ips/{ipAddress}. The request should contain one of the following form parameters:

Name Type Description
reverseLookup string The reverse lookup for the IP resource
nullRouted boolean A boolean indicating whether the IP should be nullrouted (0=false, 1=true)

Rescue Images

The Rescue Image resources are bootable images that you can use to reboot your server with. These are small bootable images which will set a random password when booting which gives you control over a server which did not react normal anymore.

List your Recue Images

curl --request GET \
  --url https://api.leaseweb.com/v1/rescueImages \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/rescueImages",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/rescueImages", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/rescueImages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "rescueImages": [
      {
          "rescueImage": {
              "id": 121,
              "name": "FreeBSD Rescue 2.1 (amd64)"
          }
      },
      {
          "rescueImage": {
              "id": 122,
              "name": "FreeBSD Rescue 2.1 (x86)"
          }
      },
      {
          "rescueImage": {
              "id": 137,
              "name": "Rescue 2.1 (amd64)"
          }
      },
      {
          "rescueImage": {
              "id": 138,
              "name": "Rescue 2.1 (x86)"
          }
      }
  ]
}

To retrieve a list of all of available rescue Images, send a GET request to /v1/rescueImages.

The response will be a JSON object with key rescueImages containing an array of available rescueImages, each of which contain the standard rescue Image attributes:

Name Type Description
id integer The identifier for the rescue Image resource
name string The name of the rescue Image resource

Operating Systems

The Operating System resources gives information about available Operating Systems which can be used when reinstalling a bare metal server. It also provides information on available control panels for each Operating System resource.

List all Operating Systems

curl --request GET \
  --url https://api.leaseweb.com/v1/operatingSystems \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/operatingSystems",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/operatingSystems", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/operatingSystems")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "operatingSystems": [
      {
          "operatingSystem": {
              "id": 664,
              "name": "CentOS 5 (i386)"
          }
      },
      {
          "operatingSystem": {
              "id": 665,
              "name": "CentOS 5 (x86_64)"
          }
      },
      {
          "operatingSystem": {
              "id": 867,
              "name": "CentOS 6 (i386)"
          }
      }
  ]
}

To retrieve a list of all of available Operating Systems you can use for installations, send a GET request to /v1/operatingSystems.

The response will be a JSON object with key operatingSystems containing an array of available Operating Systems, each of which contain the standard Operating System attributes:

Name Type Description
id integer The identifier for the Operating Systems resource
name string The name of the Operating Systems resource

Retrieve an Operating Systems

curl --request GET \
  --url https://api.leaseweb.com/v1/operatingSystems/138 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/operatingSystems/138",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/operatingSystems/138", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/operatingSystems/138")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "operatingSystem": {
    "id": 123,
    "name": "CentOS 6 (x86_64)"
  }
}

To retrieve a single Operating Systems resource, send a GET request to /v1/operatingSystems/{operatingSystemId}.

The response will be a JSON object with key operatingSystem containing the standard Operating System attributes:

Name Type Description
id integer The identifier for the Operating Systems resource
name string The name of the Operating Systems resource

List all Control Panels

curl --request GET \
  --url https://api.leaseweb.com/v1/operatingSystems/138/controlPanels \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/operatingSystems/138/controlPanels",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/operatingSystems/138/controlPanels", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/operatingSystems/138/controlPanels")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "controlPanels": [
    {
      "controlPanel": {
        "id": 100,
        "name": "cPanel/WHM 11"
      }
    },
    {
      "controlPanel": {
        "id": 101,
        "name": "Plesk 10.4 (Unlimited domains)"
      }
    },
    {
      "controlPanel": {
        "id": 102,
        "name": "Plesk 10.4 (10 domains Linux)"
      }
    },
    {
      "controlPanel": {
        "id": 103,
        "name": "Plesk 11 (10 Domains Linux)"
      }
    }
  ]
}

To retrieve a list of all of available Control Panels for a specific Operating System, send a GET request to /v1/operatingSystems/{operatingSystemId}/controlPanels.

The response will be a JSON object with key controlPanels containing an array of available Control Panels, each of which contain the standard Control Panel attributes:

Name Type Description
id integer The identifier for the Control Panel resource
name string The name of the Control Panel resource

Retrieve a Control Panel

curl --request GET \
  --url https://api.leaseweb.com/v1/operatingSystems/138/controlPanels/456 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/operatingSystems/138/controlPanels/456",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/operatingSystems/138/controlPanels/456", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/operatingSystems/138/controlPanels/456")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "controlPanel": {
    "id": 456,
    "name": "cPanel/WHM 11"
  }
}

To retrieve a single Control Panels resource, send a GET request to /v1/operatingSystems/{operatingSystemId}/controlPanels/{controlPanelId}.

The response will be a JSON object with key controlPanel containing the standard Control Panel attributes:

Name Type Description
id integer The identifier for the Control Panel resource
name string The name of the Control Panel resource

Retrieve a Partition Schema

curl --request GET \
  --url https://api.leaseweb.com/v1/operatingSystems/138/partitionSchema \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/operatingSystems/138/partitionSchema",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/operatingSystems/138/partitionSchema", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/operatingSystems/138/partitionSchema")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "partitionSchema": {
    "limit": 7,
    "disks": {
      "disk": [
        "/dev/sda",
        "/dev/hda",
        "/dev/cciss/c0d0"
      ]
    },
    "suggestion": {
      "disk": "/dev/sda",
      "bootable": 0,
      "hdd": {
        "partition": [
          {
            "index": 0,
            "size": "100",
            "type": "ext2",
            "mountpoint": "/boot"
          },
          {
            "index": 1,
            "size": "4096",
            "type": "swap",
            "mountpoint": ""
          },
          {
            "index": 2,
            "size": "2048",
            "type": "ext4",
            "mountpoint": "/tmp"
          },
          {
            "index": 3,
            "size": "*",
            "type": "ext4",
            "mountpoint": "/"
          }
        ]
      }
    },
    "filesystemTypes": {
      "type": [
        "ext2",
        "ext3",
        "ext4",
        "xfs",
        "swap"
      ]
    }
  }
}

To retrieve a Partion Schema resource, send a GET request to /v1/operatingSystems/{operatingSystemId}/partitionSchema?serverPackId={bareMetalId}. The

The resource will provide information of available disks, filesystem types and a suggestion for possible partition Schema to be used when istallation a server.

The response will be a JSON object with key partionSchema containing the standard Partition Schema attributes:

Name Type Description
limit integer ****
name string The name of the Control Panel resource

Private Networks

The Private Networks resources gives you control over private networks between your bare metal servers. Use this resource to create new private networks and add or remove bare metal servers from the private network.

List your Private Networks

curl --request GET \
  --url https://api.leaseweb.com/v1/privateNetworks \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/privateNetworks",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/privateNetworks", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/privateNetworks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
    "_metadata": {
        "totalCount": 1,
        "limit": 10,
        "offset": 0
    },
    "privateNetworks": [
        {
            "serverCount": 0,
            "id": 811,
            "name": "",
            "customerNumber": "0123456789",
            "createdAt": "2015-07-16T13:06:45+0200",
            "updatedAt": "2015-07-16T13:06:45+0200"
        }
    ]
}

To retrieve a list of all your private network, send a GET request to /v1/privateNetworks.

The response will be a JSON object with key privateNetworks containing an array of your private network, each of which contain the following attributes:

Name Type Description
id integer The identifier of the private network
name string The name of the private network
serverCount integer Number of servers connected to this private network
createdAt date Date timestamp when the resource was created
updatedAt date Date timestamp when the resource was last updated
customerNumner string Your customer number

Create a Private Network

curl --request POST \
  --url https://api.leaseweb.com/v1/privateNetworks \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/privateNetworks",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("POST", "/v1/privateNetworks", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/privateNetworks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
    "id": 1,
    "message": "Your Private Network is successfully created."
}

To create a new Private Network resources, send a POST request to /v1/privateNetworks.

The response will be a JSON object containing the following attributes:

| Name | type | Description | | id | integer | The identifier of the newly created private network | | message | string | A status message |

Retrieve a Private Network

curl --request GET \
  --url https://api.leaseweb.com/v1/privateNetworks/1 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/privateNetworks/1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("GET", "/v1/privateNetworks/1", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/privateNetworks/1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  [
    {
        "id": 1,
        "name": "my-private-network",
        "bareMetals":
        [
            {
                "id": "12345",
                "dataCenter": "SFO-12",
                "CIDR": "10.29.0.0/27",
                "broadcast": "10.29.0.31",
                "gateway": "10.29.0.30",
                "netmask": "10.29.0.0",
                "status": "CONFIGURED"
            },
            {
                "id": "72649",
                "dataCenter": "SFO-12",
                "CIDR": "10.29.0.0/27",
                "broadcast": "10.29.0.31",
                "gateway": "10.29.0.30",
                "netmask": "10.29.0.0",
                "status": "REMOVING"
            }
        ]
    }
]

To get information about a specfic private network, send a GET request to /v1/privateNetworks/{id}.

The response will be a JSON object containing the standard private network attributes:

Name Type Description
id integer The identifier of the private network
name string The name of the private network
bareMetals object Array of bareMetals servers connected to this private network

The bareMetals object contains an array of bare metal servers, each of which contain the following attributes:

Name Type Description
id integer The identifier of the bare metal server
dataCenter string The location of the bare metal server
CIDR string The private network ip address in CIDR notation assigned to the bare metal server
broadcast string
gateway string
netmask string
status string
portSpeed string

Every bare metal server in your private network contains a ‘status’ key explaining the current state of your server in your private network.

Possbile state values are:

CONFIGURING: Your server is currently being added to the private network (can take ~1 minute)
CONFIGURED: Your server is part of the private network.
REMOVING: Your server is currently being removed from the private network (can take ~1 minute)

To retrieve a information s you can use for installations, send a GET request to /v1/operatingSystems.

The response will be a JSON object with key operatingSystems containing an array of available Operating Systems, each of which contain the standard Operating System attributes:

Name Type Description
id integer The identifier for the Operating Systems resource
name string The name of the Operating Systems resource

Delete a Private Network

curl --request DELETE \
  --url https://api.leaseweb.com/v1/privateNetworks/1 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/privateNetworks/1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("DELETE", "/v1/privateNetworks/1", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/privateNetworks/1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

Response Body

  {
  "message": "Your Private Network has been successfully deleted.",
}

To remove a Private Network resource, send a DELETE request to /v1/privateNetworks/{privateNetworkId}.

The response will be a JSON object containing a message attribute:

Name Type Description
message string A human readable message indicating your private network has been deleted

Add a bare metal server

curl --request POST \
  --url https://api.leaseweb.com/v1/privateNetworks/1/bareMetals \
  --header 'x-lsw-auth: 213423-2134234-234234-23424' \
  --data bareMetalId=12345
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/privateNetworks/1/bareMetals",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "bareMetalId=12345",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

payload = "bareMetalId=12345"

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("POST", "/v1/privateNetworks/1/bareMetals", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/privateNetworks/1/bareMetals")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'
request.body = "bareMetalId=12345"

response = http.request(request)
puts response.read_body

To add a Bare Metal server to a Private Network resource, send a POST request to /v1/privateNetworks/{privateNetworkId}/bareMetals.

The request should contain the following form parameters:

Name Type Description
bareMetalId integer The identifier of the Bare Metal server you want to add to the Private Network resource

On success the response will be a 204 No Content.

Remove a bare metal server

curl --request DELETE \
  --url https://api.leaseweb.com/v1/privateNetworks/1/bareMetals/12345 \
  --header 'x-lsw-auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/v1/privateNetworks/1/bareMetals/12345",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "x-lsw-auth: 213423-2134234-234234-23424"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.leaseweb.com")

headers = { 'x-lsw-auth': "213423-2134234-234234-23424" }

conn.request("DELETE", "/v1/privateNetworks/1/bareMetals/12345", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.leaseweb.com/v1/privateNetworks/1/bareMetals/12345")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["x-lsw-auth"] = '213423-2134234-234234-23424'

response = http.request(request)
puts response.read_body

To remove a Bare Metal server form the Private Network resource, send a DELETE request to /v1/privateNetworks/{privateNetworkId}/bareMetals/{bareMetalId}.

On success the Bare Metal server will be removed from the Private Network resource and the response status will be a 204 with no body returned.