1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "sourceMode": "list",
10 "searchTerms": [
11 "posture corrector",
12 "dog harness",
13 "vitamin c serum",
14 ],
15 "productBrief": "An ergonomic laptop stand for people who work from home — adjustable height, folds flat, aluminium, $49.",
16 "maxDiscoveryChargeUsd": 0.5,
17 "maxQualified": 100,
18 "maxAdsToScan": 150,
19 "maxAdsPerSearch": 50,
20 "itemsList": [
21 {
22 "ad_archive_id": "1184500000000001",
23 "collation_id": "7300000000000011",
24 "collation_count": 12,
25 "page_id": "100000000000101",
26 "page_name": "Aligna Posture",
27 "is_active": True,
28 "start_date": 1781942400,
29 "end_date": None,
30 "publisher_platform": [
31 "FACEBOOK",
32 "INSTAGRAM",
33 "MESSENGER",
34 ],
35 "categories": ["UNKNOWN"],
36 "contains_digital_created_media": False,
37 "impressions_with_index": { "impressions_text": None },
38 "snapshot": {
39 "page_name": "Aligna Posture",
40 "page_profile_uri": "https://www.facebook.com/alignaposture.example",
41 "page_like_count": 48210,
42 "page_categories": ["Health & wellness website"],
43 "display_format": "VIDEO",
44 "title": "Sit taller in 7 days",
45 "body": { "text": "Tired of that 3pm neck ache at your desk? Aligna gently pulls your shoulders back so you sit tall without thinking about it. 50,000+ happy customers. Get 30% OFF today + free shipping." },
46 "link_description": "30-day money-back guarantee",
47 "cta_text": "Shop now",
48 "cta_type": "SHOP_NOW",
49 "link_url": "https://aligna.example/posture-corrector?utm_source=facebook&utm_campaign=q3&fbclid=IwAR0x",
50 "caption": "ALIGNA.EXAMPLE",
51 "images": [],
52 "videos": [{
53 "video_hd_url": "https://video.example/aligna-hook-hd.mp4",
54 "video_preview_image_url": "https://img.example/aligna-preview.jpg",
55 }],
56 "cards": [],
57 },
58 "searchTerm": "posture corrector",
59 "landingPage": {
60 "status": "ok",
61 "storePlatform": "shopify",
62 "pageType": "product",
63 "productTitle": "Aligna Posture Corrector",
64 "price": 39.95,
65 "currency": "USD",
66 "rating": 4.6,
67 "reviewsCount": 2184,
68 "pageTitle": "Aligna Posture Corrector – Aligna",
69 "fetchedUrl": "https://aligna.example/posture-corrector",
70 "sample": True,
71 },
72 },
73 {
74 "ad_archive_id": "1184500000000002",
75 "collation_id": "7300000000000011",
76 "collation_count": 12,
77 "page_id": "100000000000101",
78 "page_name": "Aligna Posture",
79 "is_active": True,
80 "start_date": 1784361600,
81 "publisher_platform": [
82 "FACEBOOK",
83 "INSTAGRAM",
84 ],
85 "snapshot": {
86 "display_format": "VIDEO",
87 "title": "Sit taller in 7 days",
88 "body": { "text": "Neck ache at your desk? Aligna pulls your shoulders back. Get 30% OFF today." },
89 "cta_text": "Shop now",
90 "link_url": "https://aligna.example/posture-corrector?utm_source=facebook&utm_content=v2",
91 "caption": "aligna.example",
92 "videos": [{ "video_sd_url": "https://video.example/aligna-v2-sd.mp4" }],
93 },
94 "searchTerm": "posture corrector",
95 },
96 {
97 "adArchiveID": "1184500000000003",
98 "collationId": "7300000000000022",
99 "collationCount": 6,
100 "pageID": "100000000000202",
101 "pageName": "Pawtrail",
102 "isActive": True,
103 "startDateFormatted": "2026-08-01T09:00:00.000Z",
104 "publisherPlatform": [
105 "facebook",
106 "instagram",
107 ],
108 "containsDigitalCreatedMedia": False,
109 "snapshot": {
110 "pageProfileUri": "https://www.facebook.com/pawtrail.example",
111 "pageLikeCount": 12940,
112 "pageCategories": ["Pet supplies"],
113 "displayFormat": "CAROUSEL",
114 "body": { "text": "My dog pulled like a train until we tried the Pawtrail no-pull harness. Now walks are actually fun. Buy 1, get 1 50% off — this week only." },
115 "ctaText": "Shop now",
116 "ctaType": "SHOP_NOW",
117 "caption": "pawtrail.example",
118 "cards": [
119 {
120 "title": "The harness that stops the pull",
121 "body": "My dog pulled like a train until we tried the Pawtrail no-pull harness.",
122 "linkUrl": "https://pawtrail.example/no-pull-harness?utm_source=meta",
123 "originalImageUrl": "https://img.example/pawtrail-card-1.jpg",
124 },
125 {
126 "title": "Fits in 30 seconds",
127 "body": "Two clips, no fuss.",
128 "linkUrl": "https://pawtrail.example/no-pull-harness",
129 "originalImageUrl": "https://img.example/pawtrail-card-2.jpg",
130 },
131 ],
132 },
133 "searchTerm": "dog harness",
134 },
135 {
136 "ad_archive_id": "1184500000000004",
137 "collation_id": "7300000000000033",
138 "collation_count": 4,
139 "page_id": "100000000000303",
140 "page_name": "Lumière Skin Lab",
141 "is_active": True,
142 "start_date": 1784102400,
143 "publisher_platform": [
144 "FACEBOOK",
145 "INSTAGRAM",
146 "AUDIENCE_NETWORK",
147 ],
148 "impressions_with_index": {
149 "impressions_text": "100K-200K",
150 "impressions_index": 4,
151 },
152 "snapshot": {
153 "page_like_count": 30511,
154 "page_categories": ["Beauty, cosmetic & personal care"],
155 "display_format": "IMAGE",
156 "title": "Brighter skin in 14 days",
157 "body": "Dermatologist-formulated 15% vitamin C serum for dull, tired skin. Brighter in 14 days or your money back. Now $29.99 (was $45).",
158 "link_description": "Free shipping on orders over $35",
159 "cta_text": "Learn more",
160 "cta_type": "LEARN_MORE",
161 "link_url": "https://lumiere-skinlab.example/vitamin-c?utm_source=fb&utm_medium=paid",
162 "caption": "lumiere-skinlab.example",
163 "images": [{
164 "original_image_url": "https://img.example/lumiere-serum.jpg",
165 "resized_image_url": "https://img.example/lumiere-serum-600.jpg",
166 }],
167 },
168 "searchTerm": "vitamin c serum",
169 "reach_estimate": "80K-120K",
170 "landingPage": {
171 "status": "ok",
172 "storePlatform": "woocommerce",
173 "pageType": "product",
174 "productTitle": "15% Vitamin C Brightening Serum",
175 "price": 29.99,
176 "currency": "USD",
177 "rating": 4.4,
178 "reviewsCount": 612,
179 "pageTitle": "Vitamin C Serum | Lumière Skin Lab",
180 "fetchedUrl": "https://lumiere-skinlab.example/vitamin-c",
181 "sample": True,
182 },
183 },
184 {
185 "ad_archive_id": "1184500000000005",
186 "collation_id": "7300000000000044",
187 "collation_count": 2,
188 "page_id": "100000000000404",
189 "page_name": "StandUp Co",
190 "is_active": True,
191 "start_date": 1788595200,
192 "publisher_platform": ["FACEBOOK"],
193 "snapshot": {
194 "page_categories": ["Furniture"],
195 "display_format": "VIDEO",
196 "title": "Any desk. Standing in 10 seconds.",
197 "body": { "text": "Your back will thank you. The StandUp converter turns any desk into a standing desk in 10 seconds. Free delivery across the US." },
198 "cta_text": "Shop now",
199 "link_url": "https://standup-co.example/converter",
200 "caption": "standup-co.example",
201 "videos": [{
202 "video_hd_url": "https://video.example/standup-demo.mp4",
203 "video_preview_image_url": "https://img.example/standup-preview.jpg",
204 }],
205 },
206 "searchTerm": "posture corrector",
207 },
208 {
209 "ad_archive_id": "1184500000000006",
210 "page_id": "100000000000505",
211 "page_name": "Citizens for Cleaner Parks",
212 "is_active": True,
213 "start_date": 1780300800,
214 "categories": ["POLITICAL"],
215 "political_countries": ["US"],
216 "spend": {
217 "lower_bound": "1000",
218 "upper_bound": "1499",
219 },
220 "currency": "USD",
221 "publisher_platform": [
222 "FACEBOOK",
223 "INSTAGRAM",
224 ],
225 "snapshot": {
226 "display_format": "IMAGE",
227 "body": { "text": "Vote yes on Measure 12 for cleaner city parks." },
228 "cta_text": "Learn more",
229 "link_url": "https://cleanerparks.example/measure-12",
230 },
231 },
232 {
233 "ad_archive_id": "1184500000000007",
234 "collation_id": "7300000000000066",
235 "collation_count": 1,
236 "page_id": "100000000000606",
237 "page_name": "GlowBox",
238 "is_active": True,
239 "start_date": 1790150400,
240 "publisher_platform": ["INSTAGRAM"],
241 "snapshot": {
242 "display_format": "IMAGE",
243 "body": { "text": "New drop: the GlowBox LED mask. Link in bio." },
244 "cta_text": "Shop now",
245 "link_url": "https://glowbox.example/led-mask",
246 },
247 "searchTerm": "vitamin c serum",
248 },
249 {
250 "ad_archive_id": "1184500000000008",
251 "collation_id": "7300000000000077",
252 "collation_count": 3,
253 "page_id": "100000000000707",
254 "page_name": "SnoozeWell",
255 "is_active": False,
256 "start_date": 1772352000,
257 "end_date": 1780128000,
258 "publisher_platform": [
259 "FACEBOOK",
260 "INSTAGRAM",
261 ],
262 "snapshot": {
263 "display_format": "IMAGE",
264 "body": { "text": "Fall asleep in 10 minutes with the SnoozeWell weighted eye mask. Free trial for 30 nights." },
265 "cta_text": "Try it free",
266 "link_url": "https://snoozewell.example/mask",
267 },
268 },
269 ],
270 "discoveryInput": {},
271 "proxyConfiguration": { "useApifyProxy": True },
272}
273
274
275run = client.actor("rich_minds/fb-ad-library-winning-ads").call(run_input=run_input)
276
277
278print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
279for item in client.dataset(run.default_dataset_id).iterate_items():
280 print(item)
281
282