Floating IPs (v2)

The base URL for this API is: https://api.leaseweb.com/floatingIps/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.

Floating IP ranges

Create and manage your floating IP ranges and definitions

List ranges

A floating IP range is bound to a particular site, or datacenter (also known as pop).

If you have services in multiple data centers and want to use the floating IP feature in each of those locations you will need to order a range per site.

Authorizations:
query Parameters
limit
integer
Default: 10

Limit the number of results returned

offset
integer
Default: 0

Return results starting from the given offset

Responses

200
401

Authentication is required.

403
500
503
get/ranges
https://api.leaseweb.com/floatingIps/v2/ranges

Request samples

Copy
curl --request GET \
  --url 'https://api.leaseweb.com/floatingIps/v2/ranges?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "ranges":
    [
    ],
  • "_metadata":
    {
    }
}

Inspect a range

A floating IP range is identified by is network IP and the prefix length, separated by a underscore; for example 10.0.0.0_29.

Be aware that every IP address of a floating IP range is usable and routable. A floating IP range does not have a network IP, broadcast IP or gateway IP.

So for every IP in the range you can create a Floating IP Definition.

Authorizations:
path Parameters
rangeId
required
string
Example: 10.0.0.0_29

ID of a Floating IP Range, consisting of network IP and prefix length (separated by an underscore)

Responses

200
401

Authentication is required.

403
404
500
503
get/ranges/{rangeId}
https://api.leaseweb.com/floatingIps/v2/ranges/{rangeId}

Request samples

Copy
curl --request GET \
  --url https://api.leaseweb.com/floatingIps/v2/ranges/10.0.0.0_29 \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "88.17.0.0_17",
  • "range": "88.17.0.0/17",
  • "customerId": "10001234",
  • "salesOrgId": "2000",
  • "pop": "AMS-01"
}

List range definitions

A floating IP definition describes a mapping between one or more floating IPs (a.k.a floating IP) to an anchor IP. Traffic destined for all the floating IPs will be rerouted to the anchor IP. The anchor IP is an ip address that belongs to a service you have with Leaseweb. At this moment only dedicated servers, private racks and colocations are supported.

Authorizations:
path Parameters
rangeId
required
string
Example: 10.0.0.0_29

ID of a Floating IP Range, consisting of network IP and prefix length (separated by an underscore)

query Parameters
limit
integer
Default: 10

Limit the number of results returned

offset
integer
Default: 0

Return results starting from the given offset

Responses

200
401

Authentication is required.

403
500
503
get/ranges/{rangeId}/floatingIpDefinitions
https://api.leaseweb.com/floatingIps/v2/ranges/{rangeId}/floatingIpDefinitions

Request samples

Copy
curl --request GET \
  --url 'https://api.leaseweb.com/floatingIps/v2/ranges/10.0.0.0_29/floatingIpDefinitions?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE' \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "floatingIpDefinitions":
    [
    ],
  • "_metadata":
    {
    }
}

Create a range definition

When a floating IP definition is created, the floating IP address is then made to route all traffic to the anchor IP address, Hence all services on the server become reachable via the floating IP. This works in the background by maintaining BGP sessions in each site which announce the floating IP routes through the border routers.

Floating IP addresses which do not have an anchor IP address have no route, and are thus effectively nullrouted.

How to configure floating IPs on a server

On the server, floating IPs should be setup like any other additional IP address. However, the same floating IP will have to be setup on all servers that you want to be able to route it to.

Note: Currently, floating IPs does not work on VPS or Cloud servers.

Authorizations:
path Parameters
rangeId
required
string
Example: 10.0.0.0_29

ID of a Floating IP Range, consisting of network IP and prefix length (separated by an underscore)

Request Body schema: application/json
floatingIp
string

The Floating IP address

anchorIp
string

The Anchor IP address

Responses

200
400

The errorDetails value is an object describing why validation failed.

401

Authentication is required.

403
500
503
post/ranges/{rangeId}/floatingIpDefinitions
https://api.leaseweb.com/floatingIps/v2/ranges/{rangeId}/floatingIpDefinitions

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "floatingIp": "88.17.0.5/32",
  • "anchorIp": "95.10.126.1"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "88.17.34.108_32",
  • "rangeId": "88.17.0.0_17",
  • "pop": "AMS-01",
  • "customerId": "10001234",
  • "salesOrgId": "2000",
  • "floatingIp": "88.17.34.108/32",
  • "anchorIp": "95.10.126.1",
  • "status": "ACTIVE",
  • "createdAt": "2019-03-13T09:10:02+0000",
  • "updatedAt": "2019-03-13T09:10:02+0000"
}

