1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "document": "https://files.manuscdn.com/user_upload_by_module/session_file/310519663080398616/ATUpqEGiovUnQJOt.txt",
10 "outputSchema": {
11 "type": "object",
12 "properties": {
13 "invoiceNumber": {
14 "type": [
15 "string",
16 "null",
17 ],
18 "description": "Invoice identifier exactly as printed",
19 },
20 "invoiceDate": {
21 "type": [
22 "string",
23 "null",
24 ],
25 "description": "Invoice date in YYYY-MM-DD format",
26 },
27 "currency": {
28 "type": [
29 "string",
30 "null",
31 ],
32 "description": "Three-letter ISO currency code",
33 },
34 "supplierName": { "type": [
35 "string",
36 "null",
37 ] },
38 "supplierVatId": { "type": [
39 "string",
40 "null",
41 ] },
42 "customerName": { "type": [
43 "string",
44 "null",
45 ] },
46 "subtotal": { "type": [
47 "number",
48 "null",
49 ] },
50 "tax": { "type": [
51 "number",
52 "null",
53 ] },
54 "total": { "type": [
55 "number",
56 "null",
57 ] },
58 "dueDate": {
59 "type": [
60 "string",
61 "null",
62 ],
63 "description": "Payment due date in YYYY-MM-DD format",
64 },
65 },
66 "required": [
67 "invoiceNumber",
68 "invoiceDate",
69 "currency",
70 "supplierName",
71 "supplierVatId",
72 "customerName",
73 "subtotal",
74 "tax",
75 "total",
76 "dueDate",
77 ],
78 "additionalProperties": False,
79 },
80}
81
82
83run = client.actor("scalogik/document-processing-api-pdf-ocr-validated-json").call(run_input=run_input)
84
85
86print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
87for item in client.dataset(run.default_dataset_id).iterate_items():
88 print(item)
89
90