LeaseWeb API for Customer Account (v1)

The base URL for this API is: https://api.leaseweb.com/account/v1

BETA
This API is in BETA. Documentation might be incorrect or incomplete. Functionality might change with the final release.

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.

Account

Inspect your account details

Authorizations:

Responses

200
401

Authentication is required.

403
500
503
get/details
https://api.leaseweb.com/account/v1/details

Request samples

Copy
curl --request GET \
  --url https://api.leaseweb.com/account/v1/details \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "name": "Leaseweb",
  • "email": "support@leaseweb.com",
  • "vatNumber": "vat1234134",
  • "resellerTier": "resellerTier",
  • "phone":
    {
    },
  • "address":
    {
    }
}

Update an account

For a USA customer the state code is required.

Authorizations:
Request Body schema: application/json
address
required
object

Address

Responses

204

If the information is successfully updated, a 204 No Content is returned.

401

Authentication is required.

403
500
503
put/details
https://api.leaseweb.com/account/v1/details

Request samples

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

Response samples

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

Contacts

List contacts

Authorizations:

Responses

200
401

Authentication is required.

403
500
503
get/contacts
https://api.leaseweb.com/account/v1/contacts

Request samples

Copy
curl --request GET \
  --url https://api.leaseweb.com/account/v1/contacts \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

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

Create a contact

Authorizations:
Request Body schema: application/json
description
string

The description of the contact. The descriptions listed in the examples are the descriptions we currently support.

firstName
required
string

The first name of the contact

lastName
required
string

The last name of the contact

email
required
string

The email of the contact

phone
required
object

Phone of the contact

mobile
object

Mobile of the contact

roles
required
array

Indicates which roles the contact has. There are 4 predefined roles. One or multiple roles can be assigned to each contact. It is mandatory to assign at least one of the predefined roles for each contact. If you have only one contact, all 4 roles must be assigned to this contact.

Responses

200
401

Authentication is required.

403
500
503
post/contacts
https://api.leaseweb.com/account/v1/contacts

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "firstName": "John",
  • "lastName": "Doe",
  • "description": "Mr.",
  • "email": "john@doe.com",
  • "phone":
    {
    },
  • "mobile":
    {
    },
  • "roles":
    [
    ]
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "1",
  • "firstName": "John",
  • "lastName": "Doe",
  • "description": "Mr.",
  • "email": "john@doe.com",
  • "phone":
    {
    },
  • "mobile":
    {
    },
  • "roles":
    [
    ]
}

Inspect a contact

Authorizations:
path Parameters
id
required
string

Responses

200
401

Authentication is required.

403
404

Resource not found.

500
503
get/contacts/{id}
https://api.leaseweb.com/account/v1/contacts/{id}

Request samples

Copy
curl --request GET \
  --url https://api.leaseweb.com/account/v1/contacts/%7Bid%7D \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "1",
  • "firstName": "John",
  • "lastName": "Doe",
  • "description": "Mr.",
  • "email": "john@doe.com",
  • "phone":
    {
    },
  • "mobile":
    {
    },
  • "roles":
    [
    ]
}

Update a contact

Authorizations:
path Parameters
id
required
string
Request Body schema: application/json
description
string

The description of the contact. The descriptions listed in the examples are the descriptions we currently support.

phone
required
object

Phone of the contact

mobile
object

Mobile of the contact

roles
required
array

Indicates what roles the contact has.

Responses

204

If the contact information is successfully updated, a 204 No Content is returned.

401

Authentication is required.

403
404

Resource not found.

500
503
put/contacts/{id}
https://api.leaseweb.com/account/v1/contacts/{id}

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "description": "Mr.",
  • "phone":
    {
    },
  • "mobile":
    {
    },
  • "roles":
    [
    ]
}

Response samples

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

Remove a contact

Authorizations:
path Parameters
id
required
string

Responses

204

If the contact is successfully removed, a 204 No Content is returned.

401

Authentication is required.

403
404

Resource not found.

500
503
delete/contacts/{id}
https://api.leaseweb.com/account/v1/contacts/{id}

Request samples

Copy
curl --request DELETE \
  --url https://api.leaseweb.com/account/v1/contacts/%7Bid%7D \
  --header 'leaseweb api key: REPLACE_KEY_VALUE'

Response samples

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