Hosting API v2

Domains

GEThttps://api.leaseweb.com/hosting/v2/domains
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/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", "/hosting/v2/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/hosting/v2/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": [
    {
      "domainName": "example.com",
      "suspended": true,
      "dnsOnly" : false,
      "contractStartDate": "2017-04-01T00:00:00+02:00",
      "contractEndDate": "2018-04-01T00:00:00+02:00",
      "_links": {
        "self": {
          "href": "/domains/example.com"
        },
        "collection": {
          "href": "/domains"
        },
        "catchAll": {
          "href": "/domains/example.com/catchAll"
        },
        "contacts": {
          "href": "/domains/example.com/contacts"
        },
        "nameservers":{
          "href": "/domains/example.com/nameservers"
        },
        "emailAliases": {
          "href": "/domains/example.com/emailAliases"
        },
        "forwards": {
          "href": "/domains/example.com/forwards"
        },
        "mailboxes": {
          "href": "/domains/example.com/mailboxes"
        },
        "resourceRecordSets": {
          "href": "/domains/example.com/resourceRecordSets"
        },
        "validateZone": {
          "href": "/domains/example.com/validateZone"
        }
      }
    },
    {
      "domainName": "example.org",
      "suspended": false,
      "dnsOnly" : true,
      "contractStartDate": "2015-01-01T00:00:00+00:00",
      "_links": {
        "self": {
          "href": "/domains/example.org"
        },
        "collection": {
          "href": "/domains"
        },
        "catchAll": {
          "href": "/domains/example.org/catchAll"
        },
        "contacts": {
          "href": "/domains/example.com/contacts"
        },
        "nameservers":{
          "href": "/domains/example.com/nameservers"
        },
        "emailAliases": {
          "href": "/domains/example.org/emailAliases"
        },
        "forwards": {
          "href": "/domains/example.org/forwards"
        },
        "mailboxes": {
          "href": "/domains/example.org/mailboxes"
        },
        "resourceRecordSets": {
          "href": "/domains/example.org/resourceRecordSets"
        },
        "validateZone": {
          "href": "/domains/example.org/validateZone"
        }
      }
    },
    {
      "domainName": "example.nl",
      "suspended": false,
      "dnsOnly" : false,
      "contractStartDate": "2017-08-01T00:00:00+02:00",
      "contractEndDate": "2019-08-01T00:00:00+02:00",
      "_links": {
        "self": {
          "href": "/domains/example.nl"
        },
        "collection": {
          "href": "/domains"
        },
        "catchAll": {
          "href": "/domains/example.nl/catchAll"
        },
        "contacts": {
          "href": "/domains/example.com/contacts"
        },
        "nameservers":{
          "href": "/domains/example.com/nameservers"
        },
        "emailAliases": {
          "href": "/domains/example.nl/emailAliases"
        },
        "forwards": {
          "href": "/domains/example.nl/forwards"
        },
        "mailboxes": {
          "href": "/domains/example.nl/mailboxes"
        },
        "resourceRecordSets": {
          "href": "/domains/example.nl/resourceRecordSets"
        },
        "validateZone": {
          "href": "/domains/example.nl/validateZone"
        }
      }
    },
    {
      "domainName": "no-email-services-configured.com",
      "suspended": true,
      "dnsOnly" : false,
      "contractStartDate": "2012-11-01T00:00:00+01:00",
      "_links": {
        "self": {
          "href": "/domains/no-email-services-configured.com"
        },
        "collection": {
          "href": "/domains"
        },
        "catchAll": {
          "href": "/domains/no-email-services-configured.com/catchAll"
        },
        "contacts": {
          "href": "/domains/example.com/contacts"
        },
        "nameservers":{
          "href": "/domains/example.com/nameservers"
        },
        "emailAliases": {
          "href": "/domains/no-email-services-configured.com/emailAliases"
        },
        "forwards": {
          "href": "/domains/no-email-services-configured.com/forwards"
        },
        "mailboxes": {
          "href": "/domains/no-email-services-configured.com/mailboxes"
        },
        "resourceRecordSets": {
          "href": "/domains/no-email-services-configured.com/resourceRecordSets"
        },
        "validateZone": {
          "href": "/domains/no-email-services-configured.com/validateZone"
        }
      }
    }
  ],
  "_links": {
    "self": {
      "href": "/domains"
    },
    "dns": {
      "href": "/domains?type=dns"
    },
    "email": {
      "href": "/domains?type=email"
    }
  },
  "_metadata": {
    "totalCount": 4,
    "limit": 10,
    "offset": 0
  }
}

GETList your domains

Retrieve a paginated list of all of your domains with links to all related resources for each domain.


The following query string parameters are available:

Name Example Description
limit 5 Limit the number of results returned
offset 10 Return results starting from the given offset
type email Supplement the domain listing with statistics about either DNS or Email (Allowed values: dns,email)

The following properties describe the response:

Name Type Description
domains array An array of domains
domainName string The domain name
suspended boolean Boolean indicating whether the domain is suspended
dnsOnly boolean Boolean indicating whether the domain is dns only
contractStartDate string Contract start date in ISO 8601 format
contractEndDate string Optional contract end date in ISO 8601 format
_links object Links to related resource locations
self object Link to the domain resource
href string Hyperlink to the domain's location
collection object Link to the domain's collection
href string Hyperlink to the domain's collection location
catchAll object Link to the domain's catch all resource
href string Hyperlink to the domain's catch all resource location
contacts object Link to the domain's contact collection
href string Hyperlink to the domain's contact collection location
nameservers object Link to the domain's nameserver collection
href string Hyperlink to the domain's nameserver collection location
emailAliases object Link to the domain's email alias collection
href string Hyperlink to the domain's email alias collection location
forwards object Link to the domain's forward collection
href string Hyperlink to the domain's forward collection location
mailboxes object Link to the domain's mailbox collection
href string Hyperlink to the domain's mailbox collection location
resourceRecordSets object Link to the domain's resource record sets
href string Hyperlink to the domain's resource record sets collection location
validateZone object Link to validate the domain's zone
href string Hyperlink to validate resource record sets as a zone for the domain
_links object Links to related resource locations
self object Link to the domain collection
href string Hyperlink to the location of this collection
dns object Link to the DNS view of the domain collection
href string Hyperlink to the location of the DNS view of this collection
email object Link to the email view of the domain collection
href string Hyperlink to the location of the email view of this collection
_metadata object Metadata about the collection
totalCount integer The total number of domains
limit integer The maximum number of results returned
offset integer Results are returned starting at the given offset
GEThttps://api.leaseweb.com/hosting/v2/domains/example.com
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.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", "/hosting/v2/domains/example.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/hosting/v2/domains/example.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
{
  "domainName": "example.com",
  "suspended": true,
  "dnsOnly": true,
  "contractStartDate": "2017-04-01T00:00:00+02:00",
  "contractEndDate": "2018-04-01T00:00:00+02:00",
  "_links": {
    "self": {
      "href": "/domains/example.com"
    },
    "collection": {
      "href": "/domains"
    },
    "catchAll": {
      "href": "/domains/example.com/catchAll"
    },
    "contacts": {
      "href": "/domains/example.com/contacts"
    },
    "nameservers":{
      "href": "/domains/example.com/nameservers"
    },
    "emailAliases": {
      "href": "/domains/example.com/emailAliases"
    },
    "forwards": {
      "href": "/domains/example.com/forwards"
    },
    "mailboxes": {
      "href": "/domains/example.com/mailboxes"
    },
    "resourceRecordSets": {
      "href": "/domains/example.com/resourceRecordSets"
    },
    "validateZone": {
      "href": "/domains/example.com/validateZone"
    }
  }
}

GETRetrieve a domain

Retrieve information about a single domain.


The following properties describe the response:

Name Type Description
domainName string The domain name
suspended boolean Boolean indicating whether the domain is suspended
dnsOnly boolean Boolean indicating whether the domain is dns only
contractStartDate string Contract start date in ISO 8601 format
contractEndDate string Optional contract end date in ISO 8601 format
_links object Links to related resource locations
self object Link to the domain resource
href string Hyperlink to the domain's location
collection object Link to the domain's collection
href string Hyperlink to the domain's collection location
catchAll object Link to the domain's catch all resource
href string Hyperlink to the domain's catch all resource location
contacts object Link to the domain's contact collection
href string Hyperlink to the domain's contact collection location
nameservers object Link to the domain's nameserver collection
href string Hyperlink to the domain's nameserver collection location
emailAliases object Link to the domain's email alias collection
href string Hyperlink to the domain's email alias collection location
forwards object Link to the domain's forward collection
href string Hyperlink to the domain's forward collection location
mailboxes object Link to the domain's mailbox collection
href string Hyperlink to the domain's mailbox collection location
resourceRecordSets object Link to the domain's resource record sets
href string Hyperlink to the domain's resource record sets collection location
validateZone object Link to validate the domain's zone
href string Hyperlink to validate resource record sets as a zone for the domain
GEThttps://api.leaseweb.com/hosting/v2/domains/example.com/available
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/available \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/available",
  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", "/hosting/v2/domains/example.com/available", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/available")

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
{
  "domainName": "example.com",
  "available": true,
  "_links": {
    "self": {
      "href": "/domains/example.com/available"
    }
  }
}

GETDomain availability

Check whether a domain is available for registration.


The following properties describe the response:

Name Type Description
domainName string The domain name
available boolean Boolean indicating whether the domain is available
_links object Links to related resource locations
self object Link to check domain availability
href string Hyperlink to check domain availability
GEThttps://api.leaseweb.com/hosting/v2/domains/example.com/nameservers
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/nameservers \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/nameservers",
  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", "/hosting/v2/domains/example.com/nameservers", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/nameservers")

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
{
  "nameservers": [
    {
      "name": "ns1.example.com"
    },
    {
      "name": "ns2.example.net"
    }
  ],
  "_links": {
    "self": {
      "href": "/domains/{domainName}/nameservers"
    }
  },
  "_metadata": {
    "totalCount": 4
  }
}

