LeaseWeb API for IP address management (v2)

The base URL for this API is: https://api.leaseweb.com/ipMgmt/v2/

Errors

The API uses standard HTTP status codes to indicate the success or failure of the API call. The response will be JSON. Most APIs use the following format:

{
"errorCode" : "APP00800",
"errorMessage" : "The connection with the DB cannot be established.",
"correlationId" : "550e8400-e29b-41d4-a716-446655440000",
"userMessage" : "Cannot handle your request at the moment. Please try again later.",
"reference" : "http://developer.leaseweb.com/errors/APP00800"
}

Authentication

Authentication for the APIs is required. To authenticate your call, you will need to sent your API key as X-LSW-Auth header.

You can generate API keys in the Customer Portal.

ips

List IPs

Authorizations:
query Parameters
limit
integer
Default: 10

Limit the number of results returned

offset
integer
Default: 0

Return results starting from the given offset

subnetId
string

Filter by subnet

version
integer

Filter by protocol version (4 or 6)

type
string

Filter by IP type

nullRouted
boolean

Filter by whether or not the IP has an active null route (true or false)

primary
boolean

Filter by whether or not the IP is primary (true or false)

fromIp
string

Return only IPs greater or equal to the specified address

toIp
string

Return only IPs lower or equal to the specified address

ips
string

Return only IPs specified as a comma-separated list

equipmentIds
string

Return only IPs assigned to equipment items specified as a comma-separated list of IDs

assignedContractIds
string

Return only IPs assigned to contracts specified as a comma-separated list of IDs

sort
string

Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. sort=ip,-nullrouted. Sortable field names are ip, nullRouted, reverseLookup.

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/ipMgmt/v2/ips?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE&subnetId=SOME_STRING_VALUE&version=SOME_INTEGER_VALUE&type=SOME_STRING_VALUE&nullRouted=SOME_BOOLEAN_VALUE&primary=SOME_BOOLEAN_VALUE&fromIp=SOME_STRING_VALUE&toIp=SOME_STRING_VALUE&ips=SOME_STRING_VALUE&equipmentIds=SOME_STRING_VALUE&assignedContractIds=SOME_STRING_VALUE&sort=SOME_STRING_VALUE' \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

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

Inspect an IP

Authorizations:
path Parameters
ip
required
string
Example: 192.0.2.1

IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/ipMgmt/v2/ips/192.0.2.1 \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "ip": "192.0.2.1",
  • "version": 4,
  • "type": "NORMAL_IP",
  • "prefixLength": 32,
  • "primary": true,
  • "reverseLookup": "mydomain1.example.com",
  • "nullRouted": false,
  • "unnullingAllowed": false,
  • "equipmentId": "1234",
  • "assignedContract": {
    },
  • "subnet": {
    }
}

Update an IP

Authorizations:
path Parameters
ip
required
string
Example: 192.0.2.1

IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112

Request Body schema: application/json
Schema not provided

Responses

Request samples

Content type
application/json
{
  • "reverseLookup": "mydomain1.example.com"
}

Response samples

Content type
application/json
{
  • "ip": "192.0.2.1",
  • "version": 4,
  • "type": "NORMAL_IP",
  • "prefixLength": 32,
  • "primary": true,
  • "reverseLookup": "mydomain1.example.com",
  • "nullRouted": false,
  • "unnullingAllowed": false,
  • "equipmentId": "1234",
  • "assignedContract": {
    },
  • "subnet": {
    }
}

Null route an IP

Authorizations:
path Parameters
ip
required
string
Example: 192.0.2.1

IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112

Request Body schema: application/json
automatedUnnullingAt
string <date-time>

The date and time when the null route is to be deactivated. The date and time should be specified using the format yyyy-mm-ddThh:mm:ss±hh:mm (with time zone designator) or yyyy-mm-ddThh:mm:ssZ (UTC). If this field is not present then the null route will not be automatically removed.

comment
string

A comment to be stored with the null route (e.g. null route reason)

ticketId
string

A reference to be stored with the null route

Responses

Request samples

Content type
application/json
{
  • "automatedUnnullingAt": "2015-06-25T11:13:00Z",
  • "ticketId": "188612",
  • "comment": "This IP is evil"
}

Response samples

Content type
application/json
{
  • "id": "4534536",
  • "ip": "192.0.2.1",
  • "nulledAt": "2015-06-28T12:00:00Z",
  • "nulledBy": "john.doe@example.com",
  • "nullLevel": 1,
  • "automatedUnnullingAt": "2015-06-25T11:13:00Z",
  • "unnulledAt": null,
  • "unnulledBy": null,
  • "ticketId": "188612",
  • "comment": "This IP is evil",
  • "equipmentId": "456",
  • "assignedContract": {
    }
}

Remove a null route

Authorizations:
path Parameters
ip
required
string
Example: 192.0.2.1

IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/ipMgmt/v2/ips/192.0.2.1/nullRoute \
  --header 'x-lsw-auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "errorCode": "ACCESS_DENIED",
  • "errorMessage": "The access token is expired or invalid."
}

Inspect null route history

Authorizations:
query Parameters
limit
integer
Default: 50