1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "trackingNumbers": [],
12 "maxDiscoveryChargeUsd": 0.5,
13 "sourceMode": "list",
14 "itemsList": [
15 {
16 "tracking_number": "MSKU6104820",
17 "reference": "PO-44120 sample",
18 "origin": {
19 "terminal": "TANJUNG PELEPAS TERMINAL",
20 "city": "TANJUNG PELEPAS",
21 "country_code": "MY",
22 "location_code": "MYTPP"
23 },
24 "destination": {
25 "terminal": "FELIXSTOWE TERMINAL",
26 "city": "FELIXSTOWE",
27 "country_code": "GB",
28 "location_code": "GBFXT"
29 },
30 "containers": [
31 {
32 "container_num": "MSKU6104820",
33 "container_size": "40",
34 "container_type": "DRY",
35 "locations": [
36 {
37 "city": "Tanjung Pelepas",
38 "country_code": "MY",
39 "location_code": "MYTPP",
40 "events": [
41 {
42 "activity": "GATE-IN",
43 "actfor": "EXP",
44 "event_time": "2026-10-03T08:10:00.000",
45 "stempty": false
46 },
47 {
48 "activity": "LOAD",
49 "actfor": "EXP",
50 "event_time": "2026-10-05T21:40:00.000",
51 "stempty": false,
52 "vessel_name": "MAERSK SAMPLE BAY",
53 "voyage_num": "442W"
54 },
55 {
56 "activity": "CONTAINER DEPARTURE",
57 "actfor": "EXP",
58 "event_time": "2026-10-06T04:00:00.000",
59 "stempty": false,
60 "vessel_name": "MAERSK SAMPLE BAY",
61 "voyage_num": "442W"
62 }
63 ]
64 },
65 {
66 "city": "Felixstowe",
67 "country_code": "GB",
68 "location_code": "GBFXT",
69 "events": [
70 {
71 "activity": "DISCHARG",
72 "actfor": "IMP",
73 "event_time": "2026-11-02T06:00:00.000",
74 "event_time_type": "EXPECTED",
75 "stempty": false,
76 "vessel_name": "MAERSK SAMPLE BAY",
77 "voyage_num": "442W"
78 }
79 ]
80 }
81 ]
82 }
83 ],
84 "sampleChange": {
85 "changeType": "eta",
86 "etaSlipDays": 3
87 }
88 },
89 {
90 "tracking_number": "MSCU7421055",
91 "tracking_type": "Container",
92 "reference": "PO-44107 sample",
93 "bill_of_ladings": [
94 {
95 "BillOfLadingNumber": "MEDUSAMPLE01",
96 "NumberOfContainers": 1,
97 "GeneralTrackingInfo": {
98 "ShippedFrom": "SANTOS, BR",
99 "ShippedTo": "ROTTERDAM, NL",
100 "PortOfLoad": "SANTOS, BR",
101 "PortOfDischarge": "ROTTERDAM, NL",
102 "Transshipments": [],
103 "FinalPodEtaDate": ""
104 },
105 "ContainersInfo": [
106 {
107 "Events": [
108 {
109 "Order": 1,
110 "Date": "21/09/2026",
111 "Location": "SANTOS, BR",
112 "UnLocationCode": "BRSSZ",
113 "Description": "Export received at CY",
114 "Detail": [
115 "LADEN"
116 ]
117 },
118 {
119 "Order": 2,
120 "Date": "24/09/2026",
121 "Location": "SANTOS, BR",
122 "UnLocationCode": "BRSSZ",
123 "Description": "Export Loaded on Vessel",
124 "Detail": [
125 "LADEN"
126 ],
127 "Vessel": {
128 "Name": "MSC SAMPLE ARIA"
129 }
130 },
131 {
132 "Order": 3,
133 "Date": "22/10/2026",
134 "Location": "ROTTERDAM, NL",
135 "UnLocationCode": "NLRTM",
136 "Description": "Import Discharged from Vessel",
137 "Detail": [
138 "LADEN"
139 ],
140 "Vessel": {
141 "Name": "MSC SAMPLE ARIA"
142 }
143 }
144 ]
145 }
146 ]
147 }
148 ],
149 "sampleChange": {
150 "changeType": "milestone"
151 }
152 },
153 {
154 "tracking_number": "CMAU5382066",
155 "reference": "PO-44131 sample",
156 "events": [
157 {
158 "eventType": "EQUIPMENT",
159 "eventClassifierCode": "ACT",
160 "eventDateTime": "2026-10-12T09:30:00Z",
161 "equipmentEventTypeCode": "GTIN",
162 "emptyIndicatorCode": "LADEN",
163 "transportCall": {
164 "UNLocationCode": "CNSHA",
165 "modeOfTransport": "TRUCK"
166 }
167 },
168 {
169 "eventType": "EQUIPMENT",
170 "eventClassifierCode": "ACT",
171 "eventDateTime": "2026-10-15T17:05:00Z",
172 "equipmentEventTypeCode": "LOAD",
173 "emptyIndicatorCode": "LADEN",
174 "transportCall": {
175 "UNLocationCode": "CNSHA",
176 "modeOfTransport": "VESSEL",
177 "vessel": {
178 "vesselName": "CMA CGM SAMPLE STAR"
179 },
180 "exportVoyageNumber": "0MX3EW1MA"
181 }
182 },
183 {
184 "eventType": "TRANSPORT",
185 "eventClassifierCode": "ACT",
186 "eventDateTime": "2026-10-16T02:00:00Z",
187 "transportEventTypeCode": "DEPA",
188 "transportCall": {
189 "UNLocationCode": "CNSHA",
190 "modeOfTransport": "VESSEL",
191 "vessel": {
192 "vesselName": "CMA CGM SAMPLE STAR"
193 },
194 "exportVoyageNumber": "0MX3EW1MA"
195 }
196 },
197 {
198 "eventType": "TRANSPORT",
199 "eventClassifierCode": "EST",
200 "eventDateTime": "2026-11-03T08:00:00Z",
201 "transportEventTypeCode": "ARRI",
202 "transportCall": {
203 "UNLocationCode": "USLAX",
204 "modeOfTransport": "VESSEL",
205 "vessel": {
206 "vesselName": "CMA CGM SAMPLE STAR"
207 }
208 }
209 }
210 ]
211 },
212 {
213 "tracking_number": "CBHU7719301",
214 "carrier": "COSCO",
215 "reference": "PO-44139 sample",
216 "pol": "Ningbo, CN",
217 "pod": "Hamburg, DE",
218 "events": [
219 {
220 "description": "Gate-In at First POL",
221 "location": "Ningbo, CN",
222 "unlocode": "CNNGB",
223 "time": "2026-10-08 10:20",
224 "isActual": true
225 },
226 {
227 "description": "Loaded on vessel",
228 "location": "Ningbo, CN",
229 "unlocode": "CNNGB",
230 "time": "2026-10-10 23:45",
231 "isActual": true,
232 "vessel": "COSCO SAMPLE PRIDE",
233 "voyage": "071W"
234 },
235 {
236 "description": "Vessel omitted the port call, cargo rolled to the next sailing",
237 "location": "Singapore, SG",
238 "unlocode": "SGSIN",
239 "time": "2026-10-19 06:00",
240 "isActual": true
241 },
242 {
243 "description": "Vessel arrival at POD",
244 "location": "Hamburg, DE",
245 "unlocode": "DEHAM",
246 "time": "2026-11-12 05:00",
247 "isActual": false
248 }
249 ]
250 },
251 {
252 "trackingNumber": "MSCU1234560",
253 "reference": "PO-44150 sample (typo in the number)"
254 }
255 ]
256};
257
258
259const run = await client.actor("rich_minds/multi-carrier-tracking-ai").call(input);
260
261
262console.log('Results from dataset');
263console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
264const { items } = await client.dataset(run.defaultDatasetId).listItems();
265items.forEach((item) => {
266 console.dir(item);
267});
268
269