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