1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "data": [
12 {
13 "email": "ana@example.com",
14 "name": "Ana Silva",
15 "company": "Silva Ltd",
16 "plan": "Pro",
17 "mrr": 49,
18 "active": true,
19 "signedUpAt": "2026-08-01T09:30:00Z",
20 "address": {
21 "city": "Lisbon",
22 "country": "PT"
23 },
24 "tags": [
25 "b2b",
26 "eu"
27 ]
28 },
29 {
30 "email": "ben@example.com",
31 "name": "Ben Okafor",
32 "company": "Okafor & Co",
33 "plan": "Starter",
34 "mrr": 19,
35 "active": true,
36 "signedUpAt": "2026-08-14T15:05:00Z",
37 "address": {
38 "city": "Lagos",
39 "country": "NG"
40 },
41 "tags": [
42 "b2b"
43 ]
44 },
45 {
46 "email": "cara@example.com",
47 "name": "Cara Lind",
48 "company": "Lind Studio",
49 "plan": "Free",
50 "mrr": 0,
51 "active": false,
52 "signedUpAt": "2026-09-02T11:00:00Z",
53 "address": {
54 "city": "Malmö",
55 "country": "SE"
56 },
57 "tags": []
58 }
59 ],
60 "tableName": "apify_leads",
61 "writeMode": "upsert",
62 "keyFields": [
63 "email"
64 ],
65 "dryRun": true
66};
67
68
69const run = await client.actor("nerolabs/dataset-to-database").call(input);
70
71
72console.log('Results from dataset');
73console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
74const { items } = await client.dataset(run.defaultDatasetId).listItems();
75items.forEach((item) => {
76 console.dir(item);
77});
78
79