1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "previous": {
12 "capturedAt": "2026-10-01T00:00:00Z",
13 "sourceRef": "DemoBefore",
14 "metricBasis": "PUBLIC_POST_COUNTERS",
15 "items": [
16 {
17 "shortCode": "DemoReel1",
18 "ownerUsername": "demo_creator",
19 "type": "Reel",
20 "likesCount": 100,
21 "commentsCount": 10,
22 "videoViewCount": 1000
23 },
24 {
25 "shortCode": "HiddenLikes",
26 "ownerUsername": "demo_creator",
27 "type": "Image",
28 "likesCount": -1,
29 "commentsCount": 0,
30 "videoViewCount": null
31 },
32 {
33 "shortCode": "Decreased",
34 "ownerUsername": "demo_creator",
35 "type": "Image",
36 "likesCount": 10,
37 "commentsCount": 1,
38 "videoViewCount": null
39 },
40 {
41 "shortCode": "PreviousOnly",
42 "ownerUsername": "demo_creator",
43 "type": "Sidecar",
44 "likesCount": 20,
45 "commentsCount": 2,
46 "videoViewCount": null
47 }
48 ]
49 },
50 "current": {
51 "capturedAt": "2026-10-02T00:00:00Z",
52 "sourceRef": "DemoAfter",
53 "metricBasis": "PUBLIC_POST_COUNTERS",
54 "items": [
55 {
56 "shortCode": "DemoReel1",
57 "ownerUsername": "demo_creator",
58 "type": "Reel",
59 "likesCount": 160,
60 "commentsCount": 18,
61 "videoViewCount": 1450
62 },
63 {
64 "shortCode": "HiddenLikes",
65 "ownerUsername": "demo_creator",
66 "type": "Image",
67 "likesCount": null,
68 "commentsCount": 2,
69 "videoViewCount": -1
70 },
71 {
72 "shortCode": "Decreased",
73 "ownerUsername": "demo_creator",
74 "type": "Image",
75 "likesCount": 8,
76 "commentsCount": 1,
77 "videoViewCount": null
78 },
79 {
80 "shortCode": "CurrentOnly",
81 "ownerUsername": "demo_creator",
82 "type": "Video",
83 "likesCount": 5,
84 "commentsCount": 0,
85 "videoViewCount": 25
86 }
87 ]
88 }
89};
90
91
92const run = await client.actor("bread-kim/instagram-post-growth-delta").call(input);
93
94
95console.log('Results from dataset');
96console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
97const { items } = await client.dataset(run.defaultDatasetId).listItems();
98items.forEach((item) => {
99 console.dir(item);
100});
101
102