1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "pairs": [
12 {
13 "label": "synthetic-example-not-a-website-audit",
14 "before": {
15 "lighthouseVersion": "13.5.0",
16 "gatherMode": "navigation",
17 "requestedUrl": "https://example.com/",
18 "mainDocumentUrl": "https://example.com/",
19 "finalDisplayedUrl": "https://example.com/",
20 "fetchTime": "2026-11-01T12:00:00Z",
21 "configSettings": {
22 "formFactor": "mobile",
23 "throttlingMethod": "simulate",
24 "screenEmulation": {
25 "mobile": true,
26 "width": 412,
27 "height": 823,
28 "deviceScaleFactor": 1.75,
29 "disabled": false
30 },
31 "throttling": {
32 "rttMs": 150,
33 "throughputKbps": 1638.4,
34 "cpuSlowdownMultiplier": 4
35 }
36 },
37 "environment": {
38 "hostUserAgent": "Synthetic Chrome/130.0.0.0",
39 "networkUserAgent": "Synthetic Mobile Chrome/130.0.0.0",
40 "benchmarkIndex": 1500
41 },
42 "runWarnings": [],
43 "audits": {
44 "largest-contentful-paint": {
45 "id": "largest-contentful-paint",
46 "score": 0.95,
47 "scoreDisplayMode": "numeric",
48 "numericValue": 1800,
49 "numericUnit": "millisecond"
50 },
51 "color-contrast": {
52 "id": "color-contrast",
53 "score": 0,
54 "scoreDisplayMode": "binary"
55 },
56 "document-title": {
57 "id": "document-title",
58 "score": 1,
59 "scoreDisplayMode": "binary"
60 }
61 },
62 "categories": {
63 "performance": {
64 "score": 0.95,
65 "auditRefs": [
66 {
67 "id": "largest-contentful-paint",
68 "weight": 1
69 }
70 ]
71 },
72 "accessibility": {
73 "score": 0.9,
74 "auditRefs": [
75 {
76 "id": "color-contrast",
77 "weight": 1
78 }
79 ]
80 },
81 "seo": {
82 "score": 1,
83 "auditRefs": [
84 {
85 "id": "document-title",
86 "weight": 1
87 }
88 ]
89 }
90 }
91 },
92 "after": {
93 "lighthouseVersion": "13.5.0",
94 "gatherMode": "navigation",
95 "requestedUrl": "https://example.com/",
96 "mainDocumentUrl": "https://example.com/",
97 "finalDisplayedUrl": "https://example.com/",
98 "fetchTime": "2026-11-02T12:00:00Z",
99 "configSettings": {
100 "formFactor": "mobile",
101 "throttlingMethod": "simulate",
102 "screenEmulation": {
103 "mobile": true,
104 "width": 412,
105 "height": 823,
106 "deviceScaleFactor": 1.75,
107 "disabled": false
108 },
109 "throttling": {
110 "rttMs": 150,
111 "throughputKbps": 1638.4,
112 "cpuSlowdownMultiplier": 4
113 }
114 },
115 "environment": {
116 "hostUserAgent": "Synthetic Chrome/130.0.0.0",
117 "networkUserAgent": "Synthetic Mobile Chrome/130.0.0.0",
118 "benchmarkIndex": 1500
119 },
120 "runWarnings": [],
121 "audits": {
122 "largest-contentful-paint": {
123 "id": "largest-contentful-paint",
124 "score": 0.7,
125 "scoreDisplayMode": "numeric",
126 "numericValue": 3100,
127 "numericUnit": "millisecond"
128 },
129 "color-contrast": {
130 "id": "color-contrast",
131 "score": 1,
132 "scoreDisplayMode": "binary"
133 },
134 "document-title": {
135 "id": "document-title",
136 "score": 1,
137 "scoreDisplayMode": "binary"
138 }
139 },
140 "categories": {
141 "performance": {
142 "score": 0.7,
143 "auditRefs": [
144 {
145 "id": "largest-contentful-paint",
146 "weight": 1
147 }
148 ]
149 },
150 "accessibility": {
151 "score": 1,
152 "auditRefs": [
153 {
154 "id": "color-contrast",
155 "weight": 1
156 }
157 ]
158 },
159 "seo": {
160 "score": 1,
161 "auditRefs": [
162 {
163 "id": "document-title",
164 "weight": 1
165 }
166 ]
167 }
168 }
169 }
170 }
171 ],
172 "budgets": {
173 "maxMetricValues": {
174 "largest-contentful-paint": 2500
175 },
176 "maxMetricIncreases": {
177 "largest-contentful-paint": 500
178 }
179 }
180};
181
182
183const run = await client.actor("plainfeeds/lighthouse-report-diff").call(input);
184
185
186console.log('Results from dataset');
187console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
188const { items } = await client.dataset(run.defaultDatasetId).listItems();
189items.forEach((item) => {
190 console.dir(item);
191});
192
193