Skip to content

Get Case Invoices

This API endpoint enables you to fetch case invoices.

Input


Endpoint

Get /cases/{caseId}/invoices


HTTP request headers

Content-Type  string

Setting to application/json is required.

Authorization  string

This is the token you fetched e.g. Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS…


Path parameters

caseID  string - Required

The unique case ID you wish to retrieve.

show_cancelled_items  boolean

By default cancelled items are not shown, however if you wish to see them you can set this to true

Output


Http status codes
Status CodeDescription
200OK
400Bad Request
404Resource not found
500Internal Server Error

Request example

bash
curl  -X GET \
  'https://client.willsuite.co.uk/engine/api/cases/d57bc3b7-4f44-4846-9741-985db9af9b61/invoices' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...'
php
<?php

$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://client.willsuite.co.uk/engine/api/cases/d57bc3b7-4f44-4846-9741-985db9af9b61/invoices');
$request->setRequestMethod('GET');
$request->setHeaders([
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

json
[
  {
    "id": "6372fa9e-8a00-413b-bd61-34be39c994b3",
    "ref": null,
    "notes": null,
    "terms": "If this invoice is not paid within 30 days, 1% interest shall be added for each week it is overdue.",
    "date_created": "2024-05-20 00:00:00",
    "date_due": "2024-06-19 00:00:00",
    "date_sent": null,
    "date_paid": null,
    "payment_terms": "30 Days Payment Period",
    "subtotal": 300,
    "total": 360,
    "invoice_number": "JHON0001-1",
    "recipients_name": "Mrs D. Jhonson",
    "vat_amount": 60,
    "customer_case_id": "40169aac-07d8-4383-960c-c3ac3e506228",
    "status": "Not Paid",
    "mail_sent": false,
    "payable_online": true,
    "formatted_recurring_interval": null,
    "items": [
      {
        "id": "575b0d9a-c794-4ed7-95ac-a0cbbc6f5e27",
        "description": "LPA",
        "amount": 360,
        "quantity": 1,
        "rate": 300,
        "subtotal": 300,
        "vat_amount": 60,
        "status": null,
        "paid_at": null,
        "case_invoice_id": "6372fa9e-8a00-413b-bd61-34be39c994b3",
        "customer_case_id": "40169aac-07d8-4383-960c-c3ac3e506228",
        "has_vat": true
      }
    ]
  }
]
json
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid"
      },
      "ref": {
        "type": ["string", "null"]
      },
      "notes": {
        "type": ["string", "null"]
      },
      "terms": {
        "type": "string"
      },
      "date_created": {
        "type": "string",
        "format": "date-time"
      },
      "date_due": {
        "type": "string",
        "format": "date-time"
      },
      "date_sent": {
        "type": ["string", "null"],
        "format": "date-time"
      },
      "date_paid": {
        "type": ["string", "null"],
        "format": "date-time"
      },
      "payment_terms": {
        "type": "string"
      },
      "subtotal": {
        "type": "number"
      },
      "total": {
        "type": "number"
      },
      "invoice_number": {
        "type": "string"
      },
      "recipients_name": {
        "type": "string"
      },
      "vat_amount": {
        "type": "number"
      },
      "customer_case_id": {
        "type": "string",
        "format": "uuid"
      },
      "status": {
        "type": "string"
      },
      "mail_sent": {
        "type": "boolean"
      },
      "payable_online": {
        "type": "boolean"
      },
      "formatted_recurring_interval": {
        "type": ["string", "null"]
      },
      "items": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid"
            },
            "description": {
              "type": "string"
            },
            "amount": {
              "type": "number"
            },
            "quantity": {
              "type": "number"
            },
            "rate": {
              "type": "number"
            },
            "subtotal": {
              "type": "number"
            },
            "vat_amount": {
              "type": "number"
            },
            "status": {
              "type": ["string", "null"]
            },
            "paid_at": {
              "type": ["string", "null"],
              "format": "date-time"
            },
            "case_invoice_id": {
              "type": "string",
              "format": "uuid"
            },
            "customer_case_id": {
              "type": "string",
              "format": "uuid"
            },
            "has_vat": {
              "type": "boolean"
            }
          },
          "required": [
            "id",
            "description",
            "amount",
            "quantity",
            "rate",
            "subtotal",
            "vat_amount",
            "case_invoice_id",
            "customer_case_id",
            "has_vat"
          ]
        }
      }
    },
    "required": [
      "id",
      "terms",
      "date_created",
      "date_due",
      "payment_terms",
      "subtotal",
      "total",
      "invoice_number",
      "recipients_name",
      "vat_amount",
      "customer_case_id",
      "status",
      "mail_sent",
      "payable_online",
      "items"
    ]
  }
}

Create Case Invoice

This API endpoint enables you to create a new case invoice.

Input


Endpoint

Post /cases/{caseId}/invoices


HTTP request headers

Content-Type  string

Setting to application/json is required.

Authorization  string

This is the token you fetched e.g. Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS…


