Tagihan (Invoice)
Tagihan (Invoice).
Invoice Object
- Name
status
- Type
- string
- Description
Enum code indicating the status of the reading result.
SUCCESS
NO_FILE
FILE_INVALID_FORMAT
FAILED
- Name
reason
- Type
- string
- Description
A human-readable message providing more details about the reading result.
- Name
read
- Type
- object
- Description
Contains the extracted information for each field in the Invoice. Each fields has
value
(The reading),page_index
,polygon
(coordinates of the value: top-left, top-right, bottom-right,bottom-left),confidence
(in percentage), andconfidence_text
.- Name
invoice_number
- Type
- string
- Description
This value refers to a unique identification number assigned to an invoice that can be a combination of alphanumeric.
- Name
invoice_date
- Type
- string
- Description
This value represents the date when the invoice is issued by the vendor to the buyer.
- Name
vat_tax
- Type
- number
- Description
This value represents value added tax (VAT) applied to the invoice
- Name
income_tax
- Type
- number
- Description
This value represents income tax applied to the invoice
- Name
invoice_total_tax
- Type
- number
- Description
This represents the amount of tax or sales tax applied to the invoice total.
- Name
invoice_total
- Type
- number
- Description
This value represents the total amount of money that the buyer owes to the vendor for the goods or services listed on the invoice.
- Name
invoice_sub_total
- Type
- number
- Description
This value represents the sub total amount mentioned on the invoice.
- Name
invoice_discount
- Type
- number
- Description
This value represents the amount of discount applied to the transaction.
- Name
down_payment
- Type
- number
- Description
This value represents the amount of initial payment paid from the buyer to vendor.
- Name
voucher
- Type
- number
- Description
This value represents the amount of voucher applied to the transaction.
- Name
vendor_name
- Type
- string
- Description
This value represents the name of the company or individual who provided the goods or services listed on the invoice.
- Name
vendor_address
- Type
- string
- Description
This value represents the physical address of the vendor mentioned on the invoice.
- Name
vendor_tax_id
- Type
- string
- Description
This value represents the tax identification number of the vendor mentioned on the invoice.
- Name
customer_name
- Type
- string
- Description
This value represents the name of the individual or company that is receiving the goods or services listed on the invoice.
- Name
customer_address
- Type
- string
- Description
This value represents the physical address of the customer mentioned on the invoice.
- Name
customer_tax_id
- Type
- string
- Description
This value represents the tax identification number of the customer mentioned on the invoice.
- Name
sender_name
- Type
- string
- Description
This value represents the party who sends the invoice to the customer.
- Name
currency
- Type
- string
- Description
This value represents the currency mentioned on the invoice.
- Name
purchase_order_number
- Type
- string
- Description
This value represents the purchase order number assigned to the order.
- Name
payment_banks
- Type
- array of object
- Description
This value represents all banks that are used by the customer to pay the order.
- Name
payment_bank_name
- Type
- string
- Description
This value represents the name of a bank that is used to pay the order.
- Name
payment_account_number
- Type
- string
- Description
This value represents the account number that is used to make payment.
- Name
payment_account_name
- Type
- string
- Description
This value represents the owner name of the account that is used to make payment.
- Name
items
- Type
- array of object
- Description
This value stores information for each item ordered
- Name
item_name
- Type
- string
- Description
This value represents the name of the item that were bought
- Name
item_quantity
- Type
- string
- Description
This value represents the quantity of the item that were bought.
- Name
item_total_price
- Type
- string
- Description
This value represents the subtotal price of the item multiplied by its quantity.
- Name
item_product_code
- Type
- string
- Description
This value represents the product code of the item.
- Name
item_each_price
- Type
- string
- Description
This value represents the price of the item in unit.
- Name
item_quantity_unit
- Type
- string
- Description
This value represents the unit used by the item.
Read Invoice
Detects a valid Invoice image and returns the information as text.
Required parameter
- Name
image
- Type
- file (.png, .jpg, .jpeg, .tiff, .pdf)
- Description
The image file for the Invoice.
Sample Request
1
2
3
4
5
import { Vision } from '@glair/vision';
const vision = new Vision({ apiKey: 'api-key', username: 'username', password: 'password' });
await vision.ocr.invoice({ image: '/path/to/image/Invoice.jpg' });
Sample Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
{
"status": "SUCCESS",
"reason": "File Successfully Read",
"read": {
"invoice_number": {
"value": "INV2023/23/01/1234",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98,
"confidence_text": 98
},
"invoice_date": {
"value": "2022-03-21",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 62,
"confidence_text": 62
},
"invoice_due_date": {
"value": "2022-04-21",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 87.6,
"confidence_text": 87.6
},
"vat_tax": {
"value": 0,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"income_tax": {
"value": 0,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"invoice_total_tax": {
"value": 0,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"invoice_total": {
"value": 50000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"invoice_sub_total": {
"value": 100000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"invoice_discount": {
"value": 50000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"down_payment": {
"value": 100000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"voucher": {
"value": 100000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"vendor_name": {
"value": "PT Teknologi Terdepan",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"vendor_address": {
"value": "Jl Nama Jalan Indonesia",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"vendor_tax_id": {
"value": "12912731923",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"customer_name": {
"value": 250000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"customer_address": {
"value": 2500000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"customer_tax_id": {
"value": "Jl. Tlk. Betung I No. 45A",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"sender_name": {
"value": "PT Teknologi Terdepan",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"currency": {
"value": "IDR",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"purchase_order_number": {
"value": "192k812120",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
},
"payment_banks": [
{
"payment_bank_name": {
"value": "Bank A",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"payment_account_number": {
"value": 20018312,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"payment_account_name": {
"value": "John Doe",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
}
}
],
"items": [
{
"item_name": {
"value": "T-Shirt",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"item_quantity": {
"value": 1,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"item_price": {
"value": 4500000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"item_unit_price": {
"value": 4500000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"item_product_code": {
"value": "1f1m2",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"item_unit": {
"value": "piece",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
}
}
]
}
}
Request ID
An associated request identifier is generated for every request made to this endpoint.
This value can be found in the response headers under Request-Id
Responses
Various responses for this endpoint, in addition to general responses specified in Errors.
200 - OK
Request with readable Invoice image
Response
1
2
3
4
5
{
"status": "SUCCESS",
"reason": "File Successfully Read",
//...,
}
// TODO: no "Request with non Invoice File"?
400 - Bad Request
Request without form-data image
Response
1
2
3
4
5
{
"status": "NO_FILE",
"reason": "No file in request body",
//...,
}
415 - Unsupported Media Type
Request with non-image file format
Response
1
2
3
4
5
{
"status": "FILE_INVALID_FORMAT",
"reason": "Failed to process invalid file format. Please upload the correct file format",
//...,
}