1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "bundle": {
12 "schemaVersion": 1,
13 "actorUrl": "https://apify.com/example/demo",
14 "declaredBuild": "demo-1",
15 "contract": {
16 "fields": [
17 {
18 "path": "id",
19 "type": "string",
20 "required": true,
21 "unique": true
22 },
23 {
24 "path": "views",
25 "type": "number",
26 "required": true
27 },
28 {
29 "path": "observedAt",
30 "type": "string",
31 "required": true,
32 "timestamp": true
33 }
34 ],
35 "maxItems": 20
36 },
37 "sample": [
38 {
39 "id": "fictional-1",
40 "views": 12,
41 "observedAt": "2026-10-01T09:00:00Z"
42 },
43 {
44 "id": "fictional-1",
45 "views": "14",
46 "observedAt": "not-a-date"
47 }
48 ]
49 }
50};
51
52
53const run = await client.actor("automatron/check-charlie-output-qa").call(input);
54
55
56console.log('Results from dataset');
57console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
58const { items } = await client.dataset(run.defaultDatasetId).listItems();
59items.forEach((item) => {
60 console.dir(item);
61});
62
63