1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "documents": [{
10 "url": "https://example.com/invoice.pdf",
11 "filename": "invoice.pdf",
12 }],
13 "fields": [
14 {
15 "name": "invoice_number",
16 "description": "The unique invoice identifier",
17 "type": "string",
18 },
19 {
20 "name": "invoice_date",
21 "description": "The invoice issue date",
22 "type": "date",
23 },
24 {
25 "name": "supplier_name",
26 "description": "The legal name of the supplier",
27 "type": "string",
28 },
29 {
30 "name": "total_amount",
31 "description": "The final amount including taxes",
32 "type": "number",
33 },
34 ],
35}
36
37
38run = client.actor("obaskly/ai-data-extraction-api").call(run_input=run_input)
39
40
41print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
42for item in client.dataset(run.default_dataset_id).iterate_items():
43 print(item)
44
45