1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "products": [
10 {
11 "sku": "DEMO-01",
12 "salePrice": "40",
13 "currency": "USD",
14 "saleUnit": "each",
15 "targetMarginPct": "35",
16 },
17 {
18 "sku": "DEMO-02",
19 "salePrice": "80",
20 "currency": "USD",
21 "saleUnit": "each",
22 },
23 ],
24 "quotes": [
25 {
26 "quoteId": "Q-DEMO-01",
27 "sku": "DEMO-01",
28 "supplier": "Supplier Alpha (fictional)",
29 "currency": "USD",
30 "purchaseUnit": "each",
31 "moq": 12,
32 "packSize": 6,
33 "validUntil": "2027-12-31",
34 "tiers": [
35 {
36 "minQty": 1,
37 "unitPrice": "25",
38 },
39 {
40 "minQty": 24,
41 "unitPrice": "22",
42 },
43 ],
44 "costs": {
45 "freightTotal": "30",
46 "nonRecoverableTaxTotal": "0",
47 "otherLandedTotal": "0",
48 "salesCommissionPct": "5",
49 },
50 },
51 {
52 "quoteId": "Q-DEMO-02",
53 "sku": "DEMO-01",
54 "supplier": "Supplier Beta (fictional)",
55 "currency": "USD",
56 "purchaseUnit": "each",
57 "moq": 10,
58 "packSize": 10,
59 "validUntil": "2027-12-31",
60 "tiers": [{
61 "minQty": 1,
62 "unitPrice": "24",
63 }],
64 "costs": {
65 "nonRecoverableTaxTotal": "0",
66 "otherLandedTotal": "0",
67 "salesCommissionPct": "0",
68 },
69 },
70 {
71 "quoteId": "Q-DEMO-03",
72 "sku": "DEMO-02",
73 "supplier": "Supplier Gamma (fictional)",
74 "currency": "CNY",
75 "purchaseUnit": "case",
76 "unitsPerPurchaseUnit": 12,
77 "moq": 2,
78 "packSize": 1,
79 "validUntil": "2027-12-31",
80 "tiers": [{
81 "minQty": 1,
82 "unitPrice": "300",
83 }],
84 "costs": {
85 "freightTotal": "0",
86 "nonRecoverableTaxTotal": "0",
87 "otherLandedTotal": "0",
88 "salesCommissionPct": "2",
89 },
90 },
91 {
92 "quoteId": "Q-DEMO-04",
93 "sku": "DEMO-02",
94 "supplier": "Supplier Delta (fictional)",
95 "currency": "USD",
96 "purchaseUnit": "each",
97 "moq": 20,
98 "packSize": 5,
99 "validUntil": "2026-01-01",
100 "tiers": [{
101 "minQty": 1,
102 "unitPrice": "45",
103 }],
104 "costs": {
105 "freightTotal": "20",
106 "nonRecoverableTaxTotal": "0",
107 "otherLandedTotal": "0",
108 "salesCommissionPct": "5",
109 },
110 },
111 ],
112 "requestedQuantity": 20,
113 "targetMarginPct": 35,
114 "targetCurrency": "USD",
115 "maxResults": 3,
116}
117
118
119run = client.actor("afkdigital/restock-margin-guard").call(run_input=run_input)
120
121
122print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
123for item in client.dataset(run.default_dataset_id).iterate_items():
124 print(item)
125
126