1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = { "reports": [
9 {
10 "format": "csv",
11 "data": """acct,network,from,to,post,shown,unique_reach
12brand-a,instagram,2026-10-01,2026-10-07,p-1,10,7""",
13 "mapping": {
14 "business_account_key": "acct",
15 "platform": "network",
16 "period_start": "from",
17 "period_end": "to",
18 "post_key": "post",
19 "impressions": "shown",
20 "reach": "unique_reach",
21 },
22 "metric_definition_ids": {
23 "impressions": "post_impressions_v1",
24 "reach": "account_reach_v1",
25 },
26 },
27 {
28 "format": "json",
29 "data": "[{\"business\":\"brand-a\",\"channel\":\"instagram\",\"start_date\":\"2026-10-08\",\"end_date\":\"2026-10-14\",\"content\":\"p-2\",\"views_total\":14,\"reach_total\":9}]",
30 "mapping": {
31 "business_account_key": "business",
32 "platform": "channel",
33 "period_start": "start_date",
34 "period_end": "end_date",
35 "post_key": "content",
36 "impressions": "views_total",
37 "reach": "reach_total",
38 },
39 "metric_definition_ids": {
40 "impressions": "post_impressions_v1",
41 "reach": "account_reach_v1",
42 },
43 },
44 ] }
45
46
47run = client.actor("althorlabs/social-metrics-reconciler").call(run_input=run_input)
48
49
50print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
51for item in client.dataset(run.default_dataset_id).iterate_items():
52 print(item)
53
54