GETList Nameservers

View the nameservers for a domain.


The following properties describe the response:

Name Type Description
nameservers array Array of nameservers
name string Name of the nameserver
PUThttps://api.leaseweb.com/hosting/v2/domains/example.com/nameservers
REQUEST EXAMPLE
curl --request PUT \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/nameservers \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "nameservers": [
    {
      "name": "ns1.example.com"
    },
    {
      "name": "ns2.example.net"
    }
  ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/nameservers",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{  \"nameservers\": [    {      \"name\": \"ns1.example.com\"    },    {      \"name\": \"ns2.example.net\"    }  ]}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"nameservers\": [    {      \"name\": \"ns1.example.com\"    },    {      \"name\": \"ns2.example.net\"    }  ]}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("PUT", "/hosting/v2/domains/example.com/nameservers", payload, headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/nameservers")

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"] = 'application/json'
request.body = "{  \"nameservers\": [    {      \"name\": \"ns1.example.com\"    },    {      \"name\": \"ns2.example.net\"    }  ]}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
200 OK
{
  "nameservers": [
    {
      "name": "ns1.example.com"
    },
    {
      "name": "ns2.example.net"
    }
  ],
  "_links": {
    "self": {
      "href": "/domains/{domainName}/nameservers"
    }
  },
  "_metadata": {
    "totalCount": 4
  }
}

PUTUpdate Nameservers

Full replacement of all nameservers for a domain.

Please note that the request body should contain at least two nameservers.


The following properties should be part of the request:

Name Type Required Description
nameservers array true Array of nameservers
name string true Name of the nameserver

The following properties describe the response:

Name Type Description
nameservers array Array of nameservers
name string Name of the nameserver

DNS

Manage the DNS configuration of your domains.

