1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "snapshotId": "parcel-batch-001",
12 "requiredBases": [
13 "declared",
14 "audited"
15 ],
16 "evidenceCoverage": "complete",
17 "csvDelimiter": ",",
18 "policies": [
19 {
20 "scopeId": "example-policy",
21 "policyRef": "Caller example only: no carrier contract claim",
22 "dimensionUnit": "in",
23 "weightUnit": "lb",
24 "dimensionalDivisor": "139",
25 "dimensionRounding": "ceil",
26 "dimensionIncrement": "1",
27 "billableWeightIncrement": "1",
28 "tolerance": "0"
29 }
30 ],
31 "measurements": [
32 {
33 "recordId": "0001-declared",
34 "packageId": "0001",
35 "scopeId": "example-policy",
36 "basis": "declared",
37 "length": "4",
38 "width": "48",
39 "height": "4",
40 "dimensionUnit": "in",
41 "actualWeight": "9",
42 "weightUnit": "lb",
43 "recordedAt": "2026-10-01T12:00:00Z",
44 "sourceReference": "packing-review/0001/declared"
45 },
46 {
47 "recordId": "0001-audited",
48 "packageId": "0001",
49 "scopeId": "example-policy",
50 "basis": "audited",
51 "length": "5",
52 "width": "49",
53 "height": "5",
54 "dimensionUnit": "in",
55 "actualWeight": "9",
56 "weightUnit": "lb",
57 "recordedAt": "2026-10-01T12:00:00Z",
58 "sourceReference": "packing-review/0001/audited"
59 },
60 {
61 "recordId": "0002-declared",
62 "packageId": "0002",
63 "scopeId": "example-policy",
64 "basis": "declared",
65 "length": "1",
66 "width": "1",
67 "height": "1",
68 "dimensionUnit": "in",
69 "actualWeight": "100",
70 "weightUnit": "lb",
71 "recordedAt": "2026-10-01T12:00:00Z",
72 "sourceReference": "packing-review/0002/declared"
73 },
74 {
75 "recordId": "0002-audited",
76 "packageId": "0002",
77 "scopeId": "example-policy",
78 "basis": "audited",
79 "length": "1",
80 "width": "1",
81 "height": "1",
82 "dimensionUnit": "in",
83 "actualWeight": "100",
84 "weightUnit": "lb",
85 "recordedAt": "2026-10-01T12:00:00Z",
86 "sourceReference": "packing-review/0002/audited"
87 },
88 {
89 "recordId": "0003-declared",
90 "packageId": "0003",
91 "scopeId": "example-policy",
92 "basis": "declared",
93 "length": "20",
94 "width": "20",
95 "height": "20",
96 "dimensionUnit": "in",
97 "actualWeight": "2",
98 "weightUnit": "lb",
99 "recordedAt": "2026-10-01T12:00:00Z",
100 "sourceReference": "packing-review/0003/declared"
101 },
102 {
103 "recordId": "0003-audited",
104 "packageId": "0003",
105 "scopeId": "example-policy",
106 "basis": "audited",
107 "length": "20",
108 "width": "20",
109 "height": "20",
110 "dimensionUnit": "in",
111 "actualWeight": "2",
112 "weightUnit": "lb",
113 "recordedAt": "2026-10-01T12:00:00Z",
114 "sourceReference": "packing-review/0003/audited"
115 },
116 {
117 "recordId": "0004-declared",
118 "packageId": "0004",
119 "scopeId": "example-policy",
120 "basis": "declared",
121 "length": "10",
122 "width": "10",
123 "height": "10",
124 "dimensionUnit": "in",
125 "actualWeight": "4",
126 "weightUnit": "lb",
127 "recordedAt": "2026-10-01T12:00:00Z",
128 "sourceReference": "packing-review/0004/declared"
129 }
130 ],
131 "measurementsCsv": "",
132 "measurementsColumns": {
133 "recordId": "recordId",
134 "packageId": "packageId",
135 "scopeId": "scopeId",
136 "basis": "basis",
137 "length": "length",
138 "width": "width",
139 "height": "height",
140 "dimensionUnit": "dimensionUnit",
141 "actualWeight": "actualWeight",
142 "weightUnit": "weightUnit",
143 "recordedAt": "recordedAt",
144 "sourceReference": "sourceReference"
145 },
146 "invoices": [
147 {
148 "recordId": "invoice-0001",
149 "packageId": "0001",
150 "scopeId": "example-policy",
151 "billedWeight": "40",
152 "weightUnit": "lb",
153 "sourceReference": "invoice-batch/0001"
154 },
155 {
156 "recordId": "invoice-0002",
157 "packageId": "0002",
158 "scopeId": "example-policy",
159 "billedWeight": "100",
160 "weightUnit": "lb",
161 "sourceReference": "invoice-batch/0002"
162 },
163 {
164 "recordId": "invoice-0003",
165 "packageId": "0003",
166 "scopeId": "example-policy",
167 "billedWeight": "58",
168 "weightUnit": "lb",
169 "sourceReference": "invoice-batch/0003"
170 }
171 ],
172 "invoicesCsv": "",
173 "invoicesColumns": {
174 "recordId": "recordId",
175 "packageId": "packageId",
176 "scopeId": "scopeId",
177 "billedWeight": "billedWeight",
178 "weightUnit": "weightUnit",
179 "sourceReference": "sourceReference"
180 }
181};
182
183
184const run = await client.actor("h_murdock/parcel-billable-weight-evidence").call(input);
185
186
187console.log('Results from dataset');
188console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
189const { items } = await client.dataset(run.defaultDatasetId).listItems();
190items.forEach((item) => {
191 console.dir(item);
192});
193
194