1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "quoteFiles": [
12 {
13 "id": "alpha",
14 "format": "csv",
15 "csvText": "supplier,quote_id,product_key,unit,currency,unit_price,moq,tier_min_quantity,tier_max_quantity,lead_time,order_multiple\r\nAlpha,Q1,P1,each,USD,10,1,0,,7 days,1\r\nAlpha,Q1,P1,each,USD,8,1,100,,7 days,1\r\n"
16 },
17 {
18 "id": "beta",
19 "format": "csv",
20 "csvText": "supplier,quote_id,product_key,unit,currency,unit_price,moq,tier_min_quantity,tier_max_quantity,lead_time,order_multiple\r\nBeta,Q2,P1,box,EUR,96,5,0,,7 days,1\r\n"
21 },
22 {
23 "id": "gamma",
24 "format": "csv",
25 "csvText": "supplier,quote_id,product_key,unit,currency,unit_price,moq,tier_min_quantity,tier_max_quantity,lead_time,order_multiple\r\nGamma,Q3,P1,each,USD,7,1,0,,7 days,1\r\n"
26 }
27 ],
28 "columnMapping": {
29 "supplier": "supplier",
30 "quote_id": "quote_id",
31 "product_key": "product_key",
32 "unit": "unit",
33 "currency": "currency",
34 "unit_price": "unit_price",
35 "moq": "moq",
36 "tier_min_quantity": "tier_min_quantity",
37 "tier_max_quantity": "tier_max_quantity",
38 "lead_time": "lead_time",
39 "order_multiple": "order_multiple"
40 },
41 "targetQuantities": {
42 "P1": {
43 "quantity": "120",
44 "unit": "each"
45 }
46 },
47 "targetCurrency": "USD",
48 "fxRates": [
49 {
50 "fromCurrency": "EUR",
51 "toCurrency": "USD",
52 "rate": "1.1",
53 "date": "2026-11-06"
54 }
55 ],
56 "unitConversions": [
57 {
58 "productKey": "P1",
59 "fromUnit": "box",
60 "toUnit": "each",
61 "factor": "12"
62 }
63 ],
64 "shippingAndDutyInputs": [
65 {
66 "supplier": "Alpha",
67 "quoteId": "Q1",
68 "currency": "USD",
69 "shippingTotal": "60",
70 "allocationMethod": "by_value",
71 "lines": [
72 {
73 "productKey": "P1",
74 "dutyTotal": "24",
75 "taxTotal": "0"
76 }
77 ]
78 },
79 {
80 "supplier": "Beta",
81 "quoteId": "Q2",
82 "currency": "USD",
83 "shippingTotal": "36",
84 "allocationMethod": "by_quantity",
85 "lines": [
86 {
87 "productKey": "P1",
88 "dutyTotal": "12",
89 "taxTotal": "0"
90 }
91 ]
92 }
93 ],
94 "maxLines": 5000
95};
96
97
98const run = await client.actor("afkdigital/supplier-quote-comparison-landed-cost").call(input);
99
100
101console.log('Results from dataset');
102console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
103const { items } = await client.dataset(run.defaultDatasetId).listItems();
104items.forEach((item) => {
105 console.dir(item);
106});
107
108