GEThttps://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets",
  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", "/hosting/v2/domains/example.com/resourceRecordSets", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets")

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
{
  "infoMessage": "EXAMPLE: Sorry, but your domain is not yet listed on our nameservers. Please create a DNS record first so we can add your domain.",
  "resourceRecordSets": [
    {
      "name": "example.com.",
      "type": "A",
      "content": [
        "85.17.150.50",
        "85.17.150.50",
        "85.17.150.53"
      ],
      "ttl": 300,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/example.com./A"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "subdomain.example.com.",
      "type": "A",
      "content": [
        "85.17.150.54"
      ],
      "ttl": 86400,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/subdomain.example.com./A"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "example.com.",
      "type": "AAAA",
      "content": [
        "2a02:2770:8:0:216:3eff:fead:8c93"
      ],
      "ttl": 28800,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/example.com./AAAA"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "some.example.com.",
      "type": "AAAA",
      "content": [
        "2a02:2770:8:0:216:3eff:fead:8c93"
      ],
      "ttl": 300,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/some.example.com./AAAA"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "example.com.",
      "type": "CAA",
      "content": [
        "0 issue \"comodoca.com\""
      ],
      "ttl": 300,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/example.com./CAA"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "anotherurl.example.com.",
      "type": "CNAME",
      "content": [
        "example.com."
      ],
      "ttl": 86400,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/anotherurl.example.com./CNAME"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "example.com.",
      "type": "MX",
      "content": [
        "10 mail.example.com.",
        "20 mailfilter.leaseweb.com."
      ],
      "ttl": 3600,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/example.com./MX"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "subdomain.example.com.",
      "type": "NS",
      "content": [
        "other.nameserver.com",
        "yet-another.nameserver.com"
      ],
      "ttl": 3600,
      "editable": false,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/subdomain.example.com./NS"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "example.com.",
      "type": "SRV",
      "content": [
        "10 5 5060 sipserver.example.com."
      ],
      "ttl": 14400,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/example.com./SRV"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "example.com.",
      "type": "TXT",
      "content": [
        "\"google-site-verification=Kkalsdhl8a9792342lksdo9bSER233\"",
        "\"v=spf1 a mx -all\""
      ],
      "ttl": 3600,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/example.com./TXT"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    }
  ],
  "_links": {
    "self": {
      "href": "/domains/example.com/resourceRecordSets"
    },
    "parent": {
      "href": "/domains/example.com"
    },
    "validateSet": {
      "href": "/domains/example.com/resourceRecordSets/validateSet"
    }
  }
}

GETList resource record sets

List all resource records sets for a domain.


The following properties describe the response:

Name Type Description
infoMessage string Optional additional information
resourceRecordSets array Array of resource record sets
name string Name of the resource record set
type string Type of the resource record set (Allowed values: A,AAAA,CAA,CNAME,MX,SRV,TXT)
content array Array of resource record set content entries
ttl integer Time to live of the resource record set (Allowed values: 60,300,1800,3600,14400,28800,43200,86400)
editable boolean Boolean indicating whether the set may be edited
_links object Links to related resource locations
self object Link to the resource record set resource
href string Hyperlink to the resource record set's location
collection object Link to the resource record sets collection
href string Hyperlink to the resource record sets collection location
_links object Links to related resource locations
self object Link to the resource record sets collection
href string Hyperlink to the resource record sets collection location
parent object Link to the parent resource
href string Hyperlink to the parent resource location
validateSet object Link to validate a single resource record set
href string Hyperlink to validate a single resource record set for a domain
POSThttps://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets
REQUEST EXAMPLE
curl --request POST \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "name": "example.com.",
  "type": "A",
  "content": [
    "85.17.150.51",
    "85.17.150.52",
    "85.17.150.53"
  ],
  "ttl": 3600
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{  \"name\": \"example.com.\",  \"type\": \"A\",  \"content\": [    \"85.17.150.51\",    \"85.17.150.52\",    \"85.17.150.53\"  ],  \"ttl\": 3600}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"name\": \"example.com.\",  \"type\": \"A\",  \"content\": [    \"85.17.150.51\",    \"85.17.150.52\",    \"85.17.150.53\"  ],  \"ttl\": 3600}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("POST", "/hosting/v2/domains/example.com/resourceRecordSets", payload, headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets")

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"] = 'application/json'
request.body = "{  \"name\": \"example.com.\",  \"type\": \"A\",  \"content\": [    \"85.17.150.51\",    \"85.17.150.52\",    \"85.17.150.53\"  ],  \"ttl\": 3600}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
201 Created
{
  "name": "example.com.",
  "type": "A",
  "content": [
    "85.17.150.51",
    "85.17.150.52",
    "85.17.150.53"
  ],
  "ttl": 3600,
  "editable": true,
  "_links": {
    "self": {
      "href": "/domains/example.com/resourceRecordSets/example.com./A"
    },
    "collection": {
      "href": "/domains/example.com/resourceRecordSets"
    }
  }
}

POSTCreate resource record set

Create a new resource record set.


The following properties should be part of the request:

Name Type Required Description
name string true Name of the resource record set
type string true Type of the resource record set (Allowed values: A,AAAA,CAA,CNAME,MX,SRV,TXT)
content array true Array of resource record set content entries
ttl integer true Time to live of the resource record set (Allowed values: 60,300,1800,3600,14400,28800,43200,86400)

The following properties describe the response:

Name Type Description
name string Name of the resource record set
type string Type of the resource record set (Allowed values: A,AAAA,CAA,CNAME,MX,SRV,TXT)
content array Array of resource record set content entries
ttl integer Time to live of the resource record set (Allowed values: 60,300,1800,3600,14400,28800,43200,86400)
editable boolean Boolean indicating whether the set may be edited
_links object Links to related resource locations
self object Link to the resource record set resource
href string Hyperlink to the resource record set's location
collection object Link to the resource record sets collection
href string Hyperlink to the resource record sets collection location
PUThttps://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets
REQUEST EXAMPLE
curl --request PUT \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "resourceRecordSets": [
    {
      "name": "example.com.",
      "type": "A",
      "content": [
          "85.17.150.50",
          "85.17.150.50",
          "85.17.150.53"
      ],
      "ttl": 300
    },
    {
      "name": "*.example.com.",
      "type": "A",
      "content": [
          "85.17.150.54"
      ],
      "ttl": 86400
    },
    {
      "name": "example.com.",
      "type": "AAAA",
      "content": [
        "2a02:2770:8:0:216:3eff:fead:8c93"
      ],
      "ttl": 28800
    },
    {
      "name": "some.example.com.",
      "type": "AAAA",
      "content": [
        "2a02:2770:8:0:216:3eff:fead:8c93"
      ],
      "ttl": 60
    },
    {
      "name": "example.com.",
      "type": "CAA",
      "content": [
        "0 issue \"comodoca.com\""
      ],
      "ttl": 300
    },
    {
      "name": "anotherurl.example.com.",
      "type": "CNAME",
      "content": [
        "example.com."
      ],
      "ttl": 86400
    },
    {
      "name": "example.com.",
      "type": "MX",
      "content": [
          "10 mail.example.com.",
          "20 mailfilter.leaseweb.com."
      ],
      "ttl": 3600
    },
    {
      "name": "example.com.",
      "type": "SRV",
      "content": [
          "10 5 5060 sipserver.example.com."
      ],
      "ttl": 14400
    },
    {
      "name": "example.com.",
      "type": "TXT",
      "content": [
          "\"google-site-verification=Kkalsdhl8a9792342lksdo9bSER233\"",
          "\"v=spf1 a mx -all\""
      ],
      "ttl" : 3600
    }
  ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{  \"resourceRecordSets\": [    {      \"name\": \"example.com.\",      \"type\": \"A\",      \"content\": [          \"85.17.150.50\",          \"85.17.150.50\",          \"85.17.150.53\"      ],      \"ttl\": 300    },    {      \"name\": \"*.example.com.\",      \"type\": \"A\",      \"content\": [          \"85.17.150.54\"      ],      \"ttl\": 86400    },    {      \"name\": \"example.com.\",      \"type\": \"AAAA\",      \"content\": [        \"2a02:2770:8:0:216:3eff:fead:8c93\"      ],      \"ttl\": 28800    },    {      \"name\": \"some.example.com.\",      \"type\": \"AAAA\",      \"content\": [        \"2a02:2770:8:0:216:3eff:fead:8c93\"      ],      \"ttl\": 60    },    {      \"name\": \"example.com.\",      \"type\": \"CAA\",      \"content\": [        \"0 issue \\\"comodoca.com\\\"\"      ],      \"ttl\": 300    },    {      \"name\": \"anotherurl.example.com.\",      \"type\": \"CNAME\",      \"content\": [        \"example.com.\"      ],      \"ttl\": 86400    },    {      \"name\": \"example.com.\",      \"type\": \"MX\",      \"content\": [          \"10 mail.example.com.\",          \"20 mailfilter.leaseweb.com.\"      ],      \"ttl\": 3600    },    {      \"name\": \"example.com.\",      \"type\": \"SRV\",      \"content\": [          \"10 5 5060 sipserver.example.com.\"      ],      \"ttl\": 14400    },    {      \"name\": \"example.com.\",      \"type\": \"TXT\",      \"content\": [          \"\\\"google-site-verification=Kkalsdhl8a9792342lksdo9bSER233\\\"\",          \"\\\"v=spf1 a mx -all\\\"\"      ],      \"ttl\" : 3600    }  ]}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"resourceRecordSets\": [    {      \"name\": \"example.com.\",      \"type\": \"A\",      \"content\": [          \"85.17.150.50\",          \"85.17.150.50\",          \"85.17.150.53\"      ],      \"ttl\": 300    },    {      \"name\": \"*.example.com.\",      \"type\": \"A\",      \"content\": [          \"85.17.150.54\"      ],      \"ttl\": 86400    },    {      \"name\": \"example.com.\",      \"type\": \"AAAA\",      \"content\": [        \"2a02:2770:8:0:216:3eff:fead:8c93\"      ],      \"ttl\": 28800    },    {      \"name\": \"some.example.com.\",      \"type\": \"AAAA\",      \"content\": [        \"2a02:2770:8:0:216:3eff:fead:8c93\"      ],      \"ttl\": 60    },    {      \"name\": \"example.com.\",      \"type\": \"CAA\",      \"content\": [        \"0 issue \\\"comodoca.com\\\"\"      ],      \"ttl\": 300    },    {      \"name\": \"anotherurl.example.com.\",      \"type\": \"CNAME\",      \"content\": [        \"example.com.\"      ],      \"ttl\": 86400    },    {      \"name\": \"example.com.\",      \"type\": \"MX\",      \"content\": [          \"10 mail.example.com.\",          \"20 mailfilter.leaseweb.com.\"      ],      \"ttl\": 3600    },    {      \"name\": \"example.com.\",      \"type\": \"SRV\",      \"content\": [          \"10 5 5060 sipserver.example.com.\"      ],      \"ttl\": 14400    },    {      \"name\": \"example.com.\",      \"type\": \"TXT\",      \"content\": [          \"\\\"google-site-verification=Kkalsdhl8a9792342lksdo9bSER233\\\"\",          \"\\\"v=spf1 a mx -all\\\"\"      ],      \"ttl\" : 3600    }  ]}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("PUT", "/hosting/v2/domains/example.com/resourceRecordSets", payload, headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets")

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"] = 'application/json'
request.body = "{  \"resourceRecordSets\": [    {      \"name\": \"example.com.\",      \"type\": \"A\",      \"content\": [          \"85.17.150.50\",          \"85.17.150.50\",          \"85.17.150.53\"      ],      \"ttl\": 300    },    {      \"name\": \"*.example.com.\",      \"type\": \"A\",      \"content\": [          \"85.17.150.54\"      ],      \"ttl\": 86400    },    {      \"name\": \"example.com.\",      \"type\": \"AAAA\",      \"content\": [        \"2a02:2770:8:0:216:3eff:fead:8c93\"      ],      \"ttl\": 28800    },    {      \"name\": \"some.example.com.\",      \"type\": \"AAAA\",      \"content\": [        \"2a02:2770:8:0:216:3eff:fead:8c93\"      ],      \"ttl\": 60    },    {      \"name\": \"example.com.\",      \"type\": \"CAA\",      \"content\": [        \"0 issue \\\"comodoca.com\\\"\"      ],      \"ttl\": 300    },    {      \"name\": \"anotherurl.example.com.\",      \"type\": \"CNAME\",      \"content\": [        \"example.com.\"      ],      \"ttl\": 86400    },    {      \"name\": \"example.com.\",      \"type\": \"MX\",      \"content\": [          \"10 mail.example.com.\",          \"20 mailfilter.leaseweb.com.\"      ],      \"ttl\": 3600    },    {      \"name\": \"example.com.\",      \"type\": \"SRV\",      \"content\": [          \"10 5 5060 sipserver.example.com.\"      ],      \"ttl\": 14400    },    {      \"name\": \"example.com.\",      \"type\": \"TXT\",      \"content\": [          \"\\\"google-site-verification=Kkalsdhl8a9792342lksdo9bSER233\\\"\",          \"\\\"v=spf1 a mx -all\\\"\"      ],      \"ttl\" : 3600    }  ]}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
200 OK
{
  "infoMessage": "EXAMPLE: Sorry, but your domain is not yet listed on our nameservers. Please create a DNS record first so we can add your domain.",
  "resourceRecordSets": [
    {
      "name": "example.com.",
      "type": "A",
      "content": [
        "85.17.150.50",
        "85.17.150.50",
        "85.17.150.53"
      ],
      "ttl": 300,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/example.com./A"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "subdomain.example.com.",
      "type": "A",
      "content": [
        "85.17.150.54"
      ],
      "ttl": 86400,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/subdomain.example.com./A"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "example.com.",
      "type": "AAAA",
      "content": [
        "2a02:2770:8:0:216:3eff:fead:8c93"
      ],
      "ttl": 28800,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/example.com./AAAA"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "some.example.com.",
      "type": "AAAA",
      "content": [
        "2a02:2770:8:0:216:3eff:fead:8c93"
      ],
      "ttl": 300,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/some.example.com./AAAA"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "example.com.",
      "type": "CAA",
      "content": [
        "0 issue \"comodoca.com\""
      ],
      "ttl": 300,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/example.com./CAA"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "anotherurl.example.com.",
      "type": "CNAME",
      "content": [
        "example.com."
      ],
      "ttl": 86400,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/anotherurl.example.com./CNAME"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "example.com.",
      "type": "MX",
      "content": [
        "10 mail.example.com.",
        "20 mailfilter.leaseweb.com."
      ],
      "ttl": 3600,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/example.com./MX"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "subdomain.example.com.",
      "type": "NS",
      "content": [
        "other.nameserver.com",
        "yet-another.nameserver.com"
      ],
      "ttl": 3600,
      "editable": false,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/subdomain.example.com./NS"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "example.com.",
      "type": "SRV",
      "content": [
        "10 5 5060 sipserver.example.com."
      ],
      "ttl": 14400,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/example.com./SRV"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    },
    {
      "name": "example.com.",
      "type": "TXT",
      "content": [
        "\"google-site-verification=Kkalsdhl8a9792342lksdo9bSER233\"",
        "\"v=spf1 a mx -all\""
      ],
      "ttl": 3600,
      "editable": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/resourceRecordSets/example.com./TXT"
        },
        "collection": {
          "href": "/domains/example.com/resourceRecordSets"
        }
      }
    }
  ],
  "_links": {
    "self": {
      "href": "/domains/example.com/resourceRecordSets"
    },
    "parent": {
      "href": "/domains/example.com"
    },
    "validateSet": {
      "href": "/domains/example.com/resourceRecordSets/validateSet"
    }
  }
}

PUTUpdate resource record sets

Full replacement of all editable resource records sets for a domain.

Please note that the request body should contain at least one resource record set.


The following properties should be part of the request:

Name Type Required Description
resourceRecordSets array true Array of resource record sets
name string true Name of the resource record set
type string true Type of the resource record set (Allowed values: A,AAAA,CAA,CNAME,MX,SRV,TXT)
content array true Array of resource record set content entries
ttl integer true Time to live of the resource record set (Allowed values: 60,300,1800,3600,14400,28800,43200,86400)

The following properties describe the response:

Name Type Description
infoMessage string Optional additional information
resourceRecordSets array Array of resource record sets
name string Name of the resource record set
type string Type of the resource record set (Allowed values: A,AAAA,CAA,CNAME,MX,SRV,TXT)
content array Array of resource record set content entries
ttl integer Time to live of the resource record set (Allowed values: 60,300,1800,3600,14400,28800,43200,86400)
editable boolean Boolean indicating whether the set may be edited
_links object Links to related resource locations
self object Link to the resource record set resource
href string Hyperlink to the resource record set's location
collection object Link to the resource record sets collection
href string Hyperlink to the resource record sets collection location
_links object Links to related resource locations
self object Link to the resource record sets collection
href string Hyperlink to the resource record sets collection location
parent object Link to the parent resource
href string Hyperlink to the parent resource location
validateSet object Link to validate a single resource record set
href string Hyperlink to validate a single resource record set for a domain
DELETEhttps://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets
REQUEST EXAMPLE
curl --request DELETE \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets",
  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", "/hosting/v2/domains/example.com/resourceRecordSets", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets")

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
204 No Content

Succesfully deleted the resource record sets

DELETEDelete resource record sets

