Code examples: curl, JavaScript, an HTML page, a workflow function
Use an API key (Settings → Integrations → API keys; scopes are permission keys) as Authorization: Bearer zk_…, or the session cookie from the browser.
curl — a lead, a delivery and an invoice
# add a lead
curl -X POST https://api.zudoworks.com/api/v1/leads \
-H "Authorization: Bearer zk_…" -H "Content-Type: application/json" \
-d '{ "name": "Aisha Rahman", "company": "Brightwater Pumps", "source": "trade_show", "estimated_value": "12000" }'
# convert it into a customer and a deal
curl -X POST https://api.zudoworks.com/api/v1/leads/<lead id>/convert \
-H "Authorization: Bearer zk_…" -H "Content-Type: application/json" \
-d '{ "opportunity": { "name": "Pump housings", "amount": "12000", "expected_close": "2026-12-01" } }'
# deliver everything outstanding on a confirmed order, then ship it
curl -X POST https://api.zudoworks.com/api/v1/shipments \
-H "Authorization: Bearer zk_…" -H "Content-Type: application/json" \
-d '{ "sales_order_id": "<order id>", "warehouse_id": "<warehouse id>", "ship_date": "2026-10-20", "carrier": "courier" }'
curl -X POST https://api.zudoworks.com/api/v1/shipments/<shipment id>/ship \
-H "Authorization: Bearer zk_…" -H "Content-Type: application/json" \
-d '{ "idempotency_key": "ship-2026-10-20-0001" }'
# invoice the order, issue it, record a payment, fetch the PDF
curl -X POST https://api.zudoworks.com/api/v1/invoices \
-H "Authorization: Bearer zk_…" -H "Content-Type: application/json" \
-d '{ "customer_id": "<customer id>", "sales_order_id": "<order id>", "invoice_date": "2026-10-21", "due_date": "2026-11-20", "tax_rate": "18", "lines": [ { "description": "Bracket", "quantity": "10", "unit_price": "25" } ] }'
curl -X POST https://api.zudoworks.com/api/v1/invoices/<invoice id>/issue -H "Authorization: Bearer zk_…"
curl -X POST https://api.zudoworks.com/api/v1/invoices/<invoice id>/payments \
-H "Authorization: Bearer zk_…" -H "Content-Type: application/json" \
-d '{ "amount": "295", "paid_on": "2026-10-25", "method": "bank_transfer", "reference": "BACS-1" }'
curl -o INV-000001.pdf https://api.zudoworks.com/api/v1/invoices/<invoice id>/pdf -H "Authorization: Bearer zk_…"
JavaScript — import a CSV, then read records by API name
const base = 'https://api.zudoworks.com/api/v1';
const headers = { Authorization: 'Bearer zk_…', 'Content-Type': 'application/json' };
// 1. upload the file's text
const upload = await fetch(`${base}/imports`, {
method: 'POST', headers,
body: JSON.stringify({
target: { kind: 'module', module: 'items' },
file_name: 'items.csv',
content: 'code,name,type,unit\nBRK-100,Bracket,manufactured_part,EA\n',
}),
}).then((r) => r.json());
// 2. confirm the mapping (validates every row) and 3. start it
await fetch(`${base}/imports/${upload.id}/mapping`, {
method: 'PUT', headers,
body: JSON.stringify({
columns: { code: 'code', name: 'name', type: 'item_type', unit: 'base_uom' },
options: { update_existing: true, key_field: 'code' },
}),
});
const started = await fetch(`${base}/imports/${upload.id}/start`, { method: 'POST', headers }).then((r) => r.json());
console.log(started.status, started.inserted, started.updated, started.failed, started.schedule_id);
// records of a custom form, keyed by API name
const visits = await fetch(`${base}/forms/site-visits/records?keys=api`, { headers }).then((r) => r.json());
for (const v of visits.items) console.log(v.record_uid, v.data['visit-date'], v.data.site);
An HTML page — open invoices on your intranet
<!doctype html>
<html lang="en">
<head><meta charset="utf-8" /><title>Open invoices</title></head>
<body>
<h1>Open invoices</h1>
<table id="t"><thead><tr><th>Invoice</th><th>Customer</th><th>Due</th><th>Balance</th></tr></thead><tbody></tbody></table>
<script>
const key = 'zk_…'; // an API key with the sales.read scope
fetch('https://api.zudoworks.com/api/v1/invoices?status=issued', { headers: { Authorization: `Bearer ${key}` } })
.then((r) => r.json())
.then((rows) => {
const body = document.querySelector('#t tbody');
for (const inv of rows) {
const tr = document.createElement('tr');
tr.innerHTML = `<td>${inv.invoice_no}</td><td>${inv.customer_name}</td><td>${inv.due_date ?? ''}</td><td>${inv.balance}</td>`;
body.appendChild(tr);
}
});
</script>
</body>
</html>
A workflow function — raise an NCR when a custom inspection record fails
Functions (§24) are lists of steps. This one is called from a rule on a custom "Line checks" form whose result field is fail; it creates an NCR through the API and e-mails the quality lead.
{
"name": "Raise NCR from line check",
"returns": "value",
"parameters": [ { "name": "record" } ],
"steps": [
{ "type": "set", "var": "title", "value": "Line check failed: {{record.machine}}" },
{
"type": "invoke_url",
"method": "POST",
"url": "https://api.zudoworks.com/api/v1/ncrs",
"headers": { "Authorization": "Bearer zk_…" },
"body": { "title": "{{vars.title}}", "severity": "major", "quantity": "{{record.rejects}}", "source_ref": "{{meta.record_no}}" },
"as": "ncr"
},
{ "type": "send_email", "to": ["[email protected]"], "subject": "NCR {{vars.ncr.ncr_no}} opened", "body": "{{vars.title}} — {{record.notes}}" },
{ "type": "return", "value": "{{vars.ncr.ncr_no}}" }
]
}
Rule: trigger record_saved on the form, condition { "==": [ { "var": "record.result" }, "fail" ] }, step call → this function with record.
Last updated