1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "postsFile": { "posts": [
10 {
11 "newsletterName": "Field Notes (synthetic demo)",
12 "newsletterUrl": "https://field.example/",
13 "postTitle": "Fieldwork dispatch",
14 "postUrl": "https://field.example/issues/1",
15 "publishedAt": "2026-10-08T12:00:00Z",
16 "html": "<p>Sponsored by <a href='https://cedar.example'>Cedar</a> and <a href='https://birch.example'>Birch</a>.</p><p><a href='/contact'>Contact us</a></p>",
17 "subscriberObservation": {
18 "evidence": "1,240 total subscribers",
19 "observedAt": "2026-10-08",
20 "sourceUrl": "https://field.example/about",
21 "basis": "total",
22 },
23 },
24 {
25 "newsletterName": "Field Notes (synthetic demo)",
26 "newsletterUrl": "https://field.example/",
27 "postTitle": "Reading list",
28 "postUrl": "https://field.example/issues/2",
29 "publishedAt": "2026-10-15T12:00:00Z",
30 "html": "<p>Affiliate link: <a href='https://floor.example'>Floor Press</a>. We earn a commission.</p><p><a href='/contact'>Contact us</a></p>",
31 },
32 {
33 "newsletterName": "Field Notes (synthetic demo)",
34 "newsletterUrl": "https://field.example/",
35 "postTitle": "Editorial notebook",
36 "postUrl": "https://field.example/issues/3",
37 "publishedAt": "2026-10-22T12:00:00Z",
38 "html": "<p>We compared <a href='https://cedar.example'>Cedar</a> with other tools. Thousands of readers joined us.</p><p><a href='/contact'>Contact us</a></p>",
39 },
40 ] },
41 "sponsorKeywords": ["Cedar"],
42}
43
44
45run = client.actor("afkdigital/substack-newsletter-sponsor-intelligence").call(run_input=run_input)
46
47
48print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
49for item in client.dataset(run.default_dataset_id).iterate_items():
50 print(item)
51
52