1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "documents": [
12 {
13 "documentNumber": "INV-1001",
14 "date": "2026-10-04",
15 "dueDate": "2026-11-03",
16 "buyer": {
17 "name": "Northwind Studio",
18 "address": "200 Market Street\nSpringfield, IL 62701"
19 },
20 "items": [
21 {
22 "description": "Website redesign",
23 "quantity": 1,
24 "unitPrice": 2400
25 },
26 {
27 "description": "Hosting",
28 "details": "12 months",
29 "quantity": 12,
30 "unit": "mo",
31 "unitPrice": 15
32 }
33 ],
34 "taxRate": 8.25
35 }
36 ],
37 "defaults": {
38 "currency": "USD",
39 "seller": {
40 "name": "Example Design Co.",
41 "address": "1 Main Street\nAnytown, CA 94000",
42 "email": "billing@example.com"
43 },
44 "paymentInstructions": "Bank transfer to account 000000, or pay online.",
45 "terms": "Payment due within 30 days."
46 }
47};
48
49
50const run = await client.actor("examsens.ai/document-generator").call(input);
51
52
53console.log('Results from dataset');
54console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
55const { items } = await client.dataset(run.defaultDatasetId).listItems();
56items.forEach((item) => {
57 console.dir(item);
58});
59
60