Delete all editable resource record sets for a domain.

Please note that this action will keep the domain's zone in place.

GEThttps://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/example.com./A
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/example.com./A \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/example.com./A",
  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", "/hosting/v2/domains/example.com/resourceRecordSets/example.com./A", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/example.com./A")

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
{
  "name": "example.com.",
  "type": "A",
  "content": [
    "85.17.150.51",
    "85.17.150.52",
    "85.17.150.53"
  ],
  "ttl": 3600,
  "editable": true,
  "_links": {
    "self": {
      "href": "/domains/example.com/resourceRecordSets/example.com./A"
    },
    "collection": {
      "href": "/domains/example.com/resourceRecordSets"
    }
  }
}

GETRetrieve resource record set

View a single resource record set.


The following properties describe the response:

Name Type Description
name string Name of the resource record set
type string Type of the resource record set (Allowed values: A,AAAA,CAA,CNAME,MX,SRV,TXT)
content array Array of resource record set content entries
ttl integer Time to live of the resource record set (Allowed values: 60,300,1800,3600,14400,28800,43200,86400)
editable boolean Boolean indicating whether the set may be edited
_links object Links to related resource locations
self object Link to the resource record set resource
href string Hyperlink to the resource record set's location
collection object Link to the resource record sets collection
href string Hyperlink to the resource record sets collection location
PUThttps://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/example.com./A
REQUEST EXAMPLE
curl --request PUT \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/example.com./A \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "content": [
    "85.17.150.51",
    "85.17.150.52",
    "85.17.150.53"
  ],
  "ttl": 3600
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/example.com./A",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{  \"content\": [    \"85.17.150.51\",    \"85.17.150.52\",    \"85.17.150.53\"  ],  \"ttl\": 3600}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"content\": [    \"85.17.150.51\",    \"85.17.150.52\",    \"85.17.150.53\"  ],  \"ttl\": 3600}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("PUT", "/hosting/v2/domains/example.com/resourceRecordSets/example.com./A", payload, headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/example.com./A")

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"] = 'application/json'
request.body = "{  \"content\": [    \"85.17.150.51\",    \"85.17.150.52\",    \"85.17.150.53\"  ],  \"ttl\": 3600}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
200 OK
{
  "name": "example.com.",
  "type": "A",
  "content": [
    "85.17.150.51",
    "85.17.150.52",
    "85.17.150.53"
  ],
  "ttl": 3600,
  "editable": true,
  "_links": {
    "self": {
      "href": "/domains/example.com/resourceRecordSets/example.com./A"
    },
    "collection": {
      "href": "/domains/example.com/resourceRecordSets"
    }
  }
}

PUTUpdate resource record set

Update a single resource record set.


The following properties should be part of the request:

Name Type Required Description
content array true Array of resource record set content entries
ttl integer true Time to live of the resource record set (Allowed values: 60,300,1800,3600,14400,28800,43200,86400)

The following properties describe the response:

Name Type Description
name string Name of the resource record set
type string Type of the resource record set (Allowed values: A,AAAA,CAA,CNAME,MX,SRV,TXT)
content array Array of resource record set content entries
ttl integer Time to live of the resource record set (Allowed values: 60,300,1800,3600,14400,28800,43200,86400)
editable boolean Boolean indicating whether the set may be edited
_links object Links to related resource locations
self object Link to the resource record set resource
href string Hyperlink to the resource record set's location
collection object Link to the resource record sets collection
href string Hyperlink to the resource record sets collection location
DELETEhttps://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/example.com./A
REQUEST EXAMPLE
curl --request DELETE \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/example.com./A \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/example.com./A",
  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", "/hosting/v2/domains/example.com/resourceRecordSets/example.com./A", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/example.com./A")

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
204 No Content

Succesfully deleted the resource record set.

DELETEDelete resource record set

Delete a single resource record set.

POSThttps://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/validateSet
REQUEST EXAMPLE
curl --request POST \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/validateSet \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "name": "example.com.",
  "type": "A",
  "content": [
    "85.17.150.51",
    "85.17.150.52",
    "85.17.150.53"
  ],
  "ttl": 3600
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/validateSet",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{  \"name\": \"example.com.\",  \"type\": \"A\",  \"content\": [    \"85.17.150.51\",    \"85.17.150.52\",    \"85.17.150.53\"  ],  \"ttl\": 3600}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"name\": \"example.com.\",  \"type\": \"A\",  \"content\": [    \"85.17.150.51\",    \"85.17.150.52\",    \"85.17.150.53\"  ],  \"ttl\": 3600}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("POST", "/hosting/v2/domains/example.com/resourceRecordSets/validateSet", payload, headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/resourceRecordSets/validateSet")

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"] = 'application/json'
request.body = "{  \"name\": \"example.com.\",  \"type\": \"A\",  \"content\": [    \"85.17.150.51\",    \"85.17.150.52\",    \"85.17.150.53\"  ],  \"ttl\": 3600}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
200 OK
{
  "infoMessage": Resource record set is valid.
}

POSTValidate resource record set

This endpoint may be used to validate whether a resource record set is valid, without actually creating it.


The following properties should be part of the request:

Name Type Required Description
name string true Name of the resource record set
type string true Type of the resource record set (Allowed values: A,AAAA,CAA,CNAME,MX,SRV,TXT)
content array true Array of resource record set content entries
ttl integer true Time to live of the resource record set (Allowed values: 60,300,1800,3600,14400,28800,43200,86400)

The following properties describe the response:

Name Type Description
infoMessage string Informational message
POSThttps://api.leaseweb.com/hosting/v2/domains/example.com/validateZone
REQUEST EXAMPLE
curl --request POST \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/validateZone \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "resourceRecordSets": [
    {
      "name": "example.com.",
      "type": "A",
      "content": [
          "85.17.150.50",
          "85.17.150.50",
          "85.17.150.53"
      ],
      "ttl": 300
    },
    {
      "name": "*.example.com.",
      "type": "A",
      "content": [
          "85.17.150.54"
      ],
      "ttl": 86400
    },
    {
      "name": "example.com.",
      "type": "AAAA",
      "content": [
        "2a02:2770:8:0:216:3eff:fead:8c93"
      ],
      "ttl": 28800
    },
    {
      "name": "some.example.com.",
      "type": "AAAA",
      "content": [
        "2a02:2770:8:0:216:3eff:fead:8c93"
      ],
      "ttl": 60
    },
    {
      "name": "example.com.",
      "type": "CAA",
      "content": [
        "0 issue \"comodoca.com\""
      ],
      "ttl": 300
    },
    {
      "name": "anotherurl.example.com.",
      "type": "CNAME",
      "content": [
        "example.com."
      ],
      "ttl": 86400
    },
    {
      "name": "example.com.",
      "type": "MX",
      "content": [
          "10 mail.example.com.",
          "20 mailfilter.leaseweb.com."
      ],
      "ttl": 3600
    },
    {
      "name": "example.com.",
      "type": "SRV",
      "content": [
          "10 5 5060 sipserver.example.com."
      ],
      "ttl": 14400
    },
    {
      "name": "example.com.",
      "type": "TXT",
      "content": [
          "\"google-site-verification=Kkalsdhl8a9792342lksdo9bSER233\"",
          "\"v=spf1 a mx -all\""
      ],
      "ttl" : 3600
    }
  ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/validateZone",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{  \"resourceRecordSets\": [    {      \"name\": \"example.com.\",      \"type\": \"A\",      \"content\": [          \"85.17.150.50\",          \"85.17.150.50\",          \"85.17.150.53\"      ],      \"ttl\": 300    },    {      \"name\": \"*.example.com.\",      \"type\": \"A\",      \"content\": [          \"85.17.150.54\"      ],      \"ttl\": 86400    },    {      \"name\": \"example.com.\",      \"type\": \"AAAA\",      \"content\": [        \"2a02:2770:8:0:216:3eff:fead:8c93\"      ],      \"ttl\": 28800    },    {      \"name\": \"some.example.com.\",      \"type\": \"AAAA\",      \"content\": [        \"2a02:2770:8:0:216:3eff:fead:8c93\"      ],      \"ttl\": 60    },    {      \"name\": \"example.com.\",      \"type\": \"CAA\",      \"content\": [        \"0 issue \\\"comodoca.com\\\"\"      ],      \"ttl\": 300    },    {      \"name\": \"anotherurl.example.com.\",      \"type\": \"CNAME\",      \"content\": [        \"example.com.\"      ],      \"ttl\": 86400    },    {      \"name\": \"example.com.\",      \"type\": \"MX\",      \"content\": [          \"10 mail.example.com.\",          \"20 mailfilter.leaseweb.com.\"      ],      \"ttl\": 3600    },    {      \"name\": \"example.com.\",      \"type\": \"SRV\",      \"content\": [          \"10 5 5060 sipserver.example.com.\"      ],      \"ttl\": 14400    },    {      \"name\": \"example.com.\",      \"type\": \"TXT\",      \"content\": [          \"\\\"google-site-verification=Kkalsdhl8a9792342lksdo9bSER233\\\"\",          \"\\\"v=spf1 a mx -all\\\"\"      ],      \"ttl\" : 3600    }  ]}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"resourceRecordSets\": [    {      \"name\": \"example.com.\",      \"type\": \"A\",      \"content\": [          \"85.17.150.50\",          \"85.17.150.50\",          \"85.17.150.53\"      ],      \"ttl\": 300    },    {      \"name\": \"*.example.com.\",      \"type\": \"A\",      \"content\": [          \"85.17.150.54\"      ],      \"ttl\": 86400    },    {      \"name\": \"example.com.\",      \"type\": \"AAAA\",      \"content\": [        \"2a02:2770:8:0:216:3eff:fead:8c93\"      ],      \"ttl\": 28800    },    {      \"name\": \"some.example.com.\",      \"type\": \"AAAA\",      \"content\": [        \"2a02:2770:8:0:216:3eff:fead:8c93\"      ],      \"ttl\": 60    },    {      \"name\": \"example.com.\",      \"type\": \"CAA\",      \"content\": [        \"0 issue \\\"comodoca.com\\\"\"      ],      \"ttl\": 300    },    {      \"name\": \"anotherurl.example.com.\",      \"type\": \"CNAME\",      \"content\": [        \"example.com.\"      ],      \"ttl\": 86400    },    {      \"name\": \"example.com.\",      \"type\": \"MX\",      \"content\": [          \"10 mail.example.com.\",          \"20 mailfilter.leaseweb.com.\"      ],      \"ttl\": 3600    },    {      \"name\": \"example.com.\",      \"type\": \"SRV\",      \"content\": [          \"10 5 5060 sipserver.example.com.\"      ],      \"ttl\": 14400    },    {      \"name\": \"example.com.\",      \"type\": \"TXT\",      \"content\": [          \"\\\"google-site-verification=Kkalsdhl8a9792342lksdo9bSER233\\\"\",          \"\\\"v=spf1 a mx -all\\\"\"      ],      \"ttl\" : 3600    }  ]}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("POST", "/hosting/v2/domains/example.com/validateZone", payload, headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/validateZone")

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"] = 'application/json'
request.body = "{  \"resourceRecordSets\": [    {      \"name\": \"example.com.\",      \"type\": \"A\",      \"content\": [          \"85.17.150.50\",          \"85.17.150.50\",          \"85.17.150.53\"      ],      \"ttl\": 300    },    {      \"name\": \"*.example.com.\",      \"type\": \"A\",      \"content\": [          \"85.17.150.54\"      ],      \"ttl\": 86400    },    {      \"name\": \"example.com.\",      \"type\": \"AAAA\",      \"content\": [        \"2a02:2770:8:0:216:3eff:fead:8c93\"      ],      \"ttl\": 28800    },    {      \"name\": \"some.example.com.\",      \"type\": \"AAAA\",      \"content\": [        \"2a02:2770:8:0:216:3eff:fead:8c93\"      ],      \"ttl\": 60    },    {      \"name\": \"example.com.\",      \"type\": \"CAA\",      \"content\": [        \"0 issue \\\"comodoca.com\\\"\"      ],      \"ttl\": 300    },    {      \"name\": \"anotherurl.example.com.\",      \"type\": \"CNAME\",      \"content\": [        \"example.com.\"      ],      \"ttl\": 86400    },    {      \"name\": \"example.com.\",      \"type\": \"MX\",      \"content\": [          \"10 mail.example.com.\",          \"20 mailfilter.leaseweb.com.\"      ],      \"ttl\": 3600    },    {      \"name\": \"example.com.\",      \"type\": \"SRV\",      \"content\": [          \"10 5 5060 sipserver.example.com.\"      ],      \"ttl\": 14400    },    {      \"name\": \"example.com.\",      \"type\": \"TXT\",      \"content\": [          \"\\\"google-site-verification=Kkalsdhl8a9792342lksdo9bSER233\\\"\",          \"\\\"v=spf1 a mx -all\\\"\"      ],      \"ttl\" : 3600    }  ]}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
200 OK
{
  "infoMessage": Zone example.com is valid.
}