Path parameters

caseID  string - Required

The unique case ID for which you intend to generate a new appointment.


Body parameters

invoice_number  string - Required

Maximum 50 characters

This is the invoice number (unique reference for this case)

sender_id  uuid - Required

The unique ID of the senders id

date_created  string - Required

Accepted format YYYY-MM-DD HH:mm:ss - e.g. 2024-07-20 10:00:00

Date the invoice was created

date_due  string - Required

Accepted format YYYY-MM-DD HH:mm:ss - e.g. 2024-07-20 10:00:00

vat  float - Required

The percentage of VAT (value added tax) applicable for the invoice

total  float - Required

Total value of the invoice including VAT

sub_total  float - Required

Total value of the invoice excluding VAT

vat_amount  float

Calculated VAT (value added tax) for the invoice

items  array

Items of the invoice, can be multiple.

Details

Properties of items


description  string - Required

Maximum 200 characters

quantity  integer - Required

rate  float - Required

amount  float - Required

This is the total amount of this line item including any applicable TAX.


Example of items

json
[
  {
    "description": "1h Meetings",
    "quantity": "5",
    "rate": "20",
    "amount": "120"
  },
  {
    "description": "Document Drafting",
    "quantity": "1",
    "rate": "20",
    "amount": "24"
  }
]

Output


Http status codes
Status CodeDescription
200OK
400Bad Request
404Resource not found
500Internal Server Error

Request example

bash
curl  -X POST \
  'https://client.willsuite.co.uk/engine/api/cases/d57bc3b7-4f44-4846-9741-985db9af9b61/invoices' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...' \
  --data-raw '{
  "invoice_number" : "TEST001",
  "sender_id" : "9b5c02d1-a587-4b0b-b83c-a8889f038f85",
  "date_created" : "2024-05-17 15:22",
  "date_due": "2024-06-16 15:22",
  "payment_terms": "Pay within 30 days",
  "vat": 20,
  "total": 120,
  "sub_total": 100,
  "vat_amount": 20,
  "items":[
   {
    "description": "1h Meetings",
    "quantity": "5",
    "rate": "20",
    "amount": "120"
   }
  ]
}'
php
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
  "invoice_number" : "TEST001",
  "sender_id" : "9b5c02d1-a587-4b0b-b83c-a8889f038f85",
  "date_created" : "2024-05-17 15:22",
  "date_due": "2024-06-16 15:22",
  "payment_terms": "Pay within 30 days",
  "vat": 20,
  "total": 120,
  "sub_total": 100,
  "vat_amount": 20,
  "items":[
   {
    "description": "1h Meetings",
    "quantity": "5",
    "rate": "20",
    "amount": "120"
   }
  ]
}');


$request->setRequestUrl('https://client.willsuite.co.uk/engine/api/cases/d57bc3b7-4f44-4846-9741-985db9af9b61/invoices');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders([
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

json
{
  "id": "e48cf313-db76-408e-98c7-55be2bbd1b3b",
  "ref": null,
  "notes": null,
  "terms": null,
  "date_created": "2024-05-16T23:00:00.000000Z",
  "date_due": "2024-06-15T23:00:00.000000Z",
  "date_sent": null,
  "date_paid": null,
  "payment_terms": "Pay within 30 days",
  "subtotal": 0,
  "total": 120,
  "invoice_number": "TEST001",
  "recipients_name": null,
  "vat_amount": 20,
  "customer_case_id": "40169aac-07d8-4383-960c-c3ac3e506228"
}
json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "ref": {
      "type": ["string", "null"]
    },
    "notes": {
      "type": ["string", "null"]
    },
    "terms": {
      "type": ["string", "null"]
    },
    "date_created": {
      "type": "string",
      "format": "date-time"
    },
    "date_due": {
      "type": "string",
      "format": "date-time"
    },
    "date_sent": {
      "type": ["string", "null"],
      "format": "date-time"
    },
    "date_paid": {
      "type": ["string", "null"],
      "format": "date-time"
    },
    "payment_terms": {
      "type": "string"
    },
    "subtotal": {
      "type": "number"
    },
    "total": {
      "type": "number"
    },
    "invoice_number": {
      "type": "string"
    },
    "recipients_name": {
      "type": ["string", "null"]
    },
    "vat_amount": {
      "type": "number"
    },
    "customer_case_id": {
      "type": "string",
      "format": "uuid"
    }
  },
  "required": [
    "id",
    "date_created",
    "date_due",
    "payment_terms",
    "subtotal",
    "total",
    "invoice_number",
    "vat_amount",
    "customer_case_id"
  ]
}

Update Case Invoice

This API endpoint enables you to update an existing case invoice

Input


Endpoint

Post /cases/{caseId}/invoices/{invoiceId}


HTTP request headers

Content-Type  string

Setting to application/json is required.

Authorization  string

This is the token you fetched e.g. Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS…


Path parameters

caseID  string - Required

The unique case ID for which you intend to generate a new appointment.

