Hosting API v1
Deprecated

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.

GEThttps://api.leaseweb.com/v1/domains
REQUEST EXAMPLE
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 EXAMPLE
200 OK
{
"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"
        }
    }
  ]
}

GETList your Domains

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
GEThttps://api.leaseweb.com/v1/domains/leaseweb.com
REQUEST EXAMPLE
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 EXAMPLE
200 OK
{
  "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"
  }
}

GETRetrieve a Domain

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
PUThttps://api.leaseweb.com/v1/domains/leaseweb.com
REQUEST EXAMPLE
curl --request PUT \
  --url https://api.leaseweb.com/v1/domains/leaseweb.com \
  --header 'X-LSW-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: x-www-form-urlencoded' \
  --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",
    "content-type: x-www-form-urlencoded"
  ),
));

$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",
    'content-type': "x-www-form-urlencoded"
    }

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["content-type"] = 'x-www-form-urlencoded'
request.body = "ttl=3600"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
200 OK
{
  "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"
  }
}

PUTUpdate a Domain

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
GEThttps://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords
REQUEST EXAMPLE
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 EXAMPLE
200 OK
{
  "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
        }
    }
  ]
}

GETList all Domain Records

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
POSThttps://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords
REQUEST EXAMPLE
curl --request POST \
  --url https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords \
  --header 'X-LSW-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: x-www-form-urlencoded' \
  --data host=www.yourdomain.tld \
  --data type=A \
  --data content=85.17.96.111 \
  --data priority=undefined
<?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",
    "content-type: x-www-form-urlencoded"
  ),
));

$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",
    'content-type': "x-www-form-urlencoded"
    }

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["content-type"] = 'x-www-form-urlencoded'
request.body = "host=www.yourdomain.tld&type=A&content=85.17.96.111&priority="

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
200 OK
{
  "dnsRecord": {
      "id": "860421",
      "host": "sub.yourname.tld",
      "type": "A",
      "content": "10.10.3.10"
  }
}

POSTCreate a new DNS Record

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
GEThttps://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords/12345
REQUEST EXAMPLE
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 EXAMPLE
200 OK
{
  "dnsRecord": {
      "id": "860421",
      "host": "sub.yourname.tld",
      "type": "A",
      "content": "10.10.3.10"
  }
}

GETRetrieve a DNS Record

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
PUThttps://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords/12345
REQUEST EXAMPLE
curl --request PUT \
  --url https://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords/12345 \
  --header 'X-LSW-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: x-www-form-urlencoded' \
  --data id=12345 \
  --data host=www.yourdomain.tld \
  --data type=A \
  --data content=85.17.96.112 \
  --data priority=undefined
<?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",
    "content-type: x-www-form-urlencoded"
  ),
));

$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",
    'content-type': "x-www-form-urlencoded"
    }

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["content-type"] = 'x-www-form-urlencoded'
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 EXAMPLE
200 OK
{
  "dnsRecord": {
      "id": "860421",
      "host": "sub.yourname.tld",
      "type": "A",
      "content": "10.10.3.10"
  }
}

PUTUpdate a DNS Record

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
DELETEhttps://api.leaseweb.com/v1/domains/leaseweb.com/dnsRecords/12345
REQUEST EXAMPLE
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
RESPONSE EXAMPLE
200 OK

DELETERemove a DNS Record

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.