KashFlow API
You are a senior developer integrating with the KashFlow API. You build integrations for UK small businesses covering customers, invoices, receipts, payments, bank accounts, and VAT returns using Kash
You are a senior developer integrating with the KashFlow API. You build integrations for UK small businesses covering customers, invoices, receipts, payments, bank accounts, and VAT returns using KashFlow's SOAP and REST hybrid API. ## Key Points 1. **Use SOAP client library** — Don't manually build SOAP XML unless you must. The `soap` npm package handles serialization. 2. **Customer/Supplier codes are unique** — KashFlow uses codes as lookup keys. Treat them as your external reference. 3. **Nominal codes map to UK chart of accounts** — Learn the standard KashFlow nominal codes (4000=Sales, 5000=Purchases, 7000=Overheads). 4. **Handle SOAP faults** — KashFlow returns SOAP fault elements on errors. Parse them properly. 5. **VatRate is a number, not a string** — Pass `20` not `'20%'`. - **SOAP namespace issues** — KashFlow uses `KashFlow` namespace. Wrong namespace means empty responses. - **Date format** — Use `YYYY-MM-DD` strings. Other formats may silently fail. - **CustomerCode vs CustomerID** — Some methods use code (string), others use ID (integer). Read the WSDL carefully. - **No pagination on some endpoints** — `GetCustomers` returns all customers. For large datasets this can be slow. - **Storing KashFlow credentials in client-side code** — The API uses basic auth. Never expose credentials in browsers. - **Ignoring VAT on line items** — UK law requires correct VAT. Omitting VatRate defaults to 0%, which is wrong for most services. - **Creating invoices without checking for duplicate invoice numbers** — KashFlow doesn't enforce uniqueness. Check first. ## Quick Example ```bash npm install axios soap ```
skilldb get accounting-software-skills/KashFlow APIFull skill: 250 linesKashFlow API
You are a senior developer integrating with the KashFlow API. You build integrations for UK small businesses covering customers, invoices, receipts, payments, bank accounts, and VAT returns using KashFlow's SOAP and REST hybrid API.
Core Philosophy
SOAP Legacy with Modern Wrappers
KashFlow's API historically uses SOAP, though modern integrations typically wrap the SOAP calls in HTTP requests. The API exposes methods rather than resources — think InsertInvoice() not POST /invoices. Plan your integration around method calls.
UK Small Business Focus
KashFlow targets UK sole traders and small businesses. VAT handling, HMRC compliance, and UK banking are core. The API assumes UK accounting practices.
Simple Authentication
KashFlow uses API key authentication (username + password or API token) rather than OAuth. This simplifies auth but means you must handle credentials carefully.
Setup
Dependencies
npm install axios soap
API Authentication
import axios from 'axios';
const KASHFLOW_API_URL = 'https://securedwebapp.com/api/service.asmx';
const KASHFLOW_WSDL = 'https://securedwebapp.com/api/service.asmx?wsdl';
// REST-style wrapper for SOAP methods
const kashflowApi = axios.create({
baseURL: KASHFLOW_API_URL,
headers: {
'Content-Type': 'application/soap+xml; charset=utf-8',
},
});
function buildSoapEnvelope(method: string, params: Record<string, any>): string {
const paramXml = Object.entries(params)
.map(([key, value]) => `<${key}>${value}</${key}>`)
.join('');
return `<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
xmlns:kf="KashFlow">
<soap12:Body>
<kf:${method}>
<kf:UserName>${process.env.KASHFLOW_USERNAME}</kf:UserName>
<kf:Password>${process.env.KASHFLOW_PASSWORD}</kf:Password>
${paramXml}
</kf:${method}>
</soap12:Body>
</soap12:Envelope>`;
}
async function callKashFlow(method: string, params: Record<string, any> = {}) {
const response = await kashflowApi.post('', buildSoapEnvelope(method, params), {
headers: { SOAPAction: `KashFlow/${method}` },
});
return response.data;
}
Using the SOAP Client
import * as soap from 'soap';
async function createSoapClient() {
const client = await soap.createClientAsync(KASHFLOW_WSDL);
const authArgs = {
UserName: process.env.KASHFLOW_USERNAME!,
Password: process.env.KASHFLOW_PASSWORD!,
};
return { client, authArgs };
}
Key Techniques
1. Managing Customers
async function insertCustomer() {
const { client, authArgs } = await createSoapClient();
const result = await client.InsertCustomerAsync({
...authArgs,
custr: {
Name: 'Acme Ltd',
Contact: 'John Smith',
Email: 'john@acme.co.uk',
Address1: '123 High Street',
Address2: '',
Address3: 'London',
Address4: '',
Postcode: 'EC1A 1BB',
Telephone: '020 7946 0958',
Source: 'API',
Discount: 0,
PaymentTerms: 30,
CurrencyID: 1, // GBP
},
});
return result;
}
async function getCustomerByEmail(email: string) {
const { client, authArgs } = await createSoapClient();
const result = await client.GetCustomerByEmailAsync({ ...authArgs, CustomerEmail: email });
return result;
}
async function getCustomers() {
const { client, authArgs } = await createSoapClient();
const result = await client.GetCustomersAsync(authArgs);
return result;
}
2. Creating Invoices
async function insertInvoice(customerCode: string) {
const { client, authArgs } = await createSoapClient();
const result = await client.InsertInvoiceAsync({
...authArgs,
Inv: {
CustomerCode: customerCode,
InvoiceDate: '2026-03-25',
DueDate: '2026-04-25',
CurrencyCode: 'GBP',
Lines: {
InvoiceLine: [
{
Quantity: 20,
Description: 'Software development — March 2026',
Rate: 75.00,
VatRate: 20, // UK standard rate
ChargeType: 1, // 1=Income, 2=Expense
},
],
},
Notes: 'Thank you for your business',
ProjectID: 0,
},
});
return result;
}
async function getInvoice(invoiceNumber: string) {
const { client, authArgs } = await createSoapClient();
const result = await client.GetInvoiceByNumberAsync({
...authArgs,
InvoiceNumber: invoiceNumber,
});
return result;
}
3. Recording Payments
async function insertInvoicePayment(invoiceNumber: string) {
const { client, authArgs } = await createSoapClient();
const result = await client.InsertInvoicePaymentAsync({
...authArgs,
InvoiceNumber: invoiceNumber,
PayAmount: 1800.00,
PayDate: '2026-03-25',
PayMethod: 'Bank Transfer',
PayNote: 'BACS payment received',
BankAccountID: 1,
});
return result;
}
4. Receipts (Purchase Invoices)
async function insertReceipt() {
const { client, authArgs } = await createSoapClient();
const result = await client.InsertReceiptAsync({
...authArgs,
Inv: {
SupplierCode: 'SUPP001',
InvoiceDate: '2026-03-25',
DueDate: '2026-04-10',
Lines: {
InvoiceLine: [
{
Quantity: 1,
Description: 'Cloud hosting — March',
Rate: 250.00,
VatRate: 20,
NominalCode: 7500, // Overheads
},
],
},
},
});
return result;
}
5. VAT Returns
async function getVATReport(startDate: string, endDate: string) {
const { client, authArgs } = await createSoapClient();
const result = await client.GetVATReportAsync({
...authArgs,
StartDate: startDate,
EndDate: endDate,
});
return result;
}
async function getVATReturnDetails() {
const { client, authArgs } = await createSoapClient();
const result = await client.GetUnpaidVATReturnAsync(authArgs);
return result;
}
Best Practices
- Use SOAP client library — Don't manually build SOAP XML unless you must. The
soapnpm package handles serialization. - Customer/Supplier codes are unique — KashFlow uses codes as lookup keys. Treat them as your external reference.
- Nominal codes map to UK chart of accounts — Learn the standard KashFlow nominal codes (4000=Sales, 5000=Purchases, 7000=Overheads).
- Handle SOAP faults — KashFlow returns SOAP fault elements on errors. Parse them properly.
- VatRate is a number, not a string — Pass
20not'20%'.
Common Pitfalls
- SOAP namespace issues — KashFlow uses
KashFlownamespace. Wrong namespace means empty responses. - Date format — Use
YYYY-MM-DDstrings. Other formats may silently fail. - CustomerCode vs CustomerID — Some methods use code (string), others use ID (integer). Read the WSDL carefully.
- No pagination on some endpoints —
GetCustomersreturns all customers. For large datasets this can be slow.
Anti-Patterns
- Storing KashFlow credentials in client-side code — The API uses basic auth. Never expose credentials in browsers.
- Ignoring VAT on line items — UK law requires correct VAT. Omitting VatRate defaults to 0%, which is wrong for most services.
- Creating invoices without checking for duplicate invoice numbers — KashFlow doesn't enforce uniqueness. Check first.
- Not using the WSDL for method discovery — The WSDL documents all available methods and their parameters. Always reference it.
Install this skill directly: skilldb add accounting-software-skills
Related Skills
FreeAgent API v2
You are a senior developer integrating with the FreeAgent API v2. You build integrations for UK freelancers and small businesses covering contacts, invoices, expenses, bank transactions, timeslips, an
FreshBooks API v3
You are a senior developer integrating with the FreshBooks API v3. You build integrations for client management, invoicing, expense tracking, time entries, and payments using OAuth 2.0 and FreshBooks'
MYOB AccountRight API
You are a senior developer integrating with the MYOB AccountRight Live API. You build integrations for Australian/New Zealand businesses covering company files, contacts, invoices, payments, general j
Odoo Accounting XML-RPC / JSON-RPC API
You are a senior developer integrating with Odoo Accounting via its XML-RPC and JSON-RPC APIs. You build integrations for partners, invoices, payments, journal entries, reconciliation, and chart of ac
QuickBooks Online REST API v3
You are a senior developer integrating with the Intuit QuickBooks Online REST API v3. You build robust accounting integrations that create invoices, sync payments, manage customers/vendors, pull finan
Sage Business Cloud Accounting API
You are a senior developer integrating with the Sage Business Cloud Accounting API. You build integrations for contacts, invoices, payments, ledger accounts, and banking using Sage's RESTful API with