POSTValidate zone

This endpoint may be used to validate whether a collection of resource record sets constitute a valid zone, without creating them.


The following properties should be part of the request:

Name Type Required Description
resourceRecordSets array true Array of resource record sets
name string true Name of the resource record set
type string true Type of the resource record set (Allowed values: A,AAAA,CAA,CNAME,MX,SRV,TXT)
content array true Array of resource record set content entries
ttl integer true Time to live of the resource record set (Allowed values: 60,300,1800,3600,14400,28800,43200,86400)

The following properties describe the response:

Name Type Description
infoMessage string Informational message

Email

Manage the email configuration of your domains.

GEThttps://api.leaseweb.com/hosting/v2/domains/example.com/catchAll
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/catchAll \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/catchAll",
  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", "/hosting/v2/domains/example.com/catchAll", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/catchAll")

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
{
  "destination": "destination@example.org",
  "spamChecksEnabled": true,
  "virusChecksEnabled": false,
  "_links": {
    "self": {
      "href": "/domains/example.com/catchAll"
    },
    "parent": {
      "href": "/domains/example.com"
    }
  }
}

GETRetrieve catch all

View the catch all.


The following properties describe the response:

Name Type Description
destination string The email address to which email messages will be delivered for the catch all
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_links object Links to related resource locations
self object Link to the catch all
href string Hyperlink to the catch all's location
parent object Link to the parent resource
href string Hyperlink to the parent resource location
PUThttps://api.leaseweb.com/hosting/v2/domains/example.com/catchAll
REQUEST EXAMPLE
curl --request PUT \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/catchAll \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "destination": "destination@example.org",
  "spamChecksEnabled": true,
  "virusChecksEnabled": false
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/catchAll",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{  \"destination\": \"destination@example.org\",  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": false}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"destination\": \"destination@example.org\",  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": false}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("PUT", "/hosting/v2/domains/example.com/catchAll", payload, headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/catchAll")

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"] = 'application/json'
request.body = "{  \"destination\": \"destination@example.org\",  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": false}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
200 OK
{
  "destination": "destination@example.org",
  "spamChecksEnabled": true,
  "virusChecksEnabled": false,
  "_links": {
    "self": {
      "href": "/domains/example.com/catchAll"
    },
    "parent": {
      "href": "/domains/example.com"
    }
  }
}

PUTChange catch all

Create or update the catch all.

On success the response will be either a HTTP 201 Created or a HTTP 200 OK respectively.


The following properties should be part of the request:

Name Type Required Description
destination string true The email address to which email messages will be delivered for the catch all
spamChecksEnabled boolean true Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean true Boolean indicating whether virus checks are enabled

The following properties describe the response:

Name Type Description
destination string The email address to which email messages will be delivered for the catch all
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_links object Links to related resource locations
self object Link to the catch all
href string Hyperlink to the catch all's location
parent object Link to the parent resource
href string Hyperlink to the parent resource location
DELETEhttps://api.leaseweb.com/hosting/v2/domains/example.com/catchAll
REQUEST EXAMPLE
curl --request DELETE \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/catchAll \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/catchAll",
  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", "/hosting/v2/domains/example.com/catchAll", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/catchAll")

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
204 No Content

Succesfully deleted the catch all.

DELETEDelete catch all

Delete the catch all.

GEThttps://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases",
  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", "/hosting/v2/domains/example.com/emailAliases", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases")

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
{
  "emailAliases":[
    {
      "active": true,
      "destination": "destination@example.com",
      "source": "source@example.com",
      "spamChecksEnabled": true,
      "virusChecksEnabled": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/emailAliases/source%40example.com/destination%40example.com"
        },
        "collection": {
          "href": "/domains/example.com/emailAliases"
        }
      }
    },
    {
      "active": true,
      "destination": "destination@example.org",
      "source": "source@example.com",
      "spamChecksEnabled": false,
      "virusChecksEnabled": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/emailAliases/source%40example.com/destination%40example.org"
        },
        "collection": {
          "href": "/domains/example.com/emailAliases"
        }
      }
    },
    {
      "active": true,
      "destination": "mailbox@example.org",
      "source": "not-a-mailbox@example.com",
      "spamChecksEnabled": true,
      "virusChecksEnabled": false,
      "_links": {
        "self": {
          "href": "/domains/example.com/emailAliases/not-a-mailbox%40example.com/mailbox%40example.org"
        },
        "collection": {
          "href": "/domains/example.com/emailAliases"
        }
      }
    }
  ],
  "_links": {
    "self": {
      "href": "/domains/example.com/emailAliases"
    },
    "parent": {
      "href": "/domains/example.com"
    }
  },
  "_metadata": {
    "totalCount": 3,
    "limit": 25,
    "offset": 0
  }
}

GETList email aliases

Retrieve a list of email aliases for a domain.


The following properties describe the response:

Name Type Description
emailAliases array Array of email aliases
active boolean Boolean indicating whether the email alias is active
destination string The email address to which email messages will be delivered
source string The email address for which email messages will be forwarded
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_links object Links to related resource locations
self object Link to the email alias
href string Hyperlink to the email alias's location
collection object Link to the email alias collection
href string Hyperlink to the email alias collection location
_links object Links to related resource locations
self object Link to the email alias collection
href string Hyperlink to the email alias collection location
parent object Link to the parent resource
href string Hyperlink to the parent resource location
_metadata object Metadata about the collection
totalCount integer The total number of email aliases
limit integer The maximum number of results returned
offset integer Results are returned starting at the given offset
POSThttps://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases
REQUEST EXAMPLE
curl --request POST \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "active": true,
  "destination": "destination@example.com",
  "source": "source@example.com",
  "spamChecksEnabled": true,
  "virusChecksEnabled": true
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{  \"active\": true,  \"destination\": \"destination@example.com\",  \"source\": \"source@example.com\",  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": true}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"active\": true,  \"destination\": \"destination@example.com\",  \"source\": \"source@example.com\",  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": true}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("POST", "/hosting/v2/domains/example.com/emailAliases", payload, headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases")

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"] = 'application/json'
request.body = "{  \"active\": true,  \"destination\": \"destination@example.com\",  \"source\": \"source@example.com\",  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": true}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
201 Created
{
  "active": true,
  "destination": "destination@example.com",
  "source": "source@example.com",
  "spamChecksEnabled": true,
  "virusChecksEnabled": true,
  "_links": {
    "self": {
      "href": "/domains/example.com/emailAliases/source%40example.com/destination%40example.com"
    },
    "collection": {
      "href": "/domains/example.com/emailAliases"
    }
  }
}

