Invoices & Income
API reference for creating, updating, and managing invoices with PDF generation.
Invoices are also available via the Public API using API keys: GET/POST https://taxmtd.uk/api/v1/invoices. See Authentication for details.
List Invoices#
const invoices = await $fetch('https://taxmtd.uk/api/invoices')
// Returns: Array<{
// id, invoiceNumber, clientName, clientEmail,
// items, subtotal, vatAmount, total,
// status, dueDate, createdAt
// }>Create Invoice#
const invoice = await $fetch('https://taxmtd.uk/api/invoices', {
method: 'POST',
body: {
clientName: 'Acme Ltd',
clientEmail: 'billing@acme.com',
clientAddress: '456 Business Park, Manchester',
items: [
{ description: 'Web Development', quantity: 40, unitPrice: 75.00 },
{ description: 'Annual Hosting', quantity: 1, unitPrice: 120.00 }
],
vatRate: 20,
dueDate: '2026-04-15',
notes: 'Payment via bank transfer to sort code 12-34-56, account 12345678'
}
})Update Invoice#
await $fetch('https://taxmtd.uk/api/invoices', {
method: 'PUT',
body: { id: 1, status: 'paid', paidDate: '2026-04-10' }
})Download PDF#
const pdf = await $fetch(`https://taxmtd.uk/api/invoices/${id}/pdf`)
// Returns PDF binary dataContact Activity Timeline#
Returns all invoices, bills, and estimates linked to a contact, sorted by date.
const activity = await $fetch(`https://taxmtd.uk/api/contacts/${contactId}/activity`)
// Returns: {
// timeline: Array<{ type, id, number, date, total, status }>,
// totals: { invoices, bills, invoiceCount, billCount, estimateCount }
// }Customer Statement PDF#
Generates a PDF statement showing all invoices and outstanding balance for a contact.
const blob = await $fetch(`https://taxmtd.uk/api/contacts/${contactId}/statement`, {
responseType: 'blob'
})Delete Invoice#
await $fetch('https://taxmtd.uk/api/invoices', {
method: 'DELETE',
body: { id: 1 }
})