SDK & Libraries
There is no package to install, the EsperWorks API is a standard REST API that works with any HTTP client. Copy the minimal wrappers below to get started in seconds.
An official npm package is on the roadmap. Until then, these copy-paste wrappers give you the same ergonomics with zero dependencies.
JavaScript / TypeScript
// Minimal typed wrapper, copy this into your project
// or use fetch/axios directly with the REST API.
const BASE = 'https://api.tryesperworks.com/api/v1';
async function ew<T>(
method: string,
path: string,
body?: unknown,
apiKey = process.env.ESPERWORKS_API_KEY!
): Promise<T> {
const res = await fetch(BASE + path, {
method,
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: body ? JSON.stringify(body) : undefined,
});
if (!res.ok) throw await res.json();
return res.json();
}
// Usage
const { client } = await ew<{ client: Client }>('POST', '/clients', {
name: 'Kofi Mensah',
email: 'kofi@example.com',
});
const { invoice, payment_url } = await ew<{ invoice: Invoice; payment_url: string }>(
'POST', '/invoices', {
client_id: client.id,
issue_date: '2026-05-01',
due_date: '2026-05-15',
currency: 'GHS',
items: [{ description: 'Web design', quantity: 1, rate: 2500 }],
}
);
await ew('POST', `/invoices/${invoice.id}/send`);
console.log('Payment URL:', payment_url);Python
import os, requests
BASE = 'https://api.tryesperworks.com/api/v1'
HEADERS = {'Authorization': f"Bearer {os.environ['ESPERWORKS_API_KEY']}"}
def ew(method, path, **kwargs):
r = requests.request(method, BASE + path, headers=HEADERS, **kwargs)
r.raise_for_status()
return r.json()
# Create a client
client = ew('POST', '/clients', json={
'name': 'Kofi Mensah',
'email': 'kofi@example.com',
})['client']
# Create and send an invoice
result = ew('POST', '/invoices', json={
'client_id': client['id'],
'issue_date': '2026-05-01',
'due_date': '2026-05-15',
'items': [{'description': 'Web design', 'quantity': 1, 'rate': 2500}],
})
ew('POST', f"/invoices/{result['invoice']['id']}/send")
print(result['payment_url'])Other languages
The pattern is the same for any language: set Authorization: Bearer ew_live_... on every request to https://api.tryesperworks.com/api/v1. See the Authentication page for the full scope list.
Built a wrapper for Go, Ruby, or PHP? Let us know , we'll link it here.