1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "mode": "items",
10 "items": [
11 {
12 "adId": "ad-long-1",
13 "pageName": "FlexKit",
14 "primaryText": "Tired of bulky gym gear in a small apartment? Our fold-flat home fitness kit helps busy parents get a quick full-body session before breakfast.",
15 "headline": "Train at home without losing your living room",
16 "callToAction": "Shop Now",
17 "landingPageUrl": "https://flexkit.example/products/fold-flat-kit",
18 "libraryUrl": "https://www.facebook.com/ads/library/?id=ad-long-1",
19 "mediaType": "video",
20 "publisherPlatform": [
21 "facebook",
22 "instagram",
23 ],
24 "startDate": "2026-05-01",
25 "endDate": "2026-07-09",
26 "countries": [
27 "US",
28 "CA",
29 ],
30 },
31 {
32 "libraryId": "ad-fresh-1",
33 "advertiserName": "Generic Gear",
34 "adText": "Big sale today. Save 10% on our best products.",
35 "title": "Limited time offer",
36 "ctaText": "Shop Now",
37 "linkUrl": "https://genericgear.example/",
38 "format": "image",
39 "startedAt": "2026-07-07",
40 "scrapedAt": "2026-07-09T00:00:00.000Z",
41 },
42 {
43 "id": "ad-risk-1",
44 "brand": "MetaHealth Finance",
45 "text": "Clinically proven to cure chronic pain and guarantee weight loss while improving your credit score in 30 days.",
46 "headline": "Guaranteed results",
47 "cta": "Apply Now",
48 "url": "https://metahealth.example/apply",
49 "mediaType": "image",
50 "startDate": "2026-05-20",
51 "endDate": "2026-07-09",
52 },
53 ],
54 "targetProfile": {
55 "brandName": "BrightNest",
56 "productCategory": "home fitness",
57 "targetCustomers": [
58 "busy parents",
59 "apartment renters",
60 ],
61 "competitors": [
62 "FlexKit",
63 "HomeTone",
64 ],
65 "currentAngles": ["discount_offer"],
66 "priorityMarkets": [
67 "US",
68 "CA",
69 ],
70 "complianceKeywords": [
71 "guarantee",
72 "clinically proven",
73 ],
74 "disallowedClaims": [
75 "cure",
76 "guaranteed weight loss",
77 ],
78 },
79 "processedAt": "2026-07-09T00:00:00.000Z",
80}
81
82
83run = client.actor("rotvuvo/meta-ad-creative-opportunity-scorer").call(run_input=run_input)
84
85
86print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
87for item in client.dataset(run["defaultDatasetId"]).iterate_items():
88 print(item)
89
90