invoiceId  string - Required

The unique invoice ID for which you intend to update.


Body parameters

keep_existing_items  boolean

If true, existing items will remain and new items will be added. If false then existing invoice items will be removed and replaced with any new items provided.

invoice_number  string - Required

Maximum 50 characters

This is the invoice number (unique reference for this case)

sender_id  uuid - Required

The unique ID of the senders id

date_created  string - Required

Accepted format YYYY-MM-DD HH:mm:ss - e.g. 2024-07-20 10:00:00

Date the invoice was created

date_due  string - Required

Accepted format YYYY-MM-DD HH:mm:ss - e.g. 2024-07-20 10:00:00

vat  float - Required

The percentage of VAT (value added tax) applicable for the invoice

total  float - Required

Total value of the invoice including VAT

sub_total  float - Required

Total value of the invoice excluding VAT

vat_amount  float

Calculated VAT (value added tax) for the invoice

items  array

Items of the invoice, can be multiple.

Details

Properties of items


description  string - Required

Maximum 200 characters

quantity  integer - Required

rate  float - Required

amount  float - Required

This is the total amount of this line item including any applicable TAX.


Example of items

json
[
  {
    "description": "1h Meetings",
    "quantity": "5",
    "rate": "20",
    "amount": "120"
  },
  {
    "description": "Document Drafting",
    "quantity": "1",
    "rate": "20",
    "amount": "24"
  }
]

Output


Http status codes
Status CodeDescription
200OK
400Bad Request
404Resource not found
500Internal Server Error

Request example

bash
curl  -X PATCH \
  'https://client.willsuite.co.uk/engine/api/cases/d57bc3b7-4f44-4846-9741-985db9af9b61/invoices/e48cf313-db76-408e-98c7-55be2bbd1b3b' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...' \
  --data-raw '{
  "keep_existing_items" : false,
  "invoice_number" : "TEST001",
  "sender_id" : "9b5c02d1-a587-4b0b-b83c-a8889f038f85",
  "date_created" : "2024-05-17 15:22",
  "date_due": "2024-06-16 15:22",
  "payment_terms": "Pay within 30 days",
  "vat": 20,
  "total": 120,
  "sub_total": 100,
  "vat_amount": 20,
  "items":[
   {
    "description": "1h Meetings",
    "quantity": "5",
    "rate": "20",
    "amount": "120"
   }
  ]
}'
php
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
  "invoice_number" : "TEST001",
  "sender_id" : "9b5c02d1-a587-4b0b-b83c-a8889f038f85",
  "date_created" : "2024-05-17 15:22",
  "date_due": "2024-06-16 15:22",
  "payment_terms": "Pay within 30 days",
  "vat": 20,
  "total": 120,
  "sub_total": 100,
  "vat_amount": 20,
  "items":[
   {
    "description": "1h Meetings",
    "quantity": "5",
    "rate": "20",
    "amount": "120"
   }
  ]
}');


$request->setRequestUrl('https://client.willsuite.co.uk/engine/api/cases/d57bc3b7-4f44-4846-9741-985db9af9b61/invoices/e48cf313-db76-408e-98c7-55be2bbd1b3b');
$request->setRequestMethod('PATCH');
$request->setBody($body);

$request->setHeaders([
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

json
{
  "id": "e48cf313-db76-408e-98c7-55be2bbd1b3b",
  "ref": null,
  "notes": null,
  "terms": null,
  "date_created": "2024-05-16T23:00:00.000000Z",
  "date_due": "2024-06-15T23:00:00.000000Z",
  "date_sent": null,
  "date_paid": null,
  "payment_terms": "Pay within 30 days",
  "subtotal": 0,
  "total": 120,
  "invoice_number": "TEST001",
  "recipients_name": null,
  "vat_amount": 20,
  "customer_case_id": "40169aac-07d8-4383-960c-c3ac3e506228"
}
json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "ref": {
      "type": ["string", "null"]
    },
    "notes": {
      "type": ["string", "null"]
    },
    "terms": {
      "type": ["string", "null"]
    },
    "date_created": {
      "type": "string",
      "format": "date-time"
    },
    "date_due": {
      "type": "string",
      "format": "date-time"
    },
    "date_sent": {
      "type": ["string", "null"],
      "format": "date-time"
    },
    "date_paid": {
      "type": ["string", "null"],
      "format": "date-time"
    },
    "payment_terms": {
      "type": "string"
    },
    "subtotal": {
      "type": "number"
    },
    "total": {
      "type": "number"
    },
    "invoice_number": {
      "type": "string"
    },
    "recipients_name": {
      "type": ["string", "null"]
    },
    "vat_amount": {
      "type": "number"
    },
    "customer_case_id": {
      "type": "string",
      "format": "uuid"
    }
  },
  "required": [
    "id",
    "date_created",
    "date_due",
    "payment_terms",
    "subtotal",
    "total",
    "invoice_number",
    "vat_amount",
    "customer_case_id"
  ]
}