POSTCreate email alias

Create a new email alias for a domain.

Please note that the source address should always be part of the domain it is created for.


The following properties should be part of the request:

Name Type Required Description
active boolean true Boolean indicating whether the email alias is active
destination string true The email address to which email messages will be delivered
source string true The email address for which email messages will be forwarded
spamChecksEnabled boolean true Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean true Boolean indicating whether virus checks are enabled

The following properties describe the response:

Name Type Description
active boolean Boolean indicating whether the email alias is active
destination string The email address to which email messages will be delivered
source string The email address for which email messages will be forwarded
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_links object Links to related resource locations
self object Link to the email alias
href string Hyperlink to the email alias's location
collection object Link to the email alias collection
href string Hyperlink to the email alias collection location
GEThttps://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.com
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.com \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.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", "/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.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/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.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
{
  "active": true,
  "destination": "destination@example.com",
  "source": "source@example.com",
  "spamChecksEnabled": true,
  "virusChecksEnabled": true,
  "_links": {
    "self": {
      "href": "/domains/example.com/emailAliases/source%40example.com/destination%40example.com"
    },
    "collection": {
      "href": "/domains/example.com/emailAliases"
    }
  }
}

GETRetrieve email alias

View a single email alias.


The following properties describe the response:

Name Type Description
active boolean Boolean indicating whether the email alias is active
destination string The email address to which email messages will be delivered
source string The email address for which email messages will be forwarded
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_links object Links to related resource locations
self object Link to the email alias
href string Hyperlink to the email alias's location
collection object Link to the email alias collection
href string Hyperlink to the email alias collection location
PUThttps://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.com
REQUEST EXAMPLE
curl --request PUT \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.com \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "active": true,
  "spamChecksEnabled": true,
  "virusChecksEnabled": true
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.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 => "{  \"active\": true,  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": true}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"active\": true,  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": true}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("PUT", "/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.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/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.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"] = 'application/json'
request.body = "{  \"active\": true,  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": true}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
200 OK
{
  "active": true,
  "destination": "destination@example.com",
  "source": "source@example.com",
  "spamChecksEnabled": true,
  "virusChecksEnabled": true,
  "_links": {
    "self": {
      "href": "/domains/example.com/emailAliases/source%40example.com/destination%40example.com"
    },
    "collection": {
      "href": "/domains/example.com/emailAliases"
    }
  }
}

PUTUpdate email alias

Update a single email alias.


The following properties should be part of the request:

Name Type Required Description
active boolean true Boolean indicating whether the email alias is active
spamChecksEnabled boolean true Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean true Boolean indicating whether virus checks are enabled

The following properties describe the response:

Name Type Description
active boolean Boolean indicating whether the email alias is active
destination string The email address to which email messages will be delivered
source string The email address for which email messages will be forwarded
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_links object Links to related resource locations
self object Link to the email alias
href string Hyperlink to the email alias's location
collection object Link to the email alias collection
href string Hyperlink to the email alias collection location
DELETEhttps://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.com
REQUEST EXAMPLE
curl --request DELETE \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.com \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.com",
  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", "/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.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/hosting/v2/domains/example.com/emailAliases/source%40example.com/destination%40example.com")

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
204 No Content

Succesfully deleted the email alias.

DELETEDelete email alias

Delete a single email alias.

GEThttps://api.leaseweb.com/hosting/v2/domains/example.com/forwards
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/forwards \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/forwards",
  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", "/hosting/v2/domains/example.com/forwards", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/forwards")

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
{
  "forwards":[
    {
      "active": true,
      "destination": "destination@example.com",
      "source": "mailbox@example.com",
      "spamChecksEnabled": false,
      "virusChecksEnabled": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.com"
        },
        "collection": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards"
        }
      }
    },
    {
      "active": true,
      "destination": "destination@example.org",
      "source": "mailbox@example.com",
      "spamChecksEnabled": true,
      "virusChecksEnabled": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40email.org"
        },
        "collection": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards"
        }
      }
    },
    {
      "active": true,
      "destination": "destination@example.com",
      "source": "originating@example.com",
      "spamChecksEnabled": false,
      "virusChecksEnabled": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/mailboxes/originating%40example.com/forwards/destination%40example.com"
        },
        "collection": {
          "href": "/domains/example.com/mailboxes/originating%40example.com/forwards"
        }
      }
    },
    {
      "active": true,
      "destination": "destination@example.org",
      "source": "originating@example.com",
      "spamChecksEnabled": true,
      "virusChecksEnabled": false,
      "_links": {
        "self": {
          "href": "/domains/example.com/mailboxes/originating%40example.com/forwards/destination%40example.org"
        },
        "collection": {
          "href": "/domains/example.com/mailboxes/originating%40example.com/forwards"
        }
      }
    }
  ],
  "_links": {
    "self": {
      "href": "/domains/example.com/forwards"
    },
    "parent": {
      "href": "/domains/example.com"
    }
  },
  "_metadata": {
    "totalCount": 4,
    "limit": 25,
    "offset": 0
  }
}

GETList forwards for domain

Retrieve a list of forwards for a domain.


The following query string parameters are available:

Name Example Description
limit 5 Limit the number of results returned
offset 10 Return results starting from the given offset

The following properties describe the response:

Name Type Description
forwards array Array of forwards for a domain
active boolean Boolean indicating whether the forward is active
destination string The email address to which email messages will be forwarded
source string The email address of the mailbox for which email messages will be forwarded
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_links object Links to related resource locations
self object Link to the forward
href string Hyperlink to the forward's location
collection object Link to the forward collection for the mailbox
href string Hyperlink to the forward collection location for the mailbox
_links object Links to related resource locations
self object Link to the forward collection for the domain
href string Hyperlink to the forward collection location for the domain
parent object Link to the parent resource
href string Hyperlink to the parent resource location
_metadata object Metadata about the collection
totalCount integer The total number of forwards for the domain
limit integer The maximum number of results returned
offset integer Results are returned starting at the given offset
GEThttps://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes",
  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", "/hosting/v2/domains/example.com/mailboxes", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes")

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
{
  "mailboxes": [
    {
      "active": true,
      "currentSize": 1234,
      "emailAddress": "mailbox@example.com",
      "maximumSize": 4321,
      "spamChecksEnabled": true,
      "suspended": true,
      "virusChecksEnabled": false,
      "_embedded": {
        "autoResponder": {
          "_links": {
            "self": {
              "href": "/domains/example.com/mailboxes/mailbox%40example.com/autoResponder"
            }
          }
        }
      },
      "_links": {
        "self": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com"
        },
        "collection": {
          "href": "/domains/example.com/mailboxes"
        },
        "autoResponder": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com/autoResponder"
        },
        "forwards": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards"
        }
      }
    },
    {
      "active": false,
      "currentSize": 1234,
      "emailAddress": "info@example.com",
      "maximumSize": 4321,
      "spamChecksEnabled": false,
      "suspended": false,
      "virusChecksEnabled": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/mailboxes/info%40example.com"
        },
        "collection": {
          "href": "/domains/example.com/mailboxes"
        },
        "autoResponder": {
          "href": "/domains/example.com/mailboxes/info%40example.com/autoResponder"
        },
        "forwards": {
          "href": "/domains/example.com/mailboxes/info%40example.com/forwards"
        }
      }
    },
    {
      "active": true,
      "currentSize": 1234,
      "emailAddress": "admin@example.com",
      "maximumSize": 4321,
      "spamChecksEnabled": false,
      "suspended": false,
      "virusChecksEnabled": false,
      "_links": {
        "self": {
          "href": "/domains/example.com/mailboxes/admin%40example.com"
        },
        "collection": {
          "href": "/domains/example.com/mailboxes"
        },
        "autoResponder": {
          "href": "/domains/example.com/mailboxes/admin%40example.com/autoResponder"
        },
        "forwards": {
          "href": "/domains/example.com/mailboxes/admin%40example.com/forwards"
        }
      }
    },
    {
      "active": true,
      "currentSize": 1234,
      "emailAddress": "user@example.com",
      "maximumSize": 4321,
      "spamChecksEnabled": true,
      "suspended": true,
      "virusChecksEnabled": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/mailboxes/user%40example.com"
        },
        "collection": {
          "href": "/domains/example.com/mailboxes"
        },
        "autoResponder": {
          "href": "/domains/example.com/mailboxes/user%40example.com/autoResponder"
        },
        "forwards": {
          "href": "/domains/example.com/mailboxes/user%40example.com/forwards"
        }
      }
    }
  ],
  "_links": {
    "self": {
      "href": "/domains/example.com/mailboxes"
    },
    "parent": {
      "href": "/domains/example.com"
    }
  },
  "_metadata": {
    "totalCount": 4,
    "limit": 25,
    "offset": 0
  }
}

GETList mailboxes

Retrieve a list of mailboxes for a domain.


The following properties describe the response:

Name Type Description
mailboxes array Array of mailboxes
active boolean Boolean indicating whether the mailbox is active
currentSize integer The current size of the mailbox measured in bytes
emailAddress string The email address of the mailbox
maximumSize integer The maximum size of the mailbox measured in bytes
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
suspended boolean Boolean indicating whether the mailbox is suspended
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_embedded object Optional object containing embedded resources for the mailbox
autoResponder object Object that is present when the mailbox has an auto responder configured
_links object Links to related resource locations
self object Link to the auto responder
href string Hyperlink to the auto responder's location
_links object Links to related resource locations
self object Link to the mailbox
href string Hyperlink to the mailbox's location
collection object Link to the mailbox collection
href string Hyperlink to the mailbox collection location
autoResponder object Optional link to the mailbox's auto responder
href string Hyperlink to the auto responder's location
forwards object Link to the forward collection of the mailbox
href string Hyperlink to the forward collection location
_links object Links to related resource locations
self object Link to the mailbox collection
href string Hyperlink to the mailbox collection location
parent object Link to the parent resource
href string Hyperlink to the parent resource location
_metadata object Metadata about the collection
totalCount integer The total number of mailboxes
limit integer The maximum number of results returned
offset integer Results are returned starting at the given offset
POSThttps://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes
REQUEST EXAMPLE
curl --request POST \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "emailAddress": "mailbox@example.com",
  "active": true,
  "password": "CHANGETHIS",
  "spamChecksEnabled": true,
  "virusChecksEnabled": false
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{  \"emailAddress\": \"mailbox@example.com\",  \"active\": true,  \"password\": \"CHANGETHIS\",  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": false}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"emailAddress\": \"mailbox@example.com\",  \"active\": true,  \"password\": \"CHANGETHIS\",  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": false}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("POST", "/hosting/v2/domains/example.com/mailboxes", payload, headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes")

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"] = 'application/json'
request.body = "{  \"emailAddress\": \"mailbox@example.com\",  \"active\": true,  \"password\": \"CHANGETHIS\",  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": false}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
201 Created
{
  "active": true,
  "currentSize": 123456789,
  "emailAddress": "mailbox@example.com",
  "maximumSize": 5368709120,
  "spamChecksEnabled": true,
  "suspended": false,
  "virusChecksEnabled": false,
  "_embedded": {
    "autoResponder": {
      "_links": {
        "self": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com/autoResponder"
        }
      }
    }
  },
  "_links": {
    "self": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com"
    },
    "collection": {
      "href": "/domains/example.com/mailboxes"
    },
    "autoResponder": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/autoResponder"
    },
    "forwards": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards"
    }
  }
}

POSTCreate mailbox

Create a new mailbox for a domain.

Please note that it is only possible to create mailboxes when you have a web hosting pack with Leaseweb. Per web hosting pack it is possible to have up to 250 mailboxes.


The following properties should be part of the request:

Name Type Required Description
emailAddress string true The email address of the mailbox
active boolean true Boolean indicating whether the mailbox is active
password string true The password of the mailbox
spamChecksEnabled boolean true Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean true Boolean indicating whether virus checks are enabled

The following properties describe the response:

Name Type Description
active boolean Boolean indicating whether the mailbox is active
currentSize integer The current size of the mailbox measured in bytes
emailAddress string The email address of the mailbox
maximumSize integer The maximum size of the mailbox measured in bytes
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
suspended boolean Boolean indicating whether the mailbox is suspended
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_embedded object Optional object containing embedded resources for the mailbox
autoResponder object Object that is present when the mailbox has an auto responder configured
_links object Links to related resource locations
self object Link to the auto responder
href string Hyperlink to the auto responder's location
_links object Links to related resource locations
self object Link to the mailbox
href string Hyperlink to the mailbox's location
collection object Link to the mailbox collection
href string Hyperlink to the mailbox collection location
autoResponder object Optional link to the mailbox's auto responder
href string Hyperlink to the auto responder's location
forwards object Link to the forward collection of the mailbox
href string Hyperlink to the forward collection location
GEThttps://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.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", "/hosting/v2/domains/example.com/mailboxes/mailbox%40example.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/hosting/v2/domains/example.com/mailboxes/mailbox%40example.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
{
  "active": true,
  "currentSize": 123456789,
  "emailAddress": "mailbox@example.com",
  "maximumSize": 5368709120,
  "spamChecksEnabled": true,
  "suspended": false,
  "virusChecksEnabled": false,
  "_embedded": {
    "autoResponder": {
      "_links": {
        "self": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com/autoResponder"
        }
      }
    }
  },
  "_links": {
    "self": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com"
    },
    "collection": {
      "href": "/domains/example.com/mailboxes"
    },
    "autoResponder": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/autoResponder"
    },
    "forwards": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards"
    }
  }
}

GETRetrieve mailbox

View a single mailbox.


The following properties describe the response:

Name Type Description
active boolean Boolean indicating whether the mailbox is active
currentSize integer The current size of the mailbox measured in bytes
emailAddress string The email address of the mailbox
maximumSize integer The maximum size of the mailbox measured in bytes
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
suspended boolean Boolean indicating whether the mailbox is suspended
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_embedded object Optional object containing embedded resources for the mailbox
autoResponder object Object that is present when the mailbox has an auto responder configured
_links object Links to related resource locations
self object Link to the auto responder
href string Hyperlink to the auto responder's location
_links object Links to related resource locations
self object Link to the mailbox
href string Hyperlink to the mailbox's location
collection object Link to the mailbox collection
href string Hyperlink to the mailbox collection location
autoResponder object Optional link to the mailbox's auto responder
href string Hyperlink to the auto responder's location
forwards object Link to the forward collection of the mailbox
href string Hyperlink to the forward collection location
PUThttps://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com
REQUEST EXAMPLE
curl --request PUT \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "active": true,
  "password": "CHANGETHIS",
  "spamChecksEnabled": true,
  "virusChecksEnabled": false
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.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 => "{  \"active\": true,  \"password\": \"CHANGETHIS\",  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": false}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"active\": true,  \"password\": \"CHANGETHIS\",  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": false}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("PUT", "/hosting/v2/domains/example.com/mailboxes/mailbox%40example.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/hosting/v2/domains/example.com/mailboxes/mailbox%40example.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"] = 'application/json'
request.body = "{  \"active\": true,  \"password\": \"CHANGETHIS\",  \"spamChecksEnabled\": true,  \"virusChecksEnabled\": false}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
200 OK
{
  "active": true,
  "currentSize": 123456789,
  "emailAddress": "mailbox@example.com",
  "maximumSize": 5368709120,
  "spamChecksEnabled": true,
  "suspended": false,
  "virusChecksEnabled": false,
  "_embedded": {
    "autoResponder": {
      "_links": {
        "self": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com/autoResponder"
        }
      }
    }
  },
  "_links": {
    "self": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com"
    },
    "collection": {
      "href": "/domains/example.com/mailboxes"
    },
    "autoResponder": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/autoResponder"
    },
    "forwards": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards"
    }
  }
}

PUTUpdate mailbox

Update a single mailbox.


The following properties should be part of the request:

Name Type Required Description
active boolean true Boolean indicating whether the mailbox is active
password string false The password of the mailbox
spamChecksEnabled boolean true Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean true Boolean indicating whether virus checks are enabled

The following properties describe the response:

Name Type Description
active boolean Boolean indicating whether the mailbox is active
currentSize integer The current size of the mailbox measured in bytes
emailAddress string The email address of the mailbox
maximumSize integer The maximum size of the mailbox measured in bytes
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
suspended boolean Boolean indicating whether the mailbox is suspended
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_embedded object Optional object containing embedded resources for the mailbox
autoResponder object Object that is present when the mailbox has an auto responder configured
_links object Links to related resource locations
self object Link to the auto responder
href string Hyperlink to the auto responder's location
_links object Links to related resource locations
self object Link to the mailbox
href string Hyperlink to the mailbox's location
collection object Link to the mailbox collection
href string Hyperlink to the mailbox collection location
autoResponder object Optional link to the mailbox's auto responder
href string Hyperlink to the auto responder's location
forwards object Link to the forward collection of the mailbox
href string Hyperlink to the forward collection location
DELETEhttps://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com
REQUEST EXAMPLE
curl --request DELETE \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com",
  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", "/hosting/v2/domains/example.com/mailboxes/mailbox%40example.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/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com")

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
204 No Content

Succesfully deleted the mailbox.

DELETEDelete mailbox

Delete a single mailbox.

GEThttps://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder",
  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", "/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder")

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
{
  "active": true,
  "body": "I will be out of office until 14-12-2020. Please contact the reception desk for urgent matters.",
  "subject": "Out of office",
  "_links": {
    "self": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/autoResponder"
    },
    "parent": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com"
    }
  }
}

GETRetrieve auto responder

View the auto responder.


The following properties describe the response:

Name Type Description
active boolean Boolean indicating whether the auto responder is active
body string The body of the auto responder email message
subject string The subject of the auto responder email message
_links object Links to related resource locations
self object Link to the auto responder
href string Hyperlink to the auto responder's location
parent object Link to the parent resource
href string Hyperlink to the parent resource location
PUThttps://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder
REQUEST EXAMPLE
curl --request PUT \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "active": true,
  "body": "I will be out of office until 14-12-2020. Please contact the reception desk for urgent matters.",
  "subject": "Out of office"
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{  \"active\": true,  \"body\": \"I will be out of office until 14-12-2020. Please contact the reception desk for urgent matters.\",  \"subject\": \"Out of office\"}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"active\": true,  \"body\": \"I will be out of office until 14-12-2020. Please contact the reception desk for urgent matters.\",  \"subject\": \"Out of office\"}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("PUT", "/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder", payload, headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder")

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"] = 'application/json'
request.body = "{  \"active\": true,  \"body\": \"I will be out of office until 14-12-2020. Please contact the reception desk for urgent matters.\",  \"subject\": \"Out of office\"}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
200 OK
{
  "active": true,
  "body": "I will be out of office until 14-12-2020. Please contact the reception desk for urgent matters.",
  "subject": "Out of office",
  "_links": {
    "self": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/autoResponder"
    },
    "parent": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com"
    }
  }
}

PUTChange auto responder

Create or update the auto responder.

On success the response will be either a HTTP 201 Created or a HTTP 200 OK respectively.


The following properties should be part of the request:

Name Type Required Description
active boolean true Boolean indicating whether the auto responder is active
body string true The body of the auto responder email message
subject string true The subject of the auto responder email message

The following properties describe the response:

Name Type Description
active boolean Boolean indicating whether the auto responder is active
body string The body of the auto responder email message
subject string The subject of the auto responder email message
_links object Links to related resource locations
self object Link to the auto responder
href string Hyperlink to the auto responder's location
parent object Link to the parent resource
href string Hyperlink to the parent resource location
DELETEhttps://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder
REQUEST EXAMPLE
curl --request DELETE \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder",
  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", "/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/autoResponder")

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
204 No Content

Succesfully deleted the auto responder.

DELETEDelete auto responder

Delete the auto responder.

GEThttps://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards",
  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", "/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards")

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
{
  "forwards":[
    {
      "active": true,
      "destination": "destination@example.org",
      "source": "mailbox@example.com",
      "spamChecksEnabled": true,
      "virusChecksEnabled": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org"
        },
        "collection": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards"
        }
      }
    },
    {
      "active": true,
      "destination": "destination@example.com",
      "source": "mailbox@example.com",
      "spamChecksEnabled": false,
      "virusChecksEnabled": true,
      "_links": {
        "self": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.com"
        },
        "collection": {
          "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards"
        }
      }
    }
  ],
  "_links": {
    "self": {
      "href": "/domains/example.com/mailbox%40example.com/forwards"
    },
    "parent": {
      "href": "/domains/example.com/mailbox%40example.com"
    }
  },
  "_metadata": {
    "totalCount": 2,
    "limit": 25,
    "offset": 0
  }
}

GETList forwards

Retrieve a list of forwards for a mailbox.


The following properties describe the response:

Name Type Description
forwards array Array of forwards for a mailbox
active boolean Boolean indicating whether the forward is active
destination string The email address to which email messages will be forwarded
source string The email address of the mailbox for which email messages will be forwarded
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_links object Links to related resource locations
self object Link to the forward
href string Hyperlink to the forward's location
collection object Link to the forward collection for the mailbox
href string Hyperlink to the forward collection location for the mailbox
_links object Links to related resource locations
self object Link to the forward collection for the mailbox
href string Hyperlink to the forward collection location for the mailbox
parent object Link to the parent resource
href string Hyperlink to the parent resource location
_metadata object Metadata about the collection
totalCount integer The total number of forwards for the mailbox
limit integer The maximum number of results returned
offset integer Results are returned starting at the given offset
POSThttps://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards
REQUEST EXAMPLE
curl --request POST \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "active": true,
  "destination": "destination@example.org",
  "source": "originating@example.com",
  "spamChecksEnabled": false,
  "virusChecksEnabled": true
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{  \"active\": true,  \"destination\": \"destination@example.org\",  \"source\": \"originating@example.com\",  \"spamChecksEnabled\": false,  \"virusChecksEnabled\": true}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"active\": true,  \"destination\": \"destination@example.org\",  \"source\": \"originating@example.com\",  \"spamChecksEnabled\": false,  \"virusChecksEnabled\": true}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("POST", "/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards", payload, headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards")

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"] = 'application/json'
request.body = "{  \"active\": true,  \"destination\": \"destination@example.org\",  \"source\": \"originating@example.com\",  \"spamChecksEnabled\": false,  \"virusChecksEnabled\": true}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
201 Created
{
  "active": true,
  "destination": "destination@example.org",
  "source": "mailbox@example.com",
  "spamChecksEnabled": false,
  "virusChecksEnabled": true,
  "_links": {
    "self": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org"
    },
    "collection": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards"
    }
  }
}

POSTCreate forward

Create a new forward for a mailbox.


The following properties should be part of the request:

Name Type Required Description
active boolean true Boolean indicating whether the forward is active
destination string true The email address to which email messages will be forwarded
source string true The email address of the mailbox for which email messages will be forwarded
spamChecksEnabled boolean true Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean true Boolean indicating whether virus checks are enabled

The following properties describe the response:

Name Type Description
active boolean Boolean indicating whether the forward is active
destination string The email address to which email messages will be forwarded
source string The email address of the mailbox for which email messages will be forwarded
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_links object Links to related resource locations
self object Link to the forward
href string Hyperlink to the forward's location
collection object Link to the forward collection for the mailbox
href string Hyperlink to the forward collection location for the mailbox
GEThttps://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org",
  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", "/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org")

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
{
  "active": true,
  "destination": "destination@example.org",
  "source": "mailbox@example.com",
  "spamChecksEnabled": false,
  "virusChecksEnabled": true,
  "_links": {
    "self": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org"
    },
    "collection": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards"
    }
  }
}

GETRetrieve forward

View a single forward.


The following properties describe the response:

Name Type Description
active boolean Boolean indicating whether the forward is active
destination string The email address to which email messages will be forwarded
source string The email address of the mailbox for which email messages will be forwarded
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_links object Links to related resource locations
self object Link to the forward
href string Hyperlink to the forward's location
collection object Link to the forward collection for the mailbox
href string Hyperlink to the forward collection location for the mailbox
PUThttps://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org
REQUEST EXAMPLE
curl --request PUT \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424' \
  --header 'content-type: application/json' \
  --data '{
  "active": true,
  "spamChecksEnabled": false,
  "virusChecksEnabled": true
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{  \"active\": true,  \"spamChecksEnabled\": false,  \"virusChecksEnabled\": true}",
  CURLOPT_HTTPHEADER => array(
    "X-Lsw-Auth: 213423-2134234-234234-23424",
    "content-type: application/json"
  ),
));

$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 = "{  \"active\": true,  \"spamChecksEnabled\": false,  \"virusChecksEnabled\": true}"

headers = {
    'X-Lsw-Auth': "213423-2134234-234234-23424",
    'content-type': "application/json"
    }

conn.request("PUT", "/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org", payload, headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org")

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"] = 'application/json'
request.body = "{  \"active\": true,  \"spamChecksEnabled\": false,  \"virusChecksEnabled\": true}"

response = http.request(request)
puts response.read_body
RESPONSE EXAMPLE
200 OK
{
  "active": true,
  "destination": "destination@example.org",
  "source": "mailbox@example.com",
  "spamChecksEnabled": false,
  "virusChecksEnabled": true,
  "_links": {
    "self": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org"
    },
    "collection": {
      "href": "/domains/example.com/mailboxes/mailbox%40example.com/forwards"
    }
  }
}

PUTUpdate forward

Update a single forward.


The following properties should be part of the request:

Name Type Required Description
active boolean true Boolean indicating whether the forward is active
spamChecksEnabled boolean true Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean true Boolean indicating whether virus checks are enabled

The following properties describe the response:

Name Type Description
active boolean Boolean indicating whether the forward is active
destination string The email address to which email messages will be forwarded
source string The email address of the mailbox for which email messages will be forwarded
spamChecksEnabled boolean Boolean indicating whether spam checks are enabled
virusChecksEnabled boolean Boolean indicating whether virus checks are enabled
_links object Links to related resource locations
self object Link to the forward
href string Hyperlink to the forward's location
collection object Link to the forward collection for the mailbox
href string Hyperlink to the forward collection location for the mailbox
DELETEhttps://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org
REQUEST EXAMPLE
curl --request DELETE \
  --url https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org \
  --header 'X-Lsw-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org",
  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", "/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org", headers=headers)

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

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

url = URI("https://api.leaseweb.com/hosting/v2/domains/example.com/mailboxes/mailbox%40example.com/forwards/destination%40example.org")

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
204 No Content

Succesfully deleted the forward.

DELETEDelete forward

Delete a single forward.

Error responses

When using the Domain API it might happen that your request does not result in a successful response. Below we list some example error responses that can occur.

400 Bad Request

Validation failed. Check the error message and error details for more information.

RESPONSE EXAMPLE 400 Bad Request

{
"errorMessage": "Validation failed.",
"userMessage": "Your data contains errors, please check the details.",
"errorDetails": {
"field1": [
"This value should not be blank."
],
"field2": [
"This field should be of type integer."
]
}
}

A MORE COMPLEX RESPONSE EXAMPLE 400 Bad Request

{
"errorMessage": "Validation failed.",
"userMessage": "Your data contains errors, please check the details.",
"errorDetails": {
"resourceRecordSets": {
"0": {
"ttl": ["Invalid value, supported values are: 60, 300, 1800, 3600, 14400, 28800, 43200 or 86400"],
"content" : {
"1": ["Invalid IPv4 address"]
}
},
"4": {
"name": ["This value should not be null."],
"type": ["Invalid type, supported types are: A, AAAA, CAA, CNAME, MX, SRV and TXT"]
},
"7": {
"name": ["This value contains invalid characters.", "The name should be part of the domain example.com."],
"content": {
"0": ["SRV type content should contain a port number"]
}
}
}
}
}

401 Unauthorized

Authentication is required.

RESPONSE EXAMPLE 401 Unauthorized

{
"errorCode": "401",
"errorMessage": "Authentication failed, IP not allowed",
"correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be"
}

403 Forbidden

You are not allowed access to the requested resource.

RESPONSE EXAMPLE 403 Forbidden

{
"errorMessage": "Access to the requested resource is forbidden.",
"userMessage": "Sorry, but you do not have access at the moment.",
"correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be"
}

404 Not Found

The requested resource does not exist.

404 Not Found

500 Internal server error

An unexpected server error occurred.

RESPONSE EXAMPLE 500 Internal server error

{
"errorMessage": "The server encountered an unexpected condition that prevented it from fulfilling the request.",
"userMessage": "Cannot handle your request at the moment.",
"correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be"
}

503 Service unavailable

The service is temporary unavailable.

RESPONSE EXAMPLE 503 Service unavailable

{
"errorMessage": "The server is currently unable to handle the request due to a temporary overloading or maintenance of the server.",
"userMessage": "Cannot handle your request at the moment. Please try again later.",
"correlationId": "289346a1-3eaf-4da4-b707-62ef12eb08be"
}