1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "productsFile": {
12 "name": "products.json",
13 "format": "json",
14 "content": [
15 {
16 "gtin": "1234567000015",
17 "productTitle": "Synthetic demo product 1",
18 "brand": "Synthetic Demo",
19 "model": "D1",
20 "packQuantity": 1,
21 "variant": "standard",
22 "condition": "new",
23 "unit": "each",
24 "unitQuantity": 1
25 },
26 {
27 "gtin": "1234567000022",
28 "productTitle": "Synthetic demo product 2",
29 "brand": "Synthetic Demo",
30 "model": "D1",
31 "packQuantity": 1,
32 "variant": "standard",
33 "condition": "new",
34 "unit": "each",
35 "unitQuantity": 1
36 },
37 {
38 "gtin": "1234567000039",
39 "productTitle": "Synthetic demo product 3",
40 "brand": "Synthetic Demo",
41 "model": "D1",
42 "packQuantity": 1,
43 "variant": "standard",
44 "condition": "new",
45 "unit": "each",
46 "unitQuantity": 1
47 },
48 {
49 "gtin": "1234567000046",
50 "productTitle": "Synthetic demo product 4",
51 "brand": "Synthetic Demo",
52 "model": "D1",
53 "packQuantity": 1,
54 "variant": "standard",
55 "condition": "new",
56 "unit": "each",
57 "unitQuantity": 1
58 },
59 {
60 "gtin": "1234567000053",
61 "productTitle": "Synthetic demo product 5",
62 "brand": "Synthetic Demo",
63 "model": "D1",
64 "packQuantity": 1,
65 "variant": "standard",
66 "condition": "new",
67 "unit": "each",
68 "unitQuantity": 1
69 },
70 {
71 "gtin": "1234567000060",
72 "productTitle": "Synthetic demo product 6",
73 "brand": "Synthetic Demo",
74 "model": "D1",
75 "packQuantity": 1,
76 "variant": "standard",
77 "condition": "new",
78 "unit": "each",
79 "unitQuantity": 1
80 },
81 {
82 "productTitle": "Synthetic candidate product",
83 "brand": "Synthetic Demo",
84 "model": "D1",
85 "packQuantity": 1,
86 "variant": "standard",
87 "condition": "new",
88 "unit": "each",
89 "unitQuantity": 1
90 },
91 {
92 "gtin": "5901234123458",
93 "productTitle": "Invalid check digit"
94 }
95 ]
96 },
97 "offersFiles": [
98 {
99 "name": "authorized-demo-a.json",
100 "format": "json",
101 "content": [
102 {
103 "gtin": "1234567000015",
104 "productTitle": "Synthetic demo product 1",
105 "brand": "Synthetic Demo",
106 "model": "D1",
107 "packQuantity": 1,
108 "variant": "standard",
109 "condition": "new",
110 "unit": "each",
111 "unitQuantity": 1,
112 "seller": "Demo seller A",
113 "sourceUrl": "https://example.invalid/self-authored-demo",
114 "itemPrice": 10,
115 "shippingPrice": 1,
116 "taxStatus": "included",
117 "currency": "USD",
118 "availability": "in_stock",
119 "observedAt": "2026-11-19T12:00:00Z",
120 "market": "US"
121 },
122 {
123 "gtin": "1234567000022",
124 "productTitle": "Synthetic demo product 2",
125 "brand": "Synthetic Demo",
126 "model": "D1",
127 "packQuantity": 1,
128 "variant": "standard",
129 "condition": "new",
130 "unit": "each",
131 "unitQuantity": 1,
132 "seller": "Demo seller A",
133 "sourceUrl": "https://example.invalid/self-authored-demo",
134 "itemPrice": 11,
135 "shippingPrice": 1,
136 "taxStatus": "included",
137 "currency": "USD",
138 "availability": "in_stock",
139 "observedAt": "2026-11-19T12:00:00Z",
140 "market": "US"
141 },
142 {
143 "gtin": "1234567000039",
144 "productTitle": "Synthetic demo product 3",
145 "brand": "Synthetic Demo",
146 "model": "D1",
147 "packQuantity": 1,
148 "variant": "standard",
149 "condition": "new",
150 "unit": "each",
151 "unitQuantity": 1,
152 "seller": "Demo seller A",
153 "sourceUrl": "https://example.invalid/self-authored-demo",
154 "itemPrice": 12,
155 "shippingPrice": 1,
156 "taxStatus": "included",
157 "currency": "USD",
158 "availability": "in_stock",
159 "observedAt": "2026-11-19T12:00:00Z",
160 "market": "US"
161 },
162 {
163 "gtin": "1234567000046",
164 "productTitle": "Synthetic demo product 4",
165 "brand": "Synthetic Demo",
166 "model": "D1",
167 "packQuantity": 1,
168 "variant": "standard",
169 "condition": "new",
170 "unit": "each",
171 "unitQuantity": 1,
172 "seller": "Demo seller A",
173 "sourceUrl": "https://example.invalid/self-authored-demo",
174 "itemPrice": 13,
175 "shippingPrice": 1,
176 "taxStatus": "included",
177 "currency": "USD",
178 "availability": "in_stock",
179 "observedAt": "2026-11-19T12:00:00Z",
180 "market": "US"
181 },
182 {
183 "gtin": "1234567000053",
184 "productTitle": "Synthetic demo product 5",
185 "brand": "Synthetic Demo",
186 "model": "D1",
187 "packQuantity": 1,
188 "variant": "standard",
189 "condition": "new",
190 "unit": "each",
191 "unitQuantity": 1,
192 "seller": "Demo seller A",
193 "sourceUrl": "https://example.invalid/self-authored-demo",
194 "itemPrice": 14,
195 "shippingPrice": 1,
196 "taxStatus": "included",
197 "currency": "USD",
198 "availability": "in_stock",
199 "observedAt": "2026-11-19T12:00:00Z",
200 "market": "US"
201 },
202 {
203 "gtin": "1234567000060",
204 "productTitle": "Synthetic demo product 6",
205 "brand": "Synthetic Demo",
206 "model": "D1",
207 "packQuantity": 1,
208 "variant": "standard",
209 "condition": "new",
210 "unit": "each",
211 "unitQuantity": 1,
212 "seller": "Demo seller A",
213 "sourceUrl": "https://example.invalid/self-authored-demo",
214 "itemPrice": 15,
215 "shippingPrice": 1,
216 "taxStatus": "included",
217 "currency": "USD",
218 "availability": "in_stock",
219 "observedAt": "2026-11-19T12:00:00Z",
220 "market": "US"
221 },
222 {
223 "productTitle": "Synthetic candidate product",
224 "brand": "Synthetic Demo",
225 "model": "D1",
226 "packQuantity": 1,
227 "variant": "standard",
228 "condition": "new",
229 "unit": "each",
230 "unitQuantity": 1,
231 "seller": "Demo seller A",
232 "sourceUrl": "https://example.invalid/self-authored-demo",
233 "itemPrice": 16,
234 "shippingPrice": 1,
235 "taxStatus": "included",
236 "currency": "USD",
237 "availability": "in_stock",
238 "observedAt": "2026-11-19T12:00:00Z",
239 "market": "US"
240 }
241 ],
242 "rightsConfirmed": true,
243 "rightsBasis": "Self-authored synthetic fixtures owned by AFK Digital; commercial processing and redistribution permitted."
244 },
245 {
246 "name": "authorized-demo-b.json",
247 "format": "json",
248 "content": [
249 {
250 "gtin": "1234567000015",
251 "productTitle": "Synthetic demo product 1",
252 "brand": "Synthetic Demo",
253 "model": "D1",
254 "packQuantity": 1,
255 "variant": "standard",
256 "condition": "new",
257 "unit": "each",
258 "unitQuantity": 1,
259 "seller": "Demo seller B",
260 "sourceUrl": "https://example.invalid/self-authored-demo",
261 "itemPrice": 9,
262 "shippingPrice": 1,
263 "taxStatus": "included",
264 "currency": "USD",
265 "availability": "in_stock",
266 "observedAt": "2026-11-19T12:00:00Z",
267 "market": "US"
268 },
269 {
270 "gtin": "1234567000022",
271 "productTitle": "Synthetic demo product 2",
272 "brand": "Synthetic Demo",
273 "model": "D1",
274 "packQuantity": 6,
275 "variant": "standard",
276 "condition": "new",
277 "unit": "each",
278 "unitQuantity": 1,
279 "seller": "Demo seller B",
280 "sourceUrl": "https://example.invalid/self-authored-demo",
281 "itemPrice": 10,
282 "shippingPrice": 1,
283 "taxStatus": "included",
284 "currency": "USD",
285 "availability": "in_stock",
286 "observedAt": "2026-11-19T12:00:00Z",
287 "market": "US"
288 },
289 {
290 "gtin": "1234567000039",
291 "productTitle": "Synthetic demo product 3",
292 "brand": "Synthetic Demo",
293 "model": "D1",
294 "packQuantity": 1,
295 "variant": "standard",
296 "condition": "new",
297 "unit": "each",
298 "unitQuantity": 1,
299 "seller": "Demo seller B",
300 "sourceUrl": "https://example.invalid/self-authored-demo",
301 "itemPrice": 11,
302 "taxStatus": "included",
303 "currency": "USD",
304 "availability": "in_stock",
305 "observedAt": "2026-11-19T12:00:00Z",
306 "market": "US"
307 },
308 {
309 "gtin": "1234567000046",
310 "productTitle": "Synthetic demo product 4",
311 "brand": "Synthetic Demo",
312 "model": "D1",
313 "packQuantity": 1,
314 "variant": "standard",
315 "condition": "new",
316 "unit": "each",
317 "unitQuantity": 1,
318 "seller": "Demo seller B",
319 "sourceUrl": "https://example.invalid/self-authored-demo",
320 "itemPrice": 12,
321 "shippingPrice": 1,
322 "taxStatus": "included",
323 "currency": "EUR",
324 "availability": "in_stock",
325 "observedAt": "2026-11-19T12:00:00Z",
326 "market": "US"
327 },
328 {
329 "gtin": "1234567000053",
330 "productTitle": "Synthetic demo product 5",
331 "brand": "Synthetic Demo",
332 "model": "D1",
333 "packQuantity": 1,
334 "variant": "standard",
335 "condition": "new",
336 "unit": "each",
337 "unitQuantity": 1,
338 "seller": "Demo seller B",
339 "sourceUrl": "https://example.invalid/self-authored-demo",
340 "itemPrice": 13,
341 "shippingPrice": 1,
342 "taxStatus": "included",
343 "currency": "USD",
344 "availability": "unavailable",
345 "observedAt": "2026-11-19T12:00:00Z",
346 "market": "US",
347 "sourceError": "Customer reported a failed observation; no live request was made"
348 },
349 {
350 "gtin": "1234567000060",
351 "productTitle": "Synthetic demo product 6",
352 "brand": "Synthetic Demo",
353 "model": "D1",
354 "packQuantity": 1,
355 "variant": "standard",
356 "condition": "new",
357 "unit": "each",
358 "unitQuantity": 1,
359 "seller": "Demo seller B",
360 "sourceUrl": "https://example.invalid/self-authored-demo",
361 "itemPrice": 14,
362 "shippingPrice": 1,
363 "taxStatus": "unknown",
364 "currency": "USD",
365 "availability": "in_stock",
366 "observedAt": "2026-11-19T12:00:00Z",
367 "market": "US"
368 },
369 {
370 "productTitle": "Synthetic candidate product extra",
371 "brand": "Synthetic Demo",
372 "model": "D1",
373 "packQuantity": 1,
374 "variant": "standard",
375 "condition": "new",
376 "unit": "each",
377 "unitQuantity": 1,
378 "seller": "Demo seller B",
379 "sourceUrl": "https://example.invalid/self-authored-demo",
380 "itemPrice": 15,
381 "shippingPrice": 1,
382 "taxStatus": "included",
383 "currency": "USD",
384 "availability": "in_stock",
385 "observedAt": "2026-11-19T12:00:00Z",
386 "market": "US"
387 }
388 ],
389 "rightsConfirmed": true,
390 "rightsBasis": "Self-authored synthetic fixtures owned by AFK Digital; commercial processing and redistribution permitted."
391 }
392 ],
393 "market": "US",
394 "comparisonCurrency": "USD",
395 "matchMode": "title_candidates"
396};
397
398
399const run = await client.actor("afkdigital/gtin-price-availability-comparison").call(input);
400
401
402console.log('Results from dataset');
403console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
404const { items } = await client.dataset(run.defaultDatasetId).listItems();
405items.forEach((item) => {
406 console.dir(item);
407});
408
409