1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "contract": {
12 "files": [
13 "supplier_a.csv",
14 "supplier_b.csv"
15 ],
16 "delimiter": ",",
17 "key": [
18 "sku"
19 ],
20 "remove_exact_duplicates": true,
21 "columns": [
22 {
23 "source": "SKU",
24 "target": "sku",
25 "type": "text",
26 "trim": true
27 },
28 {
29 "source": "Title",
30 "target": "title",
31 "type": "text",
32 "trim": true
33 },
34 {
35 "source": "Price",
36 "target": "price",
37 "type": "decimal",
38 "trim": true
39 },
40 {
41 "source": "Currency",
42 "target": "currency",
43 "type": "text",
44 "allowed": [
45 "GBP",
46 "USD",
47 "EUR"
48 ]
49 },
50 {
51 "source": "Stock",
52 "target": "stock",
53 "type": "integer"
54 },
55 {
56 "source": "Updated",
57 "target": "updated",
58 "type": "date",
59 "format": "%d/%m/%Y"
60 }
61 ]
62 },
63 "sources": [
64 {
65 "name": "supplier_a.csv",
66 "csv": "SKU,Title,Price,Currency,Stock,Updated\n 0001 , Example product ,12.5,GBP,03,19/10/2026\n0002,\"Two-part, sample\",0,GBP,0,03/04/2026\n0003,\"Quoted \"\"sample\"\"\nwith two lines\",9.99,USD,10,18/10/2026\n0003,\"Quoted \"\"sample\"\"\nwith two lines\",9.99,USD,10,18/10/2026\n"
67 },
68 {
69 "name": "supplier_b.csv",
70 "csv": "SKU,Title,Price,Currency,Stock,Updated\n0004,Fourth example,100,EUR,1,17/10/2026\n0005,Fifth example,2.00,GBP,5,16/10/2026\n0006,Sixth example,3.00,GBP,6,15/10/2026\n0005,Fifth example,2.00,GBP,5,16/10/2026\n"
71 }
72 ],
73 "confirm_authorized_data": true
74};
75
76
77const run = await client.actor("wellbuilt_orache/catalogue-import-rescue").call(input);
78
79
80console.log('Results from dataset');
81console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
82const { items } = await client.dataset(run.defaultDatasetId).listItems();
83items.forEach((item) => {
84 console.dir(item);
85});
86
87