Invoices API v1

Invoices API

This API can be used to get your invoice data and automate using the data provided.

GEThttps://api.leaseweb.com/invoices/v1/invoices
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/invoices/v1/invoices \
  --header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/invoices/v1/invoices",
  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", "/invoices/v1/invoices", headers=headers)

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

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

url = URI("https://api.leaseweb.com/invoices/v1/invoices")

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
{
    "invoices":
    [
      {
        "id": "00000001",
        "date": "2019-05-06T00:00:00+00:00",
        "dueDate": "2019-05-30T00:00:00+00:00",
        "total": 1756.21,
        "openAmount": 1756.21,
        "currency": "EUR",
        "isPartialPaymentAllowed": true,
        "status": "OVERDUE"
      },
      {
        "id": "00000002",
        "date": "2019-05-06T00:00:00+00:00",
        "dueDate": "2019-05-30T00:00:00+00:00",
        "total": 34.00,
        "openAmount": 34.00,
        "currency": "EUR",
        "isPartialPaymentAllowed": true,
        "status": "OPEN"
      },
      {
        "id": "00000003",
        "date": "2019-04-06T00:00:00+00:00",
        "dueDate": "2019-04-30T00:00:00+00:00",
        "total": 14.37,
        "openAmount": 0.00,
        "currency": "EUR",
        "isPartialPaymentAllowed": false,
        "status": "PAID"
      }
    ],
    "_metadata": {
      "totalCount": 3,
      "offset": 0,
      "limit": 0
    }
}

GETGet all your invoices

This endpoint returns all your invoices.

You can use it to create an overview of all the invoices for your user and entity.

It does not return details of the invoices. To get more details, specify the invoice Id.


The following query string parameters are available:

Name Example Description
limit 10 about limits
offset 3 offset

The following properties describe the response:

Name Type Description
invoices array An array of invoices.
id string The unique id of the invoice
date string The date the invoice was issued
dueDate string The date the invoice is due for payment
total float The total amount of the invoice
openAmount float The open amount of the invoice
currency string The currency of the invoice. (Allowed values: EUR,GBP,USD,SGD)
isPartialPaymentAllowed boolean The invoice can be paid partially
status string The status of the invoice. (Allowed values: OPEN,PAID,OVERDUE,CANCELLED)
_metadata object Metadata about the collection.
totalCount integer Total amount of invoices in this collection.
limit integer The limit used to generate this response.
offset integer The offset used to generate this response.
GEThttps://api.leaseweb.com/invoices/v1/invoices/undefined
REQUEST EXAMPLE
curl --request GET \
  --url https://api.leaseweb.com/invoices/v1/invoices/undefined \
  --header 'X-LSW-Auth: 213423-2134234-234234-23424'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.leaseweb.com/invoices/v1/invoices/undefined",
  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", "/invoices/v1/invoices/undefined", headers=headers)

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

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

url = URI("https://api.leaseweb.com/invoices/v1/invoices/undefined")

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
{
  "id": "00000001",
  "date": "2019-05-06T00:00:00+00:00",
  "dueDate": "2019-05-30T00:00:00+00:00",
  "total": 1756.21,
  "openAmount": 1756.21,
  "currency": "EUR",
  "isPartialPaymentAllowed": true,
  "status": "OPEN",
  "credits": [
    {
      "id": "00001211",
      "date": "2019-05-06T00:00:00+00:00",
      "total": 15.00
    }
  ],
  "lineItems": [
    {
      "contractId": "12345678",
      "equipmentId": "1234",
      "product": "Rackspace",
      "reference": "This is a reference",
      "quantity": 1,
      "unitAmount": 151.50,
      "totalAmount": 151.50
    }
  ]
}

GETGet a single invoice

This endpoint returns information about a specific invoice you received.

The response will include the line-items the invoice amount adds up to.

At the moment there is no attribute for the VAT in this endpoint's response, this will be developed shortly.


The following properties describe the response:

Name Type Description
id string The unique id of the invoice
date string The date the invoice was issued
dueDate string The date the invoice is due for payment
total float The the total amount of the invoice
openAmount float The open amount of the invoice
currency string The currency of the invoice. (Allowed values: EUR,GBP,USD,SGD)
isPartialPaymentAllowed boolean The invoice can be paid partially
status string The status of the invoice. (Allowed values: OPEN,PAID,OVERDUE,CANCELLED)
credits array All the credits attached to the invoice
id string The unique id of the credit
date string The date of the credit connected to the invoice
total float The total amount of the credit connected to the invoice
lineItems array All the line items attached to the invoice
contractId string The id of the contract
equipmentId string The id of the equipment
product string A string to indicate what kind of product this is.
reference string The reference a customer gave to the service
quantity integer The quantity of a product
unitAmount float The amount it cost for a single product unit.
total float The total amount of the product