Information
API Key management is only accessible to the “Master” and “Admin” users. Read more about users and roles.
The Leaseweb API uses authentication based on API keys. Each API key can be restricted to allow GET, POST, PUT, and DELETE access or a combination. IP whitelisting is also possible. You can create an API key by following the steps below. API Keys have an expiration time of one year. After this year you can use the renew button to generate a new key and reset the expiration time.
Creating a new API key
Perform the following steps to create a new API key:
- Log in to the Customer Portal
- Click API Key in the left menu under the Administration section
- Click the Add API Key button
- A new key will be generated
- Once the API key is created, a model will be opened to display the key to copy, since we are going to display only the key once (for security reasons) when an API Key is created/renewed. There will be other properties like reference, request methods, and whitelisted IPs to update in the model.
Information
By default, the new API key is allowed to do GET, POST, PUT, and DELETE calls.
- Once the API Key is created, it displays the API key details in the table with the following details as shown in the image.
Changing API key options
For each API key, you have the option to add a reference, restrict the allowed access (GET, POST, PUT, and DELETE or a combination), or restrict access based on IP.
Simply click on the edit (pencil) icon to change the options. After changing the options, click on Save.
Reference
You can add a reference to each API key for your reference.
Access control
You can limit the access a key has by granting the request types to the API key. By default, all request types are allowed. If, for example, you want to have a read-only key, simply only select the GET request type and deselect all others. When using this API key, only data can be read and no other actions are possible.
Whitelisted IP
It is advised to limit the IPs which can use your API key. This prevents unknown systems from using your API key in case of a compromise. To enable IP whitelisting, type in an IP and click “Add IP”. If you want to remove an IP, simply click the trashcan icon next to the IP.
You can whitelist both IPv4 and IPv6 addresses. It is possible to use CIDR notation (fe: 10.0.0.0/24) as well.
Renewing an API key
To renew an API key, click on the refresh icon in the API key list and confirm renewal. A new key will be generated and all restrictions will be preserved and the expiration time will be reset. Once the API key is renewed, a model will be opened to display the key to copy, since we are going to display only the key once (for security reasons) when an API Key is created/renewed.
Removing an API key
To remove an API key, click on the Trashcan icon below your API key and confirm the removal. As soon as your API key is removed, you can no longer use the key to interact with the Leaseweb API.