Inspect a range definition

Authorizations:
path Parameters
rangeId
required
string
Example: 10.0.0.0_29

ID of a Floating IP Range, consisting of network IP and prefix length (separated by an underscore)

floatingIpDefinitionId
required
string

ID of a Floating IP Definition, consisting of network IP and prefix length (separated by an underscore)

Responses

200
401

Authentication is required.

403
404
500
503
get/ranges/{rangeId}/floatingIpDefinitions/{floatingIpDefinitionId}
https://api.leaseweb.com/floatingIps/v2/ranges/{rangeId}/floatingIpDefinitions/{floatingIpDefinitionId}

Request samples

Copy
curl --request GET \
  --url https://api.leaseweb.com/floatingIps/v2/ranges/10.0.0.0_29/floatingIpDefinitions/%7BfloatingIpDefinitionId%7D \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "88.17.34.108_32",
  • "rangeId": "88.17.0.0_17",
  • "pop": "AMS-01",
  • "customerId": "10001234",
  • "salesOrgId": "2000",
  • "floatingIp": "88.17.34.108/32",
  • "anchorIp": "95.10.126.1",
  • "status": "ACTIVE",
  • "createdAt": "2019-03-13T09:10:02+0000",
  • "updatedAt": "2019-03-13T09:10:02+0000"
}

Update a range definition

Imagine you have 2 dedicated servers in AMS-01, in different racks. And you have a floating IP definition for floating IP 10.0.0.0_32. You have configured the ip address 10.0.0.0/32 on both dedicated servers.

If the anchor IP in the floating IP definition is poining to your first server, all traffic goes to that server. With this PUT request you can change the Anchor IP address to point to, for example, your second server. Within a matter of seconds all the traffic destined for the Floating IP will now end up at the new Anchor IP. In the above example, your second server.

Authorizations:
path Parameters
rangeId
required
string
Example: 10.0.0.0_29

ID of a Floating IP Range, consisting of network IP and prefix length (separated by an underscore)

floatingIpDefinitionId
required
string

ID of a Floating IP Definition, consisting of network IP and prefix length (separated by an underscore)

Request Body schema: application/json
anchorIp
string

The Anchor IP address

Responses

200
400

The errorDetails value is an object describing why validation failed.

401

Authentication is required.

403
404
500
503
put/ranges/{rangeId}/floatingIpDefinitions/{floatingIpDefinitionId}
https://api.leaseweb.com/floatingIps/v2/ranges/{rangeId}/floatingIpDefinitions/{floatingIpDefinitionId}

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "anchorIp": "95.10.126.1"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "88.17.34.108_32",
  • "rangeId": "88.17.0.0_17",
  • "pop": "AMS-01",
  • "customerId": "10001234",
  • "salesOrgId": "2000",
  • "floatingIp": "88.17.34.108/32",
  • "anchorIp": "95.10.126.1",
  • "status": "ACTIVE",
  • "createdAt": "2019-03-13T09:10:02+0000",
  • "updatedAt": "2019-03-13T09:10:02+0000"
}

Remove a range definition

Authorizations:
path Parameters
rangeId
required
string
Example: 10.0.0.0_29

ID of a Floating IP Range, consisting of network IP and prefix length (separated by an underscore)

floatingIpDefinitionId
required
string

ID of a Floating IP Definition, consisting of network IP and prefix length (separated by an underscore)

Responses

202
401

Authentication is required.

403
404
500
503
delete/ranges/{rangeId}/floatingIpDefinitions/{floatingIpDefinitionId}
https://api.leaseweb.com/floatingIps/v2/ranges/{rangeId}/floatingIpDefinitions/{floatingIpDefinitionId}

Request samples

Copy
curl --request DELETE \
  --url https://api.leaseweb.com/floatingIps/v2/ranges/10.0.0.0_29/floatingIpDefinitions/%7BfloatingIpDefinitionId%7D \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "88.17.34.108_32",
  • "rangeId": "88.17.0.0_17",
  • "pop": "AMS-01",
  • "customerId": "10001234",
  • "salesOrgId": "2000",
  • "floatingIp": "88.17.34.108/32",
  • "anchorIp": "95.10.126.1",
  • "status": "ACTIVE",
  • "createdAt": "2019-03-13T09:10:02+0000",
  • "updatedAt": "2019-03-13T09:10:02+0000"
}