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