1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "beforeDate": "2026-09-01",
12 "afterDate": "2026-10-01",
13 "beforeItems": [
14 {
15 "asin": "B000000001",
16 "title": "Sample kettle",
17 "price": {
18 "value": 39.99,
19 "currency": "USD"
20 },
21 "listPrice": {
22 "value": 49.99,
23 "currency": "USD"
24 },
25 "availability": "In Stock",
26 "seller": "Example Seller A"
27 },
28 {
29 "asin": "B000000002",
30 "title": "Sample lamp",
31 "price": "EUR 24.50",
32 "availability": "In Stock",
33 "seller": "Example Seller B"
34 },
35 {
36 "asin": "B000000003",
37 "title": "Sample bottle",
38 "price": 12,
39 "currency": "USD",
40 "inStock": true,
41 "seller": "Example Seller A"
42 }
43 ],
44 "afterItems": [
45 {
46 "asin": "B000000001",
47 "title": "Sample kettle",
48 "price": {
49 "value": 34.99,
50 "currency": "USD"
51 },
52 "listPrice": {
53 "value": 49.99,
54 "currency": "USD"
55 },
56 "availability": "In Stock",
57 "seller": "Example Seller C"
58 },
59 {
60 "asin": "B000000002",
61 "title": "Sample lamp",
62 "price": "USD 26.00",
63 "availability": "Currently unavailable",
64 "seller": "Example Seller B"
65 },
66 {
67 "asin": "B000000004",
68 "title": "Sample mug",
69 "price": 8.5,
70 "currency": "USD",
71 "inStock": true,
72 "seller": "Example Seller D"
73 }
74 ]
75};
76
77
78const run = await client.actor("practical_ai_lab_jp/pal-amazon-offer-price-history-diff").call(input);
79
80
81console.log('Results from dataset');
82console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
83const { items } = await client.dataset(run.defaultDatasetId).listItems();
84items.forEach((item) => {
85 console.dir(item);
86});
87
88