1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "offers": `Account,Source,Offer Id,Revision,Sku,Variant,Currency,Market,Kind,Amount,Decimals,Row Id,Approved At,Effective Start,Effective End,Effective End Inclusive,Display Start,Display End,Display End Inclusive,Exception Activation Id,Exception Amount,Exception Reason,Export Note
12fictional-account,approved-ledger,offer-1,rev-1,SKU-001,standard,USD,US,fixed_price,10.00,2,approval-1,2026-09-30T12:00:00Z,2026-10-01T00:00:00Z,2026-11-01T00:00:00Z,false,2026-10-01T00:00:00Z,2026-11-01T00:00:00Z,false,,,,Fictional extra column; not included in the report`,
13 "activations": `Account,Source,Offer Id,Revision,Sku,Variant,Currency,Market,Kind,Amount,Decimals,Row Id,Activation Id,Campaign Id,Starts At,Ends At,End Inclusive,Owner,Spend,Spend Period,Export Note
14fictional-account,approved-ledger,offer-1,rev-1,SKU-001,standard,USD,US,fixed_price,10.00,2,activation-row-1,activation-1,campaign-1,2026-10-01T00:00:00Z,2026-11-01T00:00:00Z,false,Fictional reviewer,10.00,2026-10,Fictional extra column; not included in the report
15fictional-account,approved-ledger,offer-1,rev-1,SKU-001,standard,USD,US,fixed_price,12.00,2,activation-row-2,activation-2,campaign-2,2026-10-01T00:00:00Z,2026-11-01T00:00:00Z,false,Fictional reviewer,10.00,2026-10,Fictional extra column; not included in the report
16fictional-account,approved-ledger,offer-1,rev-unmapped,SKU-001,standard,USD,US,fixed_price,10.00,2,activation-row-3,activation-3,campaign-3,2026-10-01T00:00:00Z,2026-11-01T00:00:00Z,false,Fictional reviewer,10.00,2026-10,Fictional extra column; not included in the report`,
17 "observations": `[
18 {
19 "Account": "fictional-account",
20 "Source": "approved-ledger",
21 "Offer Id": "offer-1",
22 "Revision": "rev-1",
23 "Sku": "SKU-001",
24 "Variant": "standard",
25 "Currency": "USD",
26 "Market": "US",
27 "Kind": "fixed_price",
28 "Amount": "10.00",
29 "Decimals": "2",
30 "Row Id": "observation-1",
31 "Observed At": "2026-10-02T11:00:00Z",
32 "Export Note": "Fictional extra column; not included in the report"
33 }
34]`,
35 "mapping": {
36 "ignore_unmapped_columns": true,
37 "offers": [
38 {
39 "source": "Account",
40 "target": "account"
41 },
42 {
43 "source": "Source",
44 "target": "source"
45 },
46 {
47 "source": "Offer Id",
48 "target": "offer_id"
49 },
50 {
51 "source": "Revision",
52 "target": "revision"
53 },
54 {
55 "source": "Sku",
56 "target": "sku"
57 },
58 {
59 "source": "Variant",
60 "target": "variant"
61 },
62 {
63 "source": "Currency",
64 "target": "currency"
65 },
66 {
67 "source": "Market",
68 "target": "market"
69 },
70 {
71 "source": "Kind",
72 "target": "kind"
73 },
74 {
75 "source": "Amount",
76 "target": "amount"
77 },
78 {
79 "source": "Decimals",
80 "target": "decimals"
81 },
82 {
83 "source": "Row Id",
84 "target": "row_id"
85 },
86 {
87 "source": "Approved At",
88 "target": "approved_at"
89 },
90 {
91 "source": "Effective Start",
92 "target": "effective_start"
93 },
94 {
95 "source": "Effective End",
96 "target": "effective_end"
97 },
98 {
99 "source": "Effective End Inclusive",
100 "target": "effective_end_inclusive"
101 },
102 {
103 "source": "Display Start",
104 "target": "display_start"
105 },
106 {
107 "source": "Display End",
108 "target": "display_end"
109 },
110 {
111 "source": "Display End Inclusive",
112 "target": "display_end_inclusive"
113 },
114 {
115 "source": "Exception Activation Id",
116 "target": "exception_activation_id"
117 },
118 {
119 "source": "Exception Amount",
120 "target": "exception_amount"
121 },
122 {
123 "source": "Exception Reason",
124 "target": "exception_reason"
125 }
126 ],
127 "activations": [
128 {
129 "source": "Account",
130 "target": "account"
131 },
132 {
133 "source": "Source",
134 "target": "source"
135 },
136 {
137 "source": "Offer Id",
138 "target": "offer_id"
139 },
140 {
141 "source": "Revision",
142 "target": "revision"
143 },
144 {
145 "source": "Sku",
146 "target": "sku"
147 },
148 {
149 "source": "Variant",
150 "target": "variant"
151 },
152 {
153 "source": "Currency",
154 "target": "currency"
155 },
156 {
157 "source": "Market",
158 "target": "market"
159 },
160 {
161 "source": "Kind",
162 "target": "kind"
163 },
164 {
165 "source": "Amount",
166 "target": "amount"
167 },
168 {
169 "source": "Decimals",
170 "target": "decimals"
171 },
172 {
173 "source": "Row Id",
174 "target": "row_id"
175 },
176 {
177 "source": "Activation Id",
178 "target": "activation_id"
179 },
180 {
181 "source": "Campaign Id",
182 "target": "campaign_id"
183 },
184 {
185 "source": "Starts At",
186 "target": "starts_at"
187 },
188 {
189 "source": "Ends At",
190 "target": "ends_at"
191 },
192 {
193 "source": "End Inclusive",
194 "target": "end_inclusive"
195 },
196 {
197 "source": "Owner",
198 "target": "owner"
199 },
200 {
201 "source": "Spend",
202 "target": "spend"
203 },
204 {
205 "source": "Spend Period",
206 "target": "spend_period"
207 }
208 ],
209 "observations": [
210 {
211 "source": "Account",
212 "target": "account"
213 },
214 {
215 "source": "Source",
216 "target": "source"
217 },
218 {
219 "source": "Offer Id",
220 "target": "offer_id"
221 },
222 {
223 "source": "Revision",
224 "target": "revision"
225 },
226 {
227 "source": "Sku",
228 "target": "sku"
229 },
230 {
231 "source": "Variant",
232 "target": "variant"
233 },
234 {
235 "source": "Currency",
236 "target": "currency"
237 },
238 {
239 "source": "Market",
240 "target": "market"
241 },
242 {
243 "source": "Kind",
244 "target": "kind"
245 },
246 {
247 "source": "Amount",
248 "target": "amount"
249 },
250 {
251 "source": "Decimals",
252 "target": "decimals"
253 },
254 {
255 "source": "Row Id",
256 "target": "row_id"
257 },
258 {
259 "source": "Observed At",
260 "target": "observed_at"
261 }
262 ]
263 },
264 "asOf": "2026-10-02T12:00:00Z"
265};
266
267
268const run = await client.actor("critd/campaign-offer-guard").call(input);
269
270
271console.log('Results from dataset');
272console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
273const { items } = await client.dataset(run.defaultDatasetId).listItems();
274items.forEach((item) => {
275 console.dir(item);
276});
277
278