1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "text": `ACME Supplies Inc.
12Phone: (217) 555-0142 Email: billing@acme-supplies.com
13
14Invoice #: INV-2026-0042
15Invoice Date: Sept 28, 2026
16Due Date: 10/28/2026
17
18Bill To:
19Birch & Co. LLC
2077 Oak Street, Portland, OR 97205
21
22Description Qty Unit Price Amount
23Steel brackets (box) 4 $12.50 $50.00
24Hex bolts M8 x 100 200 $0.15 $30.00
25
26Subtotal: $80.00
27Tax (8%): $6.40
28Total Due: $86.40`,
29 "schema": {
30 "vendor_name": "string",
31 "invoice_number": "string",
32 "invoice_date": "date",
33 "due_date": "date",
34 "customer": "string",
35 "vendor_email": "email",
36 "subtotal": "number",
37 "tax": "number",
38 "total": "number",
39 "line_items": [
40 {
41 "description": "string",
42 "quantity": "number",
43 "unit_price": "number",
44 "amount": "number"
45 }
46 ]
47 }
48};
49
50
51const run = await client.actor("birchwood-data/text-to-data").call(input);
52
53
54console.log('Results from dataset');
55console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
56const { items } = await client.dataset(run.defaultDatasetId).listItems();
57items.forEach((item) => {
58 console.dir(item);
59});
60
61