1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "template": "https://api.apify.com/v2/key-value-stores/Km5b4PG3kYHdZSb1E/records/invoice-template-example.docx?signature=190drBPUUHMJlHQInNGAv",
12 "data": {
13 "company": {
14 "name": "Northwind Studio",
15 "address": "12 Harbor Lane, Portland, ME 04101",
16 "email": "billing@northwind.example",
17 "payment": "bank transfer to account 0012 3456 78"
18 },
19 "number": "INV-2026-0142",
20 "issued": "2026-10-25",
21 "due": "2026-11-24",
22 "client": {
23 "name": "Blue Fern Cafe",
24 "address": "88 Market Street, Springfield, IL 62701",
25 "email": "accounts@bluefern.example"
26 },
27 "items": [
28 {
29 "description": "Website redesign",
30 "qty": 1,
31 "price": 2400
32 },
33 {
34 "description": "Product photography (half day)",
35 "qty": 2,
36 "price": 350
37 },
38 {
39 "description": "Hosting, 12 months",
40 "qty": 12,
41 "price": 15
42 }
43 ],
44 "subtotal": 3280,
45 "tax_rate": 0.08,
46 "tax": 262.4,
47 "total": 3542.4,
48 "notes": "Thank you! Please put the invoice number on your payment."
49 }
50};
51
52
53const run = await client.actor("jumblemog/docx-template-filler").call(input);
54
55
56console.log('Results from dataset');
57console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
58const { items } = await client.dataset(run.defaultDatasetId).listItems();
59items.forEach((item) => {
60 console.dir(item);
61});
62
63