1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "invoice": {
12 "invoice_number": "INV-2026-0001",
13 "issue_date": "2026-07-29",
14 "due_date": "2026-08-28",
15 "delivery_date": "2026-07-29",
16 "currency": "EUR",
17 "invoice_type_code": "380",
18 "buyer_reference": "BUYER-REF-1001",
19 "purchase_order_reference": "PO-2026-1001",
20 "seller": {
21 "name": "Fornitore Esempio SRL",
22 "address": {
23 "line1": "Via Roma 10",
24 "city": "Milano",
25 "postal_code": "20121",
26 "country_code": "IT",
27 "region": "MI"
28 },
29 "vat_id": "IT12345678901",
30 "tax_id": "12345678901",
31 "registration_id": "MI-1234567"
32 },
33 "buyer": {
34 "name": "Cliente Esempio SRL",
35 "address": {
36 "line1": "Via Torino 20",
37 "city": "Roma",
38 "postal_code": "00184",
39 "country_code": "IT",
40 "region": "RM"
41 },
42 "vat_id": "IT98765432109",
43 "tax_id": "98765432109"
44 },
45 "lines": [
46 {
47 "id": "1",
48 "description": "Servizi di consulenza",
49 "quantity": "2",
50 "unit_code": "HUR",
51 "unit_price": "500.00",
52 "tax_rate": "22",
53 "tax_category": "S"
54 }
55 ],
56 "payment": {
57 "means_code": "30",
58 "reference": "INV-2026-0001",
59 "iban": "IT60X0542811101000000123456"
60 },
61 "notes": [],
62 "extensions": {
63 "fatturapa": {
64 "transmission_format": "FPR12",
65 "document_type": "TD01",
66 "recipient_code": "ABC1234",
67 "transmission_progressive": "00001",
68 "seller_tax_regime": "RF01"
69 }
70 }
71 }
72};
73
74
75const run = await client.actor("kamerozkan/fatturapa-invoice-generator").call(input);
76
77
78console.log('Results from dataset');
79console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
80const { items } = await client.dataset(run.defaultDatasetId).listItems();
81items.forEach((item) => {
82 console.dir(item);